1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//! # Rust LangGraph — community graph runtime for LLM apps
//!
//! **Rust LangGraph** is an independent Rust library inspired by [LangGraph](https://github.com/langchain-ai/langgraph)
//! (not affiliated with LangChain). It helps you build stateful, multi-actor LLM workflows with a graph execution
//! model similar in spirit to Google’s Pregel, with checkpointing, streaming, and conditional routing.
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use rust_langgraph::prelude::*;
//!
//! #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
//! struct MyState {
//! count: i32,
//! }
//!
//! impl State for MyState {
//! fn merge(&mut self, other: Self) -> Result<(), Error> {
//! self.count += other.count;
//! Ok(())
//! }
//! }
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let mut graph = StateGraph::new();
//!
//! graph.add_node("increment", |state: MyState, _config: &Config| async move {
//! Ok(MyState { count: state.count + 1 })
//! });
//!
//! graph.set_entry_point("increment");
//! graph.set_finish_point("increment");
//!
//! let app = graph.compile(None)?;
//! let result = app.invoke(MyState { count: 0 }, Config::default()).await?;
//!
//! println!("Final count: {}", result.count);
//! Ok(())
//! }
//! ```
//!
//! ## Features
//!
//! - **Stateful Execution**: Build graphs where nodes communicate through shared state
//! - **Checkpointing**: Save and resume execution at any point
//! - **Streaming**: Stream events as the graph executes
//! - **Conditional Logic**: Dynamic routing based on state
//! - **Parallel Execution**: Execute independent nodes concurrently
//! - **Human-in-the-Loop**: Interrupt and resume with human input
//! - **LLM Integration**: OpenAI, OpenRouter, Anthropic, and Ollama adapters (feature-gated)
//!
//! ## More documentation
//!
//! - **README.md** — full user guide (install, tutorial, API table, examples)
//! - **AGENTS.md** — cheat sheet for AI coding agents and contributors (correct crate name, features, patterns, pitfalls)
/// Re-exports of commonly used types for convenient imports
// Re-export commonly used types at the crate root
pub use Config;
pub use ;
pub use State;
pub use StateGraph;