Expand description
§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.
§Quick Start
ⓘ
use daimon::prelude::*;
#[tokio::main]
async fn main() -> daimon::Result<()> {
let agent = Agent::builder()
.model(daimon::model::openai::OpenAi::new("gpt-4o"))
.system_prompt("You are a helpful assistant.")
.build()?;
let response = agent.prompt("What is Rust?").await?;
println!("{}", response.text());
Ok(())
}§Feature Flags
| Feature | Description |
|---|---|
openai | OpenAI API provider (default) |
anthropic | Anthropic Claude API provider (default) |
macros | #[tool_fn] proc macro (default) |
gemini | Google Gemini / Vertex AI provider (via daimon-provider-gemini) |
azure | Azure OpenAI Service provider (via daimon-provider-azure) |
bedrock | AWS Bedrock provider (via daimon-provider-bedrock) |
ollama | Ollama local model provider |
sqlite | SQLite memory backend |
redis | Redis memory backend + task broker |
nats | NATS JetStream task broker |
amqp | RabbitMQ (AMQP) task broker |
sqs | AWS SQS task broker (via daimon-provider-bedrock) |
pubsub | Google Cloud Pub/Sub task broker (via daimon-provider-gemini) |
servicebus | Azure Service Bus task broker (via daimon-provider-azure) |
mcp | Model Context Protocol client & server |
otel | OpenTelemetry OTLP span export |
qdrant | Qdrant vector store retriever |
pgvector | pgvector-backed vector store (via daimon-plugin-pgvector) |
opensearch | OpenSearch k-NN vector store (via daimon-plugin-opensearch) |
grpc | gRPC transport for distributed execution |
full | All providers + macros + MCP + SQLite + Redis + NATS + AMQP + gRPC + OTel + SQS + Pub/Sub + Service Bus + pgvector |
The core framework compiles with no features; enable providers as needed.
§Plugin Interface
The [Model] trait (from daimon_core) is the plugin interface. To create
a new LLM provider, depend on daimon-core and implement Model. See the
daimon-provider-* crates for examples.
§Module Overview
agent— Agent builder, ReAct loop, multi-agent patterns, resumable runsmodel— LLM provider trait and implementationstool— Tool trait, registry, and executionmemory— Conversation memory implementationsstream— Streaming response typeshooks— Lifecycle hooks for observability and controlorchestration— Chain, graph, DAG, and workflow orchestrationretriever— RAG retriever trait and tool adaptercheckpoint— Checkpointing and state persistencea2a— Google Agent-to-Agent protocol supportdistributed— Distributed agent execution across processes- [
mcp] — Model Context Protocol client and server (stdio, HTTP, WebSocket) - [
telemetry] — OpenTelemetry OTLP export (feature = “otel”)
Modules§
- a2a
- Google Agent-to-Agent (A2A) protocol support.
- agent
- Agent construction and ReAct loop execution.
- checkpoint
- Checkpointing and state persistence for resumable agent runs.
- cost
- Token cost tracking and budget enforcement.
- distributed
- Distributed agent execution across multiple processes.
- error
- Error types for the Daimon agent framework.
- guardrails
- Input and output guardrails for validating and transforming agent I/O.
- hooks
- Lifecycle hooks for observing and controlling agent execution.
- memory
- Conversation memory for persisting message history across agent turns.
- middleware
- Composable middleware pipeline for mutating requests, responses, and tool calls.
- model
- LLM provider abstraction and implementations.
- orchestration
- Multi-agent orchestration: chains, graphs, DAGs, and workflows.
- prelude
- Convenience re-exports for common Daimon types.
- prompt
- Composable prompt construction with variable interpolation.
- retriever
- Retrieval-Augmented Generation (RAG) abstractions.
- stream
- Streaming response types for token-by-token or event-by-event model output.
- tool
- Tool abstraction and registry.
Enums§
- Daimon
Error - The central error type for all Daimon operations.
Type Aliases§
- Result
- A type alias for
Result<T, DaimonError>.
Attribute Macros§
- tool_fn
- Derives a [
Tool] implementation from an async function.