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.
ondeexposes status by pollinginfo(). A UI needs to be told. Ed pushes transitions and replies to aStatusSinkthe host implements. - A flattened reply. Inference returns
Result<InferenceResult, _>; a frontend wants one shape covering both outcomes. That’sChatReply.
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§
- Agent
Config - Agent
Reply - Agent
Tool Definition - A tool the model may ask the host application to run.
- Approval
Request - Chat
Engine - A reusable on-device LLM chat inference engine.
- Chat
Message - A single message in a conversation.
- Chat
Reply - The outcome of a single
Ed::send, in one shape whether it succeeded or failed. - Deny
Approvals - Ed
- An embeddable chat agent over a single
ChatEngine. - Engine
Info - A point-in-time snapshot of the engine’s state, suitable for status UIs.
- Gguf
Model Config - Configuration for loading a GGUF model via mistral.rs.
- Noop
Sink - A
StatusSinkthat drops everything. - Rejecting
Executor - Sampling
Config - Sampling parameters for text generation.
- Session
Error - A storage failure. The store decides the wording; Ed only carries it.
- Session
Meta - What a session list needs to render a row, without loading the messages.
- Text
Stream - The reply to one message, as a stream of text deltas.
- Tool
Call - Tool
Execution Result - Uqff
Model Config - Configuration for loading a UQFF model via mistral.rs
UqffTextModelBuilder.
Enums§
- Agent
Error - Approval
Decision - Chat
Role - Role of a message in a chat conversation.
- Engine
Status - Lifecycle status of the inference engine.
- Inference
Error - Errors that can occur during inference engine operations.
- Tool
Calling Support - Whether the loaded model can reliably produce structured tool calls.
- Tool
Risk
Traits§
- Approval
Handler - Event
Sink - Receives lifecycle transitions and completed replies.
- Session
Store - Persistent conversations, keyed by an id the host chooses.
- Status
Sink - 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.
- Tool
Executor