Expand description
§agent-graph
Graph-based agent orchestration for Rust - LangGraph for the Rust ecosystem.
§Quick Start
use ri_agent_graph::prelude::*;
#[tokio::main]
async fn main() -> Result<()> {
let graph = AgentGraph::builder()
.add_node("step1", node!(|state| async move {
state.set("count", 1).await?;
Ok(())
}))
.add_node("step2", node!(|state| async move {
let count: i32 = state.get("count").await?;
state.set("count", count + 1).await?;
Ok(())
}))
.add_edge("step1", "step2")
.build()?;
let state = AgentState::new();
let result = graph.execute("step1", state).await?;
let final_count: i32 = result.get("count").await?;
assert_eq!(final_count, 2);
Ok(())
}Re-exports§
pub use error::AgentGraphError;pub use error::CheckpointStoreOperation;pub use error::Result;pub use graph::AgentGraph;pub use graph::END;pub use graph::START;pub use receipt::ExecutionOutcome;pub use receipt::GraphExecutionReceiptV1;pub use receipt::StepExecutionReceiptV1;pub use state::AgentState;
Modules§
- builder
- checkpoint
- checkpoint_
store - Granular checkpoint store for recording node execution attempts.
- checkpointer
- command
- config
- edge
- engine
- error
- event_
sink - Structured event pipeline for graph execution.
- execution_
cursor - executor
- Executor abstraction for running node attempts.
- graph
- interrupt
- join
- JoinNode for deterministic fan-in merging.
- node
- outcome
- Node execution outcomes and interrupt types.
- payload
- Payload trait and PayloadNode for integrating external work units.
- prelude
- Convenience re-exports for common use
- receipt
- Receipt types for graph execution auditability.
- reducer
- retry
- router
- state
- stream