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, via daimon-provider-openai) |
anthropic | Anthropic Claude API provider (default, via daimon-provider-anthropic) |
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 (via daimon-provider-local) |
llamacpp | llama.cpp (llama-server) provider (via daimon-provider-local) |
llamars | llama-rs provider (via daimon-provider-local) |
local | All local providers at once: Ollama, llama.cpp, llama-rs, generic OpenAI-compatible |
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) |
a2a | Agent-to-Agent (A2A) protocol client (A2aClient) |
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 |
http-server | HTTP agent server (AgentServer) |
eval | Agent evaluation/scoring harness |
full | 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; 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, plus optional core/archival/episodic tiered memory subsystemsstream— 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 support (feature = “a2a”)distributed— Distributed agent execution across processesmcp— Model Context Protocol client and server (stdio, HTTP)telemetry— OpenTelemetry OTLP export (feature = “otel”)server— HTTP agent server (feature = “http-server”)eval— evaluation harness for agent behavior (feature = “eval”)
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.
- eval
- Agent evaluation and testing harness.
- guardrails
- Input and output guardrails for validating and transforming agent I/O.
- hooks
- Lifecycle hooks for observing and controlling agent execution.
- mcp
- Model Context Protocol (MCP) client and server.
- memory
- Conversation memory for persisting message history across agent turns, plus optional tiered memory subsystems that generalize the MemGPT/Letta-style memory model (core, archival, episodic).
- 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.
- server
- HTTP server wrapper for exposing an agent as a REST API.
- stream
- Streaming response types for token-by-token or event-by-event model output.
- telemetry
- OpenTelemetry integration for exporting
tracingspans to OTLP collectors. - 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
Toolimplementation from an async function.