Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 1.93 KB

File metadata and controls

44 lines (33 loc) · 1.93 KB

rust-langgraph

Rust redesign of LangGraph — not a direct port. Leverages Rust's ownership, async traits, and type system rather than mimicking JS/TS patterns.

Build & Test

cargo build
cargo test
cargo test -p langgraph-core
cargo run --example basic_agent
cargo clippy -- -D warnings

Crate Layout

Crate Purpose
langgraph-core Graph builder, Pregel engine, channels, types, errors
langgraph-checkpoint Checkpointer trait + memory/sqlite/postgres/redis backends
langgraph-prebuilt ReactAgent, ToolNode, prompt utilities
langgraph-runtime High-level runtime wrapping core + checkpoint
langgraph-observability Metrics, tracing, dashboard

Key Design Decisions

  • State = GraphState trait bound: any Clone + Serialize + Deserialize + Send + Sync. No reflection needed.
  • Node = NodeFunction<S> trait: blanket-impl for async fn(S, ExecutionContext) -> GraphResult<NodeOutput<S>>. Node returns StateUpdate (a JsonMap) merged via channels.
  • Pregel / BSP execution: nodes run in parallel supersteps; state is immutable during a step; updates applied atomically after barrier.
  • Channels type-dispatch state merging per key: LastValue, Accumulator, BinaryOp, Ephemeral. Configured via StateGraph::set_channel_type.
  • Command<S> enables routing: Goto, Send (fan-out to specific nodes with state), Interrupt.
  • Checkpointer is generic over S — thread-scoped, supports get_latest, list, put, delete.

Coding Standards

  • Applies my-rust-standards skill (see .claude/skills/my-rust-standards/SKILL.md)
  • No unwrap/expect in non-test code
  • Errors via thiserrorLangGraphError / GraphResult<T>
  • No multi-paragraph doc comments; terse /// only where non-obvious
  • Test names: test_<subject>_<condition> — max 3 words after test_

What's Not Here Yet

See docs/missing-features.md for planned work.