agentkit
Feature-gated umbrella crate for assembling agent applications from the agentkit workspace. Enable only the features you need and access them through a single dependency.
Default features
core, capabilities, tools, loop, reporting. The loop feature transitively enables task-manager.
| Feature | Module | Re-exports |
|---|---|---|
core |
core |
Item, Part, SessionId, TurnId, Usage, CancellationController, TurnCancellation |
capabilities |
capabilities |
Invocable, CapabilityProvider, ResourceProvider, PromptProvider |
tools |
tools |
Tool, ToolRegistry, ToolSpec, BasicToolExecutor, PermissionChecker, PermissionPolicy |
loop |
loop_ |
Agent, AgentBuilder, LoopDriver, LoopStep, LoopInterrupt, ModelAdapter, SessionConfig, PromptCacheRequest |
reporting |
reporting |
StdoutReporter, JsonlReporter, UsageReporter, TranscriptReporter, CompositeReporter |
The agent loop module is re-exported as
loop_becauseloopis a Rust keyword.
Optional features
| Feature | Module | Purpose |
|---|---|---|
compaction |
compaction |
Transcript compaction triggers, strategies, and pipelines |
context |
context |
AGENTS.md discovery and context loading |
mcp |
mcp |
Model Context Protocol server connections (stdio + Streamable HTTP) |
task-manager |
task_manager |
Foreground / background tool task scheduling |
adapter-completions |
adapter_completions |
Generic chat completions adapter base for building provider crates |
provider-anthropic |
provider_anthropic |
Anthropic Messages API adapter (streaming, prompt caching, extended thinking, server tools) |
provider-cerebras |
provider_cerebras |
Cerebras Inference API adapter (streaming, reasoning, compression, Files + Batch) |
provider-openai |
provider_openai |
OpenAI /v1/chat/completions adapter |
provider-openrouter |
provider_openrouter |
OpenRouter /v1/chat/completions adapter |
provider-groq |
provider_groq |
Groq adapter |
provider-mistral |
provider_mistral |
Mistral adapter |
provider-ollama |
provider_ollama |
Ollama adapter |
provider-vllm |
provider_vllm |
vLLM adapter |
tool-fs |
tool_fs |
Filesystem tools (read, write, edit, move, delete, list, mkdir) |
tool-shell |
tool_shell |
Shell execution tool (shell_exec) |
tool-skills |
tool_skills |
Progressive Agent Skills discovery and activation |
Quick start
Add agentkit with the features you need:
[]
= { = "0.7", = ["provider-openrouter", "tool-fs", "tool-shell"] }
= { = "1", = ["full"] }
Examples
Minimal agent with OpenRouter
use ;
use ;
use ;
use StdoutReporter;
async
Agent with filesystem and shell tools
use ;
use ;
use ;
async
Composing reporters
use ;
let reporter = new
.with_observer
.with_observer
.with_observer;
Bring-your-own ModelAdapter
When implementing a custom adapter, only the default features are needed:
[]
= "0.7"
use ;
// Implement ModelAdapter for your backend, then:
// let agent = Agent::builder().model(my_adapter).build()?;
See the book and the in-tree examples/ directory for end-to-end programs covering streaming, MCP, compaction, parallel tools, session persistence, and subagents.