Skip to main content

Crate ed_agent

Crate ed_agent 

Source
Expand description

Ed: an embeddable, local-LLM-first chat agent.

Ed sits one layer above the onde inference SDK. onde gives you a ChatEngine you can load a model into and send messages to; Ed adds the part every application built on it was writing for itself:

  • Lifecycle orchestration. Loading a model is a sequence of state changes, not one call. Ed drives Loading -> Ready (or -> Error) and reports each transition.
  • Notification. onde exposes status by polling info(). A UI needs to be told. Ed pushes transitions and replies to a StatusSink the host implements.
  • A flattened reply. Inference returns Result<InferenceResult, _>; a frontend wants one shape covering both outcomes. That’s ChatReply.

Ed deliberately does not own sessions, persistence, model catalogues, or downloads. Those differ per application and belong to the host. For persistence it defines the SessionStore seam the host implements.

§Platforms

Ed has no cfg(target_os) gates. onde already splits real and fallback implementations internally, so this crate compiles on every platform onde supports (macOS, iOS, tvOS, visionOS, watchOS, Windows, Linux, Android) and simply surfaces onde’s error where it can’t run inference. Outside that list onde falls back to a stub whose signatures differ, so Ed does not build there either.

Do not add platform gates here, and be careful about adding them in a host: a gate narrower than onde’s own support list silently disables chat on a platform that would have worked.

§Example

use ed_agent::{Ed, GgufModelConfig};

let ed = Ed::new();
let config = GgufModelConfig::qwen25_1_5b();
ed.load(config, None, None).await.expect("load");

let reply = ed.send("Summarise this thread.").await;
println!("{}", reply.reply.unwrap_or_default());

Structs§

AgentConfig
AgentReply
AgentToolDefinition
A tool the model may ask the host application to run.
ApprovalRequest
ChatEngine
A reusable on-device LLM chat inference engine.
ChatMessage
A single message in a conversation.
ChatReply
The outcome of a single Ed::send, in one shape whether it succeeded or failed.
DenyApprovals
Ed
An embeddable chat agent over a single ChatEngine.
EngineInfo
A point-in-time snapshot of the engine’s state, suitable for status UIs.
GgufModelConfig
Configuration for loading a GGUF model via mistral.rs.
NoopSink
A StatusSink that drops everything.
RejectingExecutor
SamplingConfig
Sampling parameters for text generation.
SessionError
A storage failure. The store decides the wording; Ed only carries it.
SessionMeta
What a session list needs to render a row, without loading the messages.
TextStream
The reply to one message, as a stream of text deltas.
ToolCall
ToolExecutionResult
UqffModelConfig
Configuration for loading a UQFF model via mistral.rs UqffTextModelBuilder.

Enums§

AgentError
ApprovalDecision
ChatRole
Role of a message in a chat conversation.
EngineStatus
Lifecycle status of the inference engine.
InferenceError
Errors that can occur during inference engine operations.
ToolCallingSupport
Whether the loaded model can reliably produce structured tool calls.
ToolRisk

Traits§

ApprovalHandler
EventSink
Receives lifecycle transitions and completed replies.
SessionStore
Persistent conversations, keyed by an id the host chooses.
StatusSink
Compatibility name retained for the original Ed API. Compatibility name retained for the original Ed API. Compatibility name retained for the original Ed API. Receives lifecycle transitions and completed replies.
ToolExecutor