agent-sdk-rs
agent-sdk-rs is a lightweight Rust agent framework inspired by browser-use's SDK design.
It is intentionally minimal:
- small surface area
- explicit control flow
- simple tool integration
- easy embedding into Rust binaries
This project is expected to stay lightweight by default. New features should preserve that core philosophy.
What It Is
A Rust SDK for tool-using agents with:
- an
Agentloop query+query_stream- provider adapter boundary
- tool execution + dependency injection
- explicit completion semantics via
done
Coverage (v0.1.0 alpha)
Implemented:
- Anthropic provider adapter (
anthropic-ai-sdk) Agent+ builder APIqueryandquery_stream- event stream model (
MessageStart,StepStart,ToolCall,ToolResult,FinalResponse, etc.) - tool registration with JSON schema
- dependency map + dependency overrides
- translated Claude-code-style tool set:
bash,read,write,editglob_search,greptodo_read,todo_writedone
- optional
claude_codebinary target
Out of scope right now:
- non-Anthropic providers
- Laminar integration
Roadmap
Near-term:
- Add xAI Grok provider adapter (next)
- Keep adapter trait stable across providers
- Improve docs/examples while keeping core small
Non-goal:
- turning this into a heavy orchestration framework
Install
[]
= "0.1.0"
Quick Usage
1. Basic agent query
use ;
let model = from_env?;
let mut agent = builder.model.build?;
let answer = agent.query.await?;
println!;
# Ok::
2. Streaming events
use ;
use StreamExt;
let model = from_env?;
let mut agent = builder.model.build?;
let stream = agent.query_stream;
pin_mut!;
while let Some = stream.next.await
# Ok::
3. Claude-code tool pack
use ;
use ;
let model = from_env?;
let sandbox = ?;
let mut agent = builder
.model
.tools
.dependency
.require_done_tool
.build?;
# Ok::
Optional Binary
Run the fun Claude-code-like binary:
Environment:
ANTHROPIC_API_KEYrequiredANTHROPIC_MODELoptional (default set in binary)CLAUDE_CODE_SANDBOXoptional
Examples
License
MIT. See LICENSE.