Troupekit and LangGraph
LangGraph runs agents as stateful graphs with checkpoints, and is the closest Python design to troupekit's durable runs. We compared langgraph at 1.2.24, checked on 2026-11-28. Its docs live in a separate repository with no release tags, so docs links point at its commit ba020fb from 2026-11-28.
The same agent
The test agent is small on purpose: a persona, one tool, a run that is killed and resumed, and a spend cap.
In LangGraph
The shortest real agent with one tool is in the prebuilt package's README (README.md). It sets no persona, and at this tag create_react_agent is deprecated in favour of LangChain's create_agent (chat_agent_executor.py), shown on the LangChain page.
from langchain_anthropic import ChatAnthropic
from langgraph.prebuilt import create_react_agent
# Define the tools for the agent to use
def search(query: str):
"""Call to surf the web."""
# This is a placeholder, but don't tell the LLM that...
if "sf" in query.lower() or "san francisco" in query.lower():
return "It's 60 degrees and foggy."
return "It's 90 degrees and sunny."
tools = [search]
model = ChatAnthropic(model="claude-3-7-sonnet-latest")
app = create_react_agent(model, tools)
# run the agent
app.invoke(
{"messages": [{"role": "user", "content": "what is the weather in sf"}]},
)
For a kill and resume, compile the graph with a persistent saver, such as SqliteSaver from the separately installed langgraph-checkpoint-sqlite (interrupts.mdx):
checkpointer = SqliteSaver(
sqlite3.connect("tool-approval.db", check_same_thread=False)
)
graph = builder.compile(checkpointer=checkpointer)
Then graph.invoke(None, config) with the same thread_id "loads the latest checkpoint and retries unfinished work" (checkpointers.mdx). Checkpoints are written at super-step boundaries, so the node that was running when the process died runs again (fault-tolerance.mdx). The default durability mode is "async" (main.py), which has "a small risk that LangGraph does not write checkpoints if the process crashes during execution"; durability="sync" writes before the next step (checkpointers.mdx).
There is no cap in money or tokens; the recursion limit, 10,007 super-steps by default, stops a runaway graph (graph-api.mdx).
In troupekit
The persona is the doc comment and the tool is a #[tool] function. This is the tool_agent example:
#![allow(unused)]
fn main() {
/// Adds numbers with the add tool.
#[agent(model = "openai/gpt-6-luna", tools = [add])]
fn calc() {}
}
A role, a goal, evals, a spend cap of 5 000 millionths of a dollar per run and the checkpoint store are keys on the same macro. This one is from a test of the kit:
#![allow(unused)]
fn main() {
#[agent(
model = "fake/m",
role = "Checks facts.",
goal = "A short answer.",
display_name = "Fact Checker",
evals = ["min_items(items, 1)"],
limits = Limits { run: Some(5_000), ..Limits::default() },
checkpoints = Storage::memory(),
max_turns = 3,
max_tokens = 256,
retries = 1,
laws = "tests/fixtures/rules.bend",
auto_laws = false,
)]
}
In 0.4 the laws key is validated at build and not enforced by the run (Proofs and laws). With the SQLite store as checkpoints, a new process resumes a killed run by its id. This is the kill_model_call example, which is killed in the middle of a local model call:
#![allow(unused)]
fn main() {
("resume", Some(id)) => {
let run_id: RunId = serde_json::from_str(&format!("\"{id}\""))?;
let text = built.resume(run_id).await?;
println!("RESUMED {}", text.len());
}
}
Nothing else is needed: no server, no second process to run the engine, no Python. Durable runs and Spend limits say what each part guarantees.
Side by side
| LangGraph 1.2.24 | Troupekit 0.4 | |
|---|---|---|
| Durability | Super-step checkpoints through a saver package; "async" by default, "sync" to write before the next step | With Storage::sqlite checkpoints, every step's checkpoint is written before the next step starts; the default in-memory store is lost when the process exits |
| Spend limits | None; a recursion limit | USD per call, per run and per period, when you set them; checked before each call |
| Tracing | LangSmith, which needs an account and API key (observability.mdx) | Own tracer, JSONL and an HTML viewer |
| Evals | Separate agentevals and openevals packages, and LangSmith | Evals on the persona, checked on every run |
| Offline and on-device | Through LangChain chat models: Ollama, and ChatLlamaCpp in langchain-community | llama.cpp in process, Ollama, and a route policy per call |
| Mobile | None found | Builds for iOS and Android in CI; Swift and Kotlin bindings since 0.4, built from source |
| Single binary | Needs Python 3.10 or newer (pyproject.toml) | Compiles into your program |
Where LangGraph is better
Durable-execution controls and storage choice. It has three durability modes, time travel to any checkpoint, pending writes so finished parallel nodes are not run again (checkpointers.mdx), and savers for Postgres, MongoDB and Azure Cosmos DB with a conformance test kit. Troupekit stores checkpoints in SQLite only and plans forking a run from a checkpoint for 0.5.
Where troupekit is different
The strict write order is not a mode to pick: with Storage::sqlite checkpoints, every step is written before the next one starts. Every call is checked against the money caps you set, and the agent, its checkpoints and its model can all run in one process on the device.