Skip to main content

Crate daimon_core

Crate daimon_core 

Source
Expand description

§daimon-core

Core traits and types for the Daimon AI agent framework. This crate is the plugin interface — implement Model to add a new LLM provider.

Provider crates depend on daimon-core for the shared types and trait. The main daimon crate re-exports everything from here, so end users typically never need to depend on daimon-core directly.

§Implementing a Provider

use daimon_core::{Model, ChatRequest, ChatResponse, Result, ResponseStream};

pub struct MyProvider { /* ... */ }

impl Model for MyProvider {
    async fn generate(&self, request: &ChatRequest) -> Result<ChatResponse> {
        // call your LLM API
        todo!()
    }

    async fn generate_stream(&self, request: &ChatRequest) -> Result<ResponseStream> {
        todo!()
    }
}

Re-exports§

pub use distributed::AgentTask;
pub use distributed::ErasedTaskBroker;
pub use distributed::TaskBroker;
pub use distributed::TaskResult;
pub use distributed::TaskStatus;
pub use vector_store::ErasedVectorStore;
pub use vector_store::SharedVectorStore;
pub use vector_store::VectorStore;

Modules§

distributed
Core types and trait for distributed agent execution.
stream_util
Shared, dependency-light helpers for chunked HTTP streaming and retry backoff, used by every reqwest-based provider.
vector_store
Trait-based plugin system for vector stores.

Structs§

ChatRequest
A request to send to a model.
ChatResponse
A complete response from a model.
Document
A retrieved document fragment with optional metadata and relevance score.
Message
A single message in a conversation.
ScoredDocument
A document paired with a similarity score from a vector query.
ToolCall
A tool invocation requested by a model, containing the tool name and arguments.
ToolOutput
The result of executing a tool.
ToolRetryPolicy
Policy controlling when and how tool execution is retried on failure.
ToolSpec
Describes a tool that can be passed to a model.
Usage
Token usage statistics for a single model request.

Enums§

BackoffStrategy
Strategy for computing delay between retries.
DaimonError
The central error type for all Daimon operations.
Role
The role of a participant in a conversation.
StopReason
Why the model stopped generating.
StreamEvent
An event emitted during a streaming model response.
ToolChoice
Controls which tools the model is allowed to use.

Traits§

EmbeddingModel
Trait for models that produce vector embeddings from text.
ErasedEmbeddingModel
Object-safe wrapper for EmbeddingModel.
ErasedMemory
Object-safe wrapper for the Memory trait, enabling dynamic dispatch via Arc<dyn ErasedMemory>.
ErasedModel
Object-safe wrapper for Model, enabling dynamic dispatch via Arc<dyn ErasedModel>.
ErasedTool
Object-safe wrapper for the Tool trait, enabling dynamic dispatch via Arc<dyn ErasedTool>.
Memory
Trait for conversation memory backends. Stores and retrieves messages for agent context.
Model
Trait for LLM providers. Supports both synchronous and streaming generation.
Tool
Trait for tools the agent can invoke. Tools must have unique names and declare a JSON Schema for parameters.

Type Aliases§

ResponseStream
A boxed, pinned stream of StreamEvent results.
Result
A type alias for Result<T, DaimonError>.
SharedEmbeddingModel
Shared ownership of an embedding model.
SharedMemory
Shared ownership of memory via Arc<dyn ErasedMemory>. Used by the agent.
SharedModel
Shared ownership of a model via Arc<dyn ErasedModel>.
SharedTool
Shared ownership of a tool via Arc<dyn ErasedTool>. Used by registry and agent.