{"slug": "show-hn-troupekit-rust-framework-for-agents-that-resume-after-a-crash", "title": "Show HN: Troupekit, Rust Framework for Agents That Resume After a Crash", "summary": "Troupekit 0.4, an open-source Rust framework for LLM agents from developer ChaoticQubit, checkpoints every agent run into a single SQLite file so a killed process can resume where it stopped, the project's documentation states. The framework runs agents written as Rust functions via an #[agent] macro or as persona TOML files, calls Anthropic, OpenAI, Gemini and any OpenAI-compatible server or a local GGUF model through llama.cpp, and combines keyword and vector retrieval with HNSW and quantized indexes in the same SQLite file. Troupekit ships as a Rust workspace with no Python runtime, builds in CI for Linux x86_64 and aarch64, Windows, macOS, Android and iOS, and is installable with `cargo add troupekit`; a separate `troupekit-cli` crate provides `ingest` and `trace` commands.", "body_md": "### [Docs](https://troupekit.org/) · [Install](https://troupekit.org/install.html) · [Examples](https://github.com/ChaoticQubit/troupekit/tree/main/crates/troupekit/examples) · [API reference](https://docs.rs/troupekit) · [crates.io](https://crates.io/crates/troupekit)\n\n```\ncargo add troupekit\ncargo add tokio --features rt-multi-thread,macros\n```\n\nTroupekit is an open-source Rust framework for LLM agents that run inside your own program. You write an agent as a Rust function with `#[agent]`, or as a persona TOML file. You give it tools, memory and documents, and you can run it in graph workflows that survive a restart.\n\nEverything lives in one Rust workspace, with no Python runtime: agents, workflows, retrieval, memory and tracing. Stores stay in memory until you ask for durability. Call `Troupe::builder().sqlite(path)` and every run checkpoints into one SQLite file, and a killed process can resume the run where it stopped.\n\nThe model can be hosted or local. Troupekit calls Anthropic, OpenAI, Gemini and any OpenAI-compatible server, or runs a GGUF model on the device through llama.cpp. A route policy can pick between them for each call.\n\nYour own documents are searchable by keyword, by vector or both, with HNSW and quantized indexes, all in the same SQLite file. CI builds the whole thing for Linux on x86_64 and aarch64, Windows, macOS, Android and iOS.\n\nThe quickest way to see it run is the bundled example, from a clone:\n\n```\ngit clone https://github.com/ChaoticQubit/troupekit\ncd troupekit\nexport OPENAI_API_KEY=sk-...\ncargo run -p troupekit --example hello\n```\n\nThe example is the whole program:\n\n```\nuse troupekit::prelude::*;\n\n/// Greet the user by name.\n#[agent(model = \"openai/gpt-6-luna\")]\nfn greeter() {}\n\n#[tokio::main]\nasync fn main() -> Result<(), KitError> {\n    println!(\"{}\", greeter().run(\"I am Ada\").await?);\n    Ok(())\n}\n```\n\nThe doc comment becomes the agent's instructions. The model is a `vendor/model` selector from the built-in catalog in `crates/troupekit-providers/catalog/providers.toml`, and the key comes from `<VENDOR>_API_KEY`, here `OPENAI_API_KEY`.\n\n`crates/troupekit/examples/` has more to try. `tool_agent` gives an agent a `#[tool]`. `kill_resume` runs a SQLite-backed workflow that resumes after its process is killed. `support_agent` answers customer questions from a folder of Markdown articles; it needs `--features knowledge`.\n\nTo use it in your own project, add it with the `cargo add` lines at the top, or in `Cargo.toml`:\n\n```\n[dependencies]\ntroupekit = \"0.4\"\ntokio = { version = \"1\", features = [\"rt-multi-thread\", \"macros\"] }\n```\n\nTo try unreleased changes on `main`, depend on the repository instead: `troupekit = { git = \"https://github.com/ChaoticQubit/troupekit\", branch = \"main\" }`.\n\nThe command line tool is a separate crate. Install it with:\n\n```\ncargo install troupekit-cli\n```\n\nIt has two commands. `troupekit ingest` builds a searchable index from a folder of documents, and `troupekit trace` shows a trace file in the terminal or as an HTML page.\n\n| Crate | What | \n|---|---|\n| `troupekit` | Entry crate. `use troupekit::prelude::*` for the macros and builders;`Troupe::builder()` wires in-memory or SQLite stores and hands out a runner; re-exports the engines | \n| `troupekit-kit` | Ergonomic API: one builder or one macro per agent, tool and graph | \n| `troupekit-macros` | The `#[agent]` and`#[tool]` attribute macros | \n| `troupekit-core` | Messages, secrets, errors, events, ids, clock, storage traits and in-memory stores | \n| `troupekit-providers` | Anthropic, OpenAI, Gemini and OpenAI-compatible wire protocols, provider catalog with prices, retry, fallback and cost metering | \n| `troupekit-local` | On-device models: the `LocalModel` trait, a model catalog and llama.cpp | \n| `troupekit-tools` | Tool trait, validating registry, SSRF-guarded web fetch, web search over Brave and SearXNG, declarative HTTP tools | \n| `troupekit-context` | Memory scopes, profile facts, chunking, embeddings, hybrid retrieval and context blocks | \n| `troupekit-index` | Vector indexes: exact brute force and HNSW, f16 and i8 quantization, persistable pages | \n| `troupekit-agent` | Persona TOML agents: layered loader, checkpointable run, typed output, evals and LLM judge, budgets | \n| `troupekit-graph` | TOML workflows of agent, tool, human, router, join and end nodes, with parallel branches, human pauses and retries | \n| `troupekit-host` | Leased job queue, event log and a runner with worker and serverless step modes, crash-safe resume | \n| `troupekit-store-sqlite` | One SQLite file for checkpoints, memory logs, blobs, the job queue and the usage ledger; optional SQLCipher | \n| `troupekit-trace` | Zero-dependency trace spans, sinks and viewers | \n| `troupekit-cli` | The `troupekit` command:`troupekit ingest <dir>` builds a searchable index in one SQLite file,`troupekit trace <file>` shows a trace | \n| `troupekit-ffi-core` | Binding-neutral API: plain Rust handles, records and host traits that the binding crates translate | \n| `troupekit-ffi` | The UniFFI layer for the Swift and Kotlin bindings | \n| `troupekit-py` | The PyO3 layer for the Python bindings; built from source, not on crates.io | \n\nFeatures of the `troupekit` crate:\n\n| Feature | Default | What | \n|---|---|---|\n| `kit` | yes | The `#[agent]` and`#[tool]` macros and the`Agent` and`Graph` builders | \n| `sqlite` | yes | SQLite stores through `Troupe::builder().sqlite(path)` | \n| `reqwest` | yes | The HTTP transport for cloud providers. Turn it off to build without the TLS stack | \n| `knowledge` | no | Document loading, embeddings and hybrid search for agents | \n| `sqlcipher` | no | Encrypted SQLite with a vendored OpenSSL | \n| `sqlcipher-system` | no | Encrypted SQLite with the system OpenSSL | \n| `local` | no | The `LocalModel` trait and model catalog | \n| `llama` | no | llama.cpp models. Needs CMake and the llama.cpp source: run `cargo xtask fetch-llama` or set`TROUPEKIT_LLAMA_SRC` | \n\nRust 1.89 or newer for `troupekit`, `troupekit-kit`, `troupekit-store-sqlite`, `troupekit-cli` and the binding crates `troupekit-ffi-core`, `troupekit-ffi` and `troupekit-py`; 1.85 or newer for the other crates on crates.io.\n\nTroupekit is at 0.4, before 1.0: the API can change between minor versions.\n\n| Release | Theme | A user can | \n|---|---|---|\n| 0.1 | Survives a restart | Kill the app mid-run and resume from SQLite | \n| 0.2 | Knows your docs | Search local documents by keyword, vector or hybrid, and remember facts | \n| 0.3 | Thinks offline | Run on a local GGUF model or switch to cloud by policy, and trace a run | \n| 0.4 (current) | In your app | Call Troupekit from Swift, Kotlin and Python, and use Apple and Android on-device models (built from source; no SPM, Maven or PyPI package is published yet) | \n| 0.5 | Works in teams | Use team, crew and handoff patterns in TOML, parallel branches, and fork a run | \n| 0.6 | Plugs in anywhere | Use MCP tools, and expose Troupekit as an MCP server | \n| 0.7 | Proven | Prove workflow properties with Bend, replay runs deterministically and run evals | \n| 1.0 | On-device core | Meet the 1.0 acceptance criteria on Linux, Windows, macOS, Android and iOS | \n\nSee [CONTRIBUTING.md](https://github.com/ChaoticQubit/troupekit/blob/main/CONTRIBUTING.md). Report security issues as described in [SECURITY.md](https://github.com/ChaoticQubit/troupekit/blob/main/SECURITY.md). Everyone taking part follows the [Code of Conduct](https://github.com/ChaoticQubit/troupekit/blob/main/CODE_OF_CONDUCT.md).\n\nLicensed under either of [MIT](https://github.com/ChaoticQubit/troupekit/blob/main/LICENSE-MIT) or [Apache-2.0](https://github.com/ChaoticQubit/troupekit/blob/main/LICENSE-APACHE), at your option. Unless you state otherwise, any contribution you submit for inclusion is dual licensed the same way, without any additional terms or conditions.", "url": "https://wpnews.pro/news/show-hn-troupekit-rust-framework-for-agents-that-resume-after-a-crash", "canonical_source": "https://github.com/ChaoticQubit/troupekit", "published_at": "2026-12-02 09:27:16+00:00", "updated_at": "2026-12-02 09:46:40.121567+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "large-language-models", "ai-tools"], "entities": ["Troupekit", "ChaoticQubit", "Rust", "SQLite", "Anthropic", "OpenAI", "Gemini", "llama.cpp"], "also_reported_by": [], "takeaway": "Calling Troupe::builder().sqlite(path) checkpoints every agent run into one SQLite file, letting a killed process resume the run where it stopped.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/show-hn-troupekit-rust-framework-for-agents-that-resume-after-a-crash", "markdown": "https://wpnews.pro/news/show-hn-troupekit-rust-framework-for-agents-that-resume-after-a-crash.md", "text": "https://wpnews.pro/news/show-hn-troupekit-rust-framework-for-agents-that-resume-after-a-crash.txt", "jsonld": "https://wpnews.pro/news/show-hn-troupekit-rust-framework-for-agents-that-resume-after-a-crash.jsonld"}}