Skip to main content

Crate daimon

Crate daimon 

Source
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

FeatureDescription
openaiOpenAI API provider (default)
anthropicAnthropic Claude API provider (default)
macros#[tool_fn] proc macro (default)
geminiGoogle Gemini / Vertex AI provider (via daimon-provider-gemini)
azureAzure OpenAI Service provider (via daimon-provider-azure)
bedrockAWS Bedrock provider (via daimon-provider-bedrock)
ollamaOllama local model provider
sqliteSQLite memory backend
redisRedis memory backend + task broker
natsNATS JetStream task broker
amqpRabbitMQ (AMQP) task broker
sqsAWS SQS task broker (via daimon-provider-bedrock)
pubsubGoogle Cloud Pub/Sub task broker (via daimon-provider-gemini)
servicebusAzure Service Bus task broker (via daimon-provider-azure)
mcpModel Context Protocol client & server
otelOpenTelemetry OTLP span export
qdrantQdrant vector store retriever
pgvectorpgvector-backed vector store (via daimon-plugin-pgvector)
opensearchOpenSearch k-NN vector store (via daimon-plugin-opensearch)
grpcgRPC transport for distributed execution
fullAll 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 runs
  • model — LLM provider trait and implementations
  • tool — Tool trait, registry, and execution
  • memory — Conversation memory implementations
  • stream — Streaming response types
  • hooks — Lifecycle hooks for observability and control
  • orchestration — Chain, graph, DAG, and workflow orchestration
  • retriever — RAG retriever trait and tool adapter
  • checkpoint — Checkpointing and state persistence
  • a2a — Google Agent-to-Agent protocol support
  • distributed — 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§

DaimonError
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.