Skip to main content

ri_agent_graph/
lib.rs

1//! # agent-graph
2//!
3//! Graph-based agent orchestration for Rust - LangGraph for the Rust ecosystem.
4//!
5//! ## Quick Start
6//!
7//! ```rust,no_run
8//! use ri_agent_graph::prelude::*;
9//!
10//! #[tokio::main]
11//! async fn main() -> Result<()> {
12//!     let graph = AgentGraph::builder()
13//!         .add_node("step1", node!(|state| async move {
14//!             state.set("count", 1).await?;
15//!             Ok(())
16//!         }))
17//!         .add_node("step2", node!(|state| async move {
18//!             let count: i32 = state.get("count").await?;
19//!             state.set("count", count + 1).await?;
20//!             Ok(())
21//!         }))
22//!         .add_edge("step1", "step2")
23//!         .build()?;
24//!
25//!     let state = AgentState::new();
26//!     let result = graph.execute("step1", state).await?;
27//!
28//!     let final_count: i32 = result.get("count").await?;
29//!     assert_eq!(final_count, 2);
30//!
31//!     Ok(())
32//! }
33//! ```
34
35pub mod builder;
36pub mod checkpoint_store;
37pub mod checkpointer;
38pub mod command;
39pub mod config;
40pub mod edge;
41pub mod engine;
42pub mod error;
43pub mod event_sink;
44pub mod execution_cursor;
45pub mod executor;
46pub mod graph;
47pub mod interrupt;
48pub mod join;
49pub mod node;
50pub mod outcome;
51pub mod payload;
52pub mod prelude;
53pub mod receipt;
54pub mod reducer;
55pub mod retry;
56pub mod router;
57pub mod state;
58pub mod stream;
59
60#[cfg(feature = "checkpointing")]
61pub mod checkpoint;
62
63pub use error::{AgentGraphError, CheckpointStoreOperation, Result};
64pub use graph::{AgentGraph, END, START};
65pub use receipt::{ExecutionOutcome, GraphExecutionReceiptV1, StepExecutionReceiptV1};
66pub use state::AgentState;