Quick Start
Option 1: MCP Server (connect to Claude, GPT, any agent)
Section titled “Option 1: MCP Server (connect to Claude, GPT, any agent)”git clone https://github.com/nosqltips/AgentStateGraph.gitcd AgentStateGraphcargo build --release -p agentstategraph-mcpcargo run --release -p agentstategraph-mcpAdd to Claude Code config:
{ "mcpServers": { "stategraph": { "command": "/path/to/AgentStateGraph/target/release/agentstategraph-mcp" } }}Then ask your agent to use AgentStateGraph tools.
Option 2: Rust Library
Section titled “Option 2: Rust Library”cargo add stategraph agentstategraph-core agentstategraph-storageuse stategraph::{Repository, CommitOptions};use agentstategraph_storage::SqliteStorage;use agentstategraph_core::{IntentCategory, Object};
let storage = SqliteStorage::open("./state.db").unwrap();let repo = Repository::new(Box::new(storage));repo.init().unwrap();
// Set state — every write is an atomic commit with intentrepo.set("main", "/app/name", &Object::string("my-project"), CommitOptions::new("developer", IntentCategory::Checkpoint, "Init"));
// Read it backlet name = repo.get_json("main", "/app/name").unwrap();
// Branch, modify, diff, mergerepo.branch("feature", "main").unwrap();repo.set("feature", "/app/version", &Object::string("2.0"), CommitOptions::new("developer", IntentCategory::Explore, "Try v2"));let diff = repo.diff("main", "feature").unwrap();repo.merge("feature", "main", CommitOptions::new("developer", IntentCategory::Merge, "Adopt v2"));Option 3: Python
Section titled “Option 3: Python”cd bindings/pythonpython3 -m venv .venv && source .venv/bin/activatepip install maturin && maturin develop --releasefrom agentstategraph_py import StateGraph
sg = StateGraph("state.db") # SQLite, or StateGraph() for in-memorysg.set("/name", "my-project", "Init", category="Checkpoint")sg.branch("feature")sg.set("/version", "2.0", "Try v2", ref="feature", category="Explore")sg.merge("feature", description="Adopt v2")Option 4: TypeScript
Section titled “Option 4: TypeScript”cd bindings/typescriptnpm install && npm run buildconst { StateGraph } = require('stategraph')const sg = new StateGraph() // or new StateGraph("state.db")sg.set("/name", "my-project", "Init", undefined, "Checkpoint")sg.branch("feature")sg.set("/version", "2.0", "Try v2", "feature", "Explore")sg.merge("feature", undefined, "Adopt v2")Run an Example
Section titled “Run an Example”cargo run --example getting_started -p stategraphcargo run --example agent_workflow -p stategraphcargo run --example multi_agent -p stategraph