Installation
Requirements
- Rust 1.92 or later (workspace edition 2024)
Adding agentkit to your project
cargo add agentkit
Or add it to your Cargo.toml:
[dependencies]
agentkit = "0.9.0"
Minimal dependency set
By default, agentkit enables: core, capabilities, tools, loop, and reporting. The loop feature transitively pulls in task-manager.
To keep your build lean, disable defaults and pick only what you need:
[dependencies]
agentkit = { version = "0.9.0", default-features = false, features = ["core", "loop"] }
Provider adapters and MCP integration are opt-in features:
[dependencies]
agentkit = { version = "0.9.0", features = ["provider-anthropic", "mcp", "tool-fs", "tool-shell"] }
See the Feature flags reference for the full list.
Building from source
git clone https://github.com/danielkov/agentkit.git
cd agentkit
cargo build
Running the examples
Most examples use OpenRouter as the model provider. Create a .env file in the repo root:
OPENROUTER_API_KEY=your_key_here
OPENROUTER_MODEL=anthropic/claude-sonnet-4.5
Then run any example:
cargo run -p openrouter-chat -- "hello"
For the Anthropic provider, the anthropic-chat example demonstrates streaming, server tools, and extended thinking:
ANTHROPIC_API_KEY=your_key_here
ANTHROPIC_MODEL=claude-opus-4-7
ANTHROPIC_MAX_TOKENS=4096
cargo run -p anthropic-chat -- --web-search 3 --thinking 2048
For the Cerebras provider, the cerebras-chat REPL covers the chat path and the cerebras-batch CLI covers the Files + Batch API:
CEREBRAS_API_KEY=your_key_here
CEREBRAS_MODEL=gpt-oss-120b
cargo run -p cerebras-chat -- --reasoning-effort medium --compression msgpack+gzip
cargo run -p cerebras-batch -- run ./prompts.json
The full set of bundled examples:
openrouter-chat— minimal REPL against OpenRouteropenrouter-agent-cli— agent loop with toolsopenrouter-coding-agent— coding agent with filesystem + shellopenrouter-compaction-agent— compaction strategiesopenrouter-context-agent—AGENTS.mdand skills loadingopenrouter-context-window-compaction— semantic compaction triggersopenrouter-macro-tool—#[tool]macroopenrouter-mcp-tool— federated MCP toolsopenrouter-parallel-agent— parallel/background tool executionopenrouter-session-persistence— resumable sessionsopenrouter-subagent-tool— subagent-as-tool compositionanthropic-chat— streaming, server tools, extended thinkingcerebras-chat,cerebras-batch— Cerebras chat + batchmcp-dynamic-auth,mcp-reference-interop— MCP transport + auth
The examples are referenced throughout this book. Each chapter points to the relevant example that exercises the concepts being discussed.