v0.5.0-beta.1 · BSL 1.1

AgentStateGraph

What Git was to source code, AgentStateGraph is to agent state — a content-addressed, branchable, blameable state primitive, designed from the ground up for AI agents as the primary actor.

Rust core · 5 language bindings (Py / TS / Go / WASM / C FFI) · 27 MCP tools · HTTP API · Plans & Tasks · schema migrations

View on GitHub Quick Start Compare Try the Explorer

A future where AI is responsible for an entire infrastructure — rollouts, tracing, observability, alerts, reports — and is accountable for it mechanically rather than socially. Every change carries why, who authorized it, what alternatives existed, and what the agent expected vs. observed, across every branch, forever.

Three moments that change everything

These aren't hypotheticals. They're the conversations happening right now in every company deploying AI agents.

Story 1 — The 2 AM incident

"What happened overnight?"

An agent managing your production cluster detects a node failure at 2 AM. It reroutes traffic with 73% confidence. At 8 AM, the CTO walks in and asks what happened.

With logs: two hours reconstructing events from CloudWatch, Slack threads, and guesswork.

With AgentStateGraph: blame /cluster/node-3/status — full chain in three minutes. Who detected it, what alternatives were considered, why this approach was chosen, what confidence level, what happened next.

🔍 blame /cluster/node-3/status
agent: agent/monitor
time: 2026-04-10 02:14:07 UTC
intent: Fix — Reroute traffic from failed node
confidence: 0.73
reasoning: "Node-3 health check failed 3x in 60s. Rerouting to node-1 and node-4. Not restarting — disk I/O errors suggest hardware."
alternatives: restart (rejected, 0.21), ignore (rejected, 0.06)
authority: ops-policy/auto-failover
previous: agent/setup 2026-04-09 14:00
intent: Checkpoint — Mark node-3 healthy after deploy
Story 2 — The audit

"Show me every agent change to billing in Q3"

Your company deploys AI agents that touch the billing system. A regulator asks for a complete record of every change, who authorized it, and why.

With observability tools: a two-week log reconstruction project. Engineers dig through LangSmith traces, piece together timelines, and pray the retention policy hasn't expired.

With AgentStateGraph: one query, one sealed epoch export, handed to the auditor. Tamper-evident, independently verifiable, done in 30 seconds.

📋 Audit export SEALED
query --path "/billing/*" --after 2026-07 --before 2026-10
Refineagent/billing94%
Update pricing tier thresholds for enterprise plan
Fixagent/billing88%
Correct proration calculation for mid-cycle upgrades
Checkpointagent/compliance99%
Seal Q3 billing epoch — 47 commits, 3 agents, 0 deviations
EPOCH SEALED · hash: f5b2...17 · tamper-evident
Story 3 — The speculation

"Try three approaches, pick the best one"

A planning agent needs to decide how to migrate a database. Instead of picking one approach and hoping, it creates three speculations — O(1) branches that cost nothing to create and nothing to discard.

Each speculation runs independently. The agent compares outcomes side by side, commits the winner with full reasoning, and discards the rest.

If the winner was wrong, the blame trail shows exactly what the agent expected vs. what happened, what alternatives it considered, and why it chose this one. Accountability by construction, not by accident.

speculate — 3 approaches
Approach A
Live migration, zero downtime
conf: 0.45
Approach B ✓
Blue-green with staged cutover
conf: 0.87
Approach C
Dump and restore, 4h downtime
conf: 0.32
Committed: Approach B — "Blue-green minimizes risk while keeping rollback path open"

Every commit answers nine questions

Git commits answer "what changed." AgentStateGraph commits answer everything else too.

state_root
What changed?
intent
Why?
reasoning
How did it decide?
confidence
How sure was it?
agent_id
Who did it?
authority
Who authorized it?
resolution
What was accomplished?
tool_calls
What actions produced this?
alternatives
What else was considered?

One primitive, every language

Rust is the reference implementation. Every other binding rides on the same core and the same commit format — a Python agent and a Go agent can write to the same repository and see each other's intent annotations.

Rust
reference implementation · BSL 1.1
cargo add agentstategraph
Python
PyO3 wheels · 3.10+
pip install agentstategraph
TypeScript / Node
napi-rs prebuilds · Node 18+
npm install @agentstategraph/core
Go
cgo over the C FFI · Go 1.22+
go get github.com/nosqltips/AgentStateGraph/bindings/go
WASM / Browser
wasm-bindgen · browser, Deno, Node
npm install @agentstategraph/wasm
C FFI
stable C ABI · header + static lib
cargo build -p agentstategraph-ffi --release
27 MCP tools HTTP REST API Cross-binding parity tests

Eight crates, one primitive

ASG is a Cargo workspace: a small, I/O-free core; pluggable storage; a user-facing facade; and the extensions that make it useful across a fleet — tasks, migrations, MCP, FFI, WASM.

agentstategraph-core core

Content-addressed commits, intent categories, blame. Zero I/O dependencies — pure types and algorithms. Everything else builds on this.

agentstategraph-storage storage

Pluggable backends: in-memory for tests, SQLite for single-node, extensible for Postgres and S3-backed deployments. All behind one trait.

agentstategraph facade

The user-facing crate most callers depend on. Re-exports core + storage and presents the ergonomic Repository API — get, set, branch, merge, log, blame, speculate.

agentstategraph-tasks new in 0.4

Plans, tasks, assignments, blockers, derived status. A shared primitive so every ASG consumer — CTXone, ThreadWeaver, Console — agrees on what a "task" is. Prevents plan-rot across the fleet.

agentstategraph-migrate new in 0.4

Schema-version registry and migration runner. Tag your repo with a schema version; register forward migrations; run migrate check / migrate run on any ref.

agentstategraph-mcp server

Model Context Protocol server exposing 27 tools plus an HTTP REST API. Drop-in for Claude Desktop, Cursor, or any MCP-speaking agent.

agentstategraph-ffi ffi

Stable C ABI. What Go, and any future Java / Ruby / C# binding calls. One header, one static lib — no Rust toolchain needed on the consumer.

agentstategraph-wasm wasm

wasm-bindgen build for browsers, Deno, and Node. Run ASG in a browser tab against an in-memory repo — ideal for demos, client-side prototypes, and the Explorer.

Connect an agent in 60 seconds

terminal
 

Clear on scope

AgentStateGraph is a state primitive. It is the layer on which a next-generation IaC tool, a next-generation GitOps tool, and agent-native ops tooling can all be built.

NOT a Terraform replacement
Wrong actor model. Terraform assumes humans writing HCL. AgentStateGraph assumes agents making low-confidence decisions at scale.
NOT a LangGraph helper
Different layer. LangGraph's StateGraph is an in-process Python dict. AgentStateGraph is a persistent substrate used between and above agents.

Why BSL 1.1?

AgentStateGraph is a state primitive designed to become infrastructure. Infrastructure primitives are strip-mining targets: cloud providers offer them as managed services, capture the value, and contribute nothing back. BSL 1.1 closes that gap.

Individuals, startups, and enterprises using AgentStateGraph internally — including in production — are unaffected.
The restriction covers one specific case: offering AgentStateGraph as a hosted or managed service to third parties without a commercial agreement.
After four years, each version converts to Apache 2.0 permanently, with no conditions. This is a binding commitment, not a marketing promise.
Why not MIT from day one?

Because the project wouldn't survive it. An MIT-licensed infrastructure primitive that gains traction gets absorbed by a hyperscaler within 18 months. BSL 1.1 lets the project grow, stay independent, and convert to a fully permissive license once it's established enough that strip-mining is no longer an existential threat.

This is the same reasoning MongoDB, Elastic, and MariaDB used — with one difference: we committed to the conversion date upfront.

ThreadWeaver — the reference app

AI chat with branchable conversations, multimodal, tool calling, MCP integration. Every feature powered by AgentStateGraph.

Visit threadweaver.org GitHub