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§

ArchivalRecord
A fact stored in archival memory, returned from a search.
ChatRequest
A request to send to a model.
ChatResponse
A complete response from a model.
CoreMemoryBlock
A single named, optionally size-limited block of core memory.
Document
A retrieved document fragment with optional metadata and relevance score.
EpisodicEvent
A single recorded event.
EpisodicQuery
Filter for EpisodicMemory::query. All fields are optional; an all-None query returns every event (subject to limit).
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§

ArchivalMemory
Trait for long-term archival fact storage, decoupled from the turn-by-turn conversation log.
CoreMemory
Trait for always-in-context core memory backends.
EmbeddingModel
Trait for models that produce vector embeddings from text.
EpisodicMemory
Trait for structured, timestamped event log backends.
ErasedArchivalMemory
Object-safe wrapper for the ArchivalMemory trait, enabling dynamic dispatch via Arc<dyn ErasedArchivalMemory>.
ErasedCoreMemory
Object-safe wrapper for the CoreMemory trait, enabling dynamic dispatch via Arc<dyn ErasedCoreMemory>.
ErasedEmbeddingModel
Object-safe wrapper for EmbeddingModel.
ErasedEpisodicMemory
Object-safe wrapper for the EpisodicMemory trait, enabling dynamic dispatch via Arc<dyn ErasedEpisodicMemory>.
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.

Functions§

render_blocks
Shared rendering logic used by CoreMemory::render’s default implementation and available to custom implementations that want the same format.

Type Aliases§

ResponseStream
A boxed, pinned stream of StreamEvent results.
Result
A type alias for Result<T, DaimonError>.
SharedArchivalMemory
Shared ownership of archival memory via Arc<dyn ErasedArchivalMemory>.
SharedCoreMemory
Shared ownership of core memory via Arc<dyn ErasedCoreMemory>.
SharedEmbeddingModel
Shared ownership of an embedding model.
SharedEpisodicMemory
Shared ownership of episodic memory via Arc<dyn ErasedEpisodicMemory>.
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.