ai-kit: Stateful Agentic Applications in Rust
Open-source Rust libraries for composing model providers, tools, storage, agents, and stateful workflows.
- rust
- ai
- agents
- workflows
- open-source
Highlights
- Designed five independently usable Rust crates with public backend traits for custom integrations.
- Built stateful workflows with checkpoints, retained history, and recovery over caller-supplied agents and storage.
- Added runnable examples and deterministic composition tests that work without model credentials.
Screenshots
What it is
ai-kit is a collection of open-source Rust libraries for building agentic applications. I built it to bring model access, executable tools, conversation lifecycles, and workflow state into the same Rust application, with explicit interfaces for replacing integrations.
The workspace contains five independently usable crates: providers-kit for model interactions, storage-kit for data and transactional control state, tools-kit for local and Model Context Protocol (MCP) tools, agents-kit for agent runtimes, and app-kit for stateful workflows. Applications can adopt one layer or compose the crates around infrastructure they already have.
The workflow layer accepts caller-built agents and storage. Public backend traits preserve the selected implementations and their associated workspace, conversation, model, and transaction types. The workspace architecture defines those boundaries, including the separate ownership of App checkpoints and Agent control state.
What I contributed
- Designed the crate boundaries and public backend traits so applications can supply their own providers, tools, agents, and storage implementations.
- Built workflow execution around explicit state transitions, reducers, checkpoints, retained history, and recovery. The App guide describes how these pieces compose over caller-supplied agents and state stores.
- Integrated native Codex and OpenCode agent runtimes alongside a Custom agent path that composes model providers, local or MCP tools, and optional managed knowledge.
- Added runnable examples and direct-trait mock tests that exercise real Agent and App consumers without model credentials or external services.
Outcome and next steps
The source, examples, and documentation are publicly available. Developers can start with a local state-only workflow, then introduce agents, custom actions, or human input as the application requires. The launch announcement walks through that progression with code and a complete workflow definition.
The project is in early development. Backend capabilities vary, and applications still need to validate the providers and operations they select. Checkpoints preserve committed workflow state; persistence across process exit requires a persistent state store, and checkpointing does not establish exactly-once execution for external side effects.
Planned follow-up work includes Python bindings through PyO3 and completion of remaining provider and agent integration paths. The focus is on making the existing contracts more complete and easier to adopt, with examples and tests that make their behavior clear.
Tech (high-level)
Rust · Tokio · Serde · LanceDB · Model Context Protocol · Public backend traits · Stateful workflow execution