Troupekit and LlamaIndex
LlamaIndex is a Python framework for building on your own data, with agents built on its Workflows engine. We compared FunctionAgent at release v0.14.26 and the Workflows package at llama-index-workflows@2.26.1, checked on 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 LlamaIndex
From the basic agent workflow example (agent_workflow_basic.ipynb), four cells in a row:
from llama_index.llms.openai import OpenAI
llm = OpenAI(model="gpt-4o-mini", api_key="sk-...")
from tavily import AsyncTavilyClient
async def search_web(query: str) -> str:
"""Useful for using the web to answer questions."""
client = AsyncTavilyClient(api_key="tvly-...")
return str(await client.search(query))
from llama_index.core.agent.workflow import FunctionAgent
agent = FunctionAgent(
tools=[search_web],
llm=llm,
system_prompt="You are a helpful assistant that can search the web for information.",
)
response = await agent.run(user_msg="What is the weather in San Francisco?")
For a kill and resume, an agent's run state is a Context that you snapshot with ctx.to_dict() and store yourself. The Workflows docs are clear about the limit: "This survives a restart, but not a crash during the run. You only have the state as of the last to_dict()" (durable_workflows.md). Plain workflows can resume automatically on the llama-agents-dbos runtime (dbos.md), but in v0.14.26 the agent classes do not pass a runtime through to the workflow (base_agent.py), and the framework docs do not describe it for agents. We read that in the source; we did not run it.
There is no spend cap. TokenCountingHandler counts tokens for cost analysis but does not stop a run (usage_pattern.md); the agent has a turn cap, max_iterations.
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
| LlamaIndex 0.14.26 | Troupekit 0.4 | |
|---|---|---|
| Durability | Agents: manual Context snapshots to your own storage. Plain workflows: automatic on llama-agents-dbos with SQLite | Checkpoint after every step and resume by run id, once checkpoints use Storage::sqlite; the default in-memory store is lost when the process exits |
| Spend limits | None; token counting only, and a turn cap | USD per call, per run and per period, when you set them; checked before each call |
| Tracing | Built-in instrumentation and OpenTelemetry (observability) | Built-in tracer, JSONL and an HTML viewer |
| Evals | LLM-based evaluation modules, aimed at retrieval quality (evaluating) | Evals on the persona, checked on every run |
| Offline and on-device | llama.cpp in process through llama-index-llms-llama-cpp, plus Ollama, vLLM and Transformers (local.md) | llama.cpp in process, Ollama, and a route policy per call |
| Mobile | No iOS or Android docs found | Builds for iOS and Android in CI; Swift and Kotlin bindings since 0.4, built from source |
| Single binary | Needs Python 3.11 or newer (pyproject.toml) | Compiles into your program |
Where LlamaIndex is better
Breadth: at v0.14.26 its repository holds 101 model packages and 552 integration packages in all, and document ingestion, retrieval and retrieval evaluators come in one stack. It also has MCP tools today (llamaindex_mcp.md).
Where troupekit is different
With Storage::sqlite checkpoints, an agent run is checkpointed after every step without snapshot code, and a run checks the USD caps you set before every model call. Troupekit's own retrieval is smaller, hybrid search over its own index in the same SQLite file, with no external vector database until 2.0.