Troupekit and LangChain.js
LangChain.js builds agents in TypeScript on top of LangGraph.js, which runs them as stateful graphs. We compared langchain at 1.6.8 and @langchain/langgraph at 1.7.5, checked on 2026-11-28. Their 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 LangChain.js
An agent with one tool, from the overview (overview.mdx):
// First install: npm install langchain zod @langchain/openai
import { createAgent, tool } from "langchain";
import * as z from "zod";
const getWeather = tool(
(input) => `It's always sunny in ${input.city}!`,
{
name: "get_weather",
description: "Get the weather for a given city",
schema: z.object({
city: z.string().describe("The city to get the weather for"),
}),
}
);
const agent = createAgent({
model: "gpt-6.1-sol",
tools: [getWeather],
});
console.log(
await agent.invoke({
messages: [{ role: "user", content: "What's the weather in San Francisco?" }],
})
);
The persona is a systemPrompt (agents-system-prompt-js.mdx):
var agent = createAgent({
model: "openai:gpt-6.1-sol",
tools,
systemPrompt: "You are a helpful assistant. Be concise and accurate.",
});
For a kill and resume you add a persistent checkpointer, such as @langchain/langgraph-checkpoint-sqlite or the Postgres one, run with a thread_id, and call graph.invoke(null, config) to load the latest checkpoint and retry unfinished work (checkpointers.mdx). The JS docs add a caveat for the "sync" durability mode: "a process crash mid-run can still lose recent checkpoints" (checkpointers.mdx). From the SQLite saver's README (README.md), two of its lines:
import { SqliteSaver } from "@langchain/langgraph-checkpoint-sqlite";
const checkpointer = SqliteSaver.fromConnString(":memory:");
":memory:" keeps the checkpoints in memory, so they are gone when the process exits. For a kill and resume, pass a file path instead; fromConnString takes a connection string or a local path (index.ts).
There is no cap in money or tokens. The built-in middleware limits the number of model calls per thread or run (modelCallLimit.ts), and tool calls the same way.
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
| LangChain.js 1.6.8 and LangGraph.js 1.7.5 | Troupekit 0.4 | |
|---|---|---|
| Durability | A checkpointer package (SQLite, Postgres, MongoDB or Redis) and a thread_id; in JS, "sync" mode can lose recent checkpoints on a crash | With Storage::sqlite checkpoints, a checkpoint after every step, committed before the next step starts; the default in-memory store is lost when the process exits |
| Spend limits | Model-call and tool-call count limits | USD per call, per run and per period, when you set them; checked before each call |
| Tracing | LangSmith, which needs an account (observability.mdx) | Built-in tracer, JSONL and an HTML viewer |
| Evals | The separate agentevals package, and LangSmith (evals.mdx) | Evals on the persona, checked on every run |
| Offline and on-device | ChatOllama, and ChatLlamaCpp on node-llama-cpp in @langchain/community (llama_cpp.ts) | llama.cpp in process, Ollama, and a route policy per call |
| Mobile | None found; the README lists Node, Workers, edge runtimes, browsers, Deno and Bun (README.md) | Builds for iOS and Android in CI; Swift and Kotlin bindings since 0.4, built from source |
| Single binary | Needs Node 20 or newer by the manifest, 22 by the quickstart (package.json) | Compiles into your program |
Where LangChain.js is better
Stateful graph control is mature: interrupts, time travel to any checkpoint, five checkpointer back ends, and MCP adapters, with 32 provider packages in the repository at this tag. Troupekit plans forking from a checkpoint for 0.5 and MCP for 0.6.
Where troupekit is different
A money cap ships with the agent instead of a call count, tracing needs no account, and the run, the checkpoints and the model can all live in one process.