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": { "agentstategraph": { "command": "/path/to/AgentStateGraph/target/release/agentstategraph-mcp" } }}Then ask your agent to use AgentStateGraph tools.
Option 2: HTTP REST API
Section titled “Option 2: HTTP REST API”Same binary, add --http:
cargo run --release -p agentstategraph-mcp -- --http --port 3001# Health checkcurl http://localhost:3001/api/health
# Set a value with intentcurl -X POST http://localhost:3001/api/state/main/set \ -H "Content-Type: application/json" \ -d '{"path":"/app/name","value":"my-project","intent_category":"Checkpoint","intent_description":"Init"}'
# Read it backcurl http://localhost:3001/api/state/main?path=/app/name
# Blame — who changed it and whycurl "http://localhost:3001/api/blame/main?path=/app/name"
# Search across all valuescurl "http://localhost:3001/api/state/main/search?query=project"
# Stats dashboardcurl http://localhost:3001/api/stats/main19 endpoints with CORS enabled — see the MCP Server guide for the full list.
Option 3: Rust Library (embed in your own app)
Section titled “Option 3: Rust Library (embed in your own app)”cargo add agentstategraph agentstategraph-core agentstategraph-storageuse agentstategraph::{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 4: Python
Section titled “Option 4: Python”cd bindings/pythonpython3 -m venv .venv && source .venv/bin/activatepip install maturin && maturin develop --releasefrom agentstategraph_py import AgentStateGraph
sg = AgentStateGraph("state.db") # SQLite, or AgentStateGraph() 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 5: TypeScript
Section titled “Option 5: TypeScript”cd bindings/typescriptnpm install && npm run buildconst { AgentStateGraph } = require('agentstategraph')const sg = new AgentStateGraph() // or new AgentStateGraph("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 agentstategraphcargo run --example agent_workflow -p agentstategraphcargo run --example multi_agent -p agentstategraph