Skip to main content

cairn/
lib.rs

1//! # Cairn
2//!
3//! Durable, governed, model-agnostic agents.
4//!
5//! ```ignore
6//! use cairn::prelude::*;
7//!
8//! let agent = Agent::builder("support")
9//!     .model(cairn::models::from_spec("anthropic:claude-opus-5-5")?)
10//!     .system("You resolve support tickets.")
11//!     .tool(get_order)
12//!     .tool(refund)                       // Effect::Irreversible -> needs approval
13//!     .budget(Budget::default().max_steps(20).max_usd(1.0))
14//!     .journal(JsonlJournal::new("runs")?)
15//!     .build()?;
16//!
17//! let outcome = agent.run("Refund order 1042").await?;
18//! ```
19
20pub use cairn_runtime::*;
21
22/// Model adapters and `provider:model` construction.
23pub mod models {
24    pub use cairn_models::*;
25}
26
27/// PostgreSQL journal (enable the `postgres` feature).
28#[cfg(feature = "postgres")]
29pub use cairn_journal_postgres::PostgresJournal;
30
31/// Model Context Protocol client (enable the `mcp` feature).
32#[cfg(feature = "mcp")]
33pub mod mcp {
34    pub use cairn_mcp::*;
35}
36
37pub mod prelude {
38    pub use cairn_runtime::{
39        Agent, AllowAll, Budget, Content, Decision, Effect, EffectPolicy, Event, EventKind, FallbackModel,
40        InMemoryJournal, Journal, JsonlJournal, Message, Model, PendingCall, Policy, Priced, Pricing, RunOutcome,
41        RunState, Status, StreamEvent, Tool, ToolCtx, ToolError, ToolSpec, tool,
42    };
43}