agent-sdk
A Rust SDK for building AI agents powered by large language models. Agents reason, call tools, and take actions through a streaming, event-driven loop.
[]
= "0.8"
= { = "1", = ["rt-multi-thread", "macros"] }
= "1"
Quickstart — ask()
The 30-second path: build an agent, ask a question, get the answer. ask()
builds the tool context and cancellation token for you and returns the
assembled assistant text.
use *;
use ThreadId;
async
use agent_sdk::prelude::*; brings the dozen names a newcomer needs: the
builder, config + I/O types, the Tool surface, the in-memory event
store, the cancellation token, and the default AnthropicProvider. When you
need application context, a confirmation flow, explicit cancellation, or the
raw run state, drop down to run().
Features
The default build is lightweight: a plain cargo add agent-sdk enables only
the anthropic provider and the core runtime — no sqlx, tonic, lapin,
prost, or opentelemetry. Everything else is opt-in:
| Feature | Enables |
|---|---|
anthropic (default) |
Anthropic (Claude) provider |
openai |
OpenAI Chat Completions provider |
openai-codex |
OpenAI Codex / Responses provider |
gemini |
Google Gemini provider |
vertex |
Google Vertex AI provider |
cloudflare |
Cloudflare Workers AI provider |
web |
Web search + URL fetch tools (pulls in html2text) |
mcp |
Model Context Protocol client (stdio + streamable-HTTP/SSE) |
skills |
Skill / command loading from markdown |
otel |
OpenTelemetry spans |
= { = "0.8", = ["openai", "gemini", "web", "mcp"] }
Cookbook
Runnable recipes for the common building blocks live in
COOKBOOK.md
and as compiling examples under
examples/:
typed tools (TypedTool), schema-validated structured output, streaming, MCP
(including the HTTP transport), durable serving, and human-in-the-loop (HITL)
confirmation.
Documentation
- API reference: https://docs.rs/agent-sdk
- Repository, full README, and cookbook: https://github.com/bipa-app/agent-sdk
License
MIT. See LICENSE.