Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Daimon
A Rust-native AI agent framework for building LLM-powered agents with tool use, memory, and streaming.
Daimon implements the ReAct (Reason-Act-Observe) pattern: the agent calls a model, optionally invokes tools, observes results, and repeats until it produces a final response. It is designed to be easy to use while leveraging Rust's type system, async runtime, and performance characteristics.
Features
- ReAct agent loop with configurable iteration limits
- Multiple LLM providers behind feature flags — OpenAI, Anthropic, AWS Bedrock
- Tool system with async execution, parallel tool calls, and a typed registry
- Streaming with full ReAct loop support (tool calls accumulate and re-invoke within a single stream)
- Conversation memory with pluggable backends (sliding window included)
- Lifecycle hooks for observability and control
- Cancellation via
tokio_util::CancellationToken - Tracing instrumentation on all agent and provider operations
- Retry logic with exponential backoff for transient provider errors
Quick Start
Add Daimon to your Cargo.toml:
[]
= "0.17"
= { = "1", = ["full"] }
Create an agent and prompt it:
use *;
async
Tools
Define tools by implementing the Tool trait:
use *;
;
async
Streaming
Stream responses token-by-token with the full ReAct loop. Streaming is not a
degraded path: it runs the same loop as prompt() — conversation memory is
loaded and persisted, lifecycle hooks fire, guardrails are enforced, and tool
calls accumulate and re-invoke the model within a single stream until a final
response is produced.
use *;
async
Feature Flags
| Feature | Default | Description |
|---|---|---|
openai |
Yes | OpenAI Chat Completions API |
anthropic |
Yes | Anthropic Messages API |
macros |
Yes | #[tool_fn] proc macro for defining tools |
bedrock |
No | AWS Bedrock Converse API |
gemini |
No | Google Gemini / Vertex AI provider |
azure |
No | Azure OpenAI Service provider |
ollama |
No | Ollama local model provider |
mcp |
No | Model Context Protocol client & server |
sqlite |
No | SQLite memory backend |
redis |
No | Redis memory backend + task broker + checkpoint |
nats |
No | NATS JetStream task broker + checkpoint |
amqp |
No | RabbitMQ (AMQP) task broker |
qdrant |
No | Qdrant vector store retriever |
pgvector |
No | pgvector-backed vector store (via daimon-plugin-pgvector) |
opensearch |
No | OpenSearch k-NN vector store (via daimon-plugin-opensearch) |
otel |
No | OpenTelemetry OTLP span export |
http-server |
No | HTTP agent server (AgentServer) |
grpc |
No | gRPC transport for distributed execution |
full |
No | All providers + macros + MCP + SQLite + Redis + NATS + AMQP + OTel + HTTP server + Qdrant + pgvector + OpenSearch + gRPC + eval + SQS + Pub/Sub + Service Bus |
The core framework compiles with no features enabled. Enable only the providers you need:
# Only Anthropic
= { = "0.17", = false, = ["anthropic"] }
# All providers
= { = "0.17", = ["full"] }
# Core only (bring your own Model impl)
= { = "0.17", = false }
Provider Configuration
All providers support configurable timeout, retries, and provider-specific options:
use Duration;
// OpenAI with custom settings
let model = new
.with_timeout
.with_max_retries
.with_response_format
.with_parallel_tool_calls;
// Anthropic with prompt caching
let model = new
.with_timeout
.with_prompt_caching;
// AWS Bedrock with guardrails
let model = new
.with_guardrail;
Agent Configuration
use *;
let agent = builder
.model // required
.system_prompt // optional system prompt
.tool // register tools
.tool
.memory // custom memory (default: 50 messages)
.hooks // lifecycle hooks
.max_iterations // default: 25
.temperature // sampling temperature
.max_tokens // max output tokens
.build?;
// Standard prompt
let response = agent.prompt.await?;
println!;
println!;
// With cancellation
let cancel = new;
let response = agent.prompt_with_cancellation.await?;
// With pre-built messages
let messages = vec!;
let response = agent.prompt_with_messages.await?;
Architecture
┌──────────────────────────────────────────────────┐
│ Agent │
│ ┌────────────┐ ┌──────────┐ ┌──────────────┐ │
│ │ Model │ │ Tools │ │ Memory │ │
│ │ (trait) │ │ Registry │ │ (trait) │ │
│ └─────┬──────┘ └────┬─────┘ └──────┬───────┘ │
│ │ │ │ │
│ ┌─────┴──────────────┴───────────────┴───────┐ │
│ │ ReAct Loop │ │
│ │ 1. Load memory → build request │ │
│ │ 2. Call model │ │
│ │ 3. Tool calls? → execute (parallel) → 2 │ │
│ │ 4. Final response → save to memory │ │
│ └────────────────────────────────────────────┘ │
│ │ │
│ ┌─────┴──────┐ ┌──────────┐ │
│ │ Hooks │ │ Streaming │ │
│ │ (lifecycle)│ │ Events │ │
│ └────────────┘ └──────────┘ │
└──────────────────────────────────────────────────┘
Environment Variables
Each provider reads its API key from standard environment variables:
| Provider | Variable | Notes |
|---|---|---|
| OpenAI | OPENAI_API_KEY |
Required for openai feature |
| Anthropic | ANTHROPIC_API_KEY |
Required for anthropic feature |
| AWS Bedrock | Standard AWS credentials | AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY or IAM role |
| Google Gemini | GOOGLE_APPLICATION_CREDENTIALS |
Service account JSON path |
| Azure OpenAI | AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINT |
Required for azure feature |
| Ollama | OLLAMA_HOST |
Defaults to http://localhost:11434 |
Testing
# Default features (openai + anthropic)
# All features
# Core only (no providers)
# Coverage (requires cargo-llvm-cov)
See CONTRIBUTING.md for full testing and development setup.
Minimum Supported Rust Version
Rust 1.85 (edition 2024).
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Related Repos
- cardozo-ai -- Legal AI framework (Rust + Candle, shares Rust tooling patterns)
- lexmata-initial-case-evaluation -- Go AI service that could use Daimon's agent patterns
- lexmata-app-backend -- Backend that dispatches AI work to Bedrock
Contributing
See CONTRIBUTING.md for development setup, coding standards, and contribution guidelines. Note that AI-assisted contributions must include proper attribution.