Expand description
Aither Agent Framework
An ergonomic, minimal-core agent framework for building autonomous AI agents. The agent handles the tool-use loop internally with a simple API.
§Quick Start
ⓘ
use aither_agent::Agent;
// Simple one-shot query
let agent = Agent::new(llm);
let response = agent.query("What is 2+2?").await?;
// With tools and hooks
let agent = Agent::builder(llm)
.tool(FileSystemTool::read_only("."))
.hooks(ReadOnly)
.build();
let response = agent.query("List all Rust files").await?;§Features
- Ergonomic API: Simple
query()for one-shot tasks,run()to handle each event as it happens - Internal Loop: Tool execution handled automatically
- Trait-based Hooks: Intercept operations at compile time
- Context Management: One policy, a cache-aware window, async compaction
- Generic over LLM: Works with any
LanguageModelimplementation
The crate carries no product policy: no default system prompt, no terminal tool and no built-in subagent types. The embedder supplies its own instructions, tools and policies.
Re-exports§
pub use context::AnyContextSource;pub use context::AnyFileReferences;pub use context::AnyLiveSource;pub use context::AttachmentCatalogEntry;pub use context::AttachmentRef;pub use context::Block;pub use context::CompactionError;pub use context::CompletedCompaction;pub use context::Context;pub use context::ContextBlock;pub use context::ContextBudget;pub use context::ContextCheckpoint;pub use context::ContextFile;pub use context::ContextItem;pub use context::ContextPolicy;pub use context::ContextSource;pub use context::ExternalContent;pub use context::ExternalSlot;pub use context::FileReferences;pub use context::Handoff;pub use context::HandoffDocument;pub use context::HandoffPrompt;pub use context::HandoffSchema;pub use context::InstructionSlot;pub use context::InvalidHandoff;pub use context::KeptAttachment;pub use context::LineRange;pub use context::LiveChange;pub use context::LiveContent;pub use context::LiveSource;pub use context::LiveUpdate;pub use context::Moment;pub use context::Placement;pub use context::PrefixBlock;pub use context::PrefixChain;pub use context::PrefixRewrites;pub use context::PromptCache;pub use context::PromptPrefix;pub use context::ReassemblyReport;pub use context::Restoration;pub use context::SkillCatalogEntry;pub use context::SourceId;pub use context::Sourced;pub use context::SourcedSlot;pub use context::SystemLayout;
Modules§
- context
- Context management: one window, one policy, one budget.
Structs§
- Agent
- An autonomous agent that runs a conversation with a language model, executing the tool calls it makes.
- Agent
Builder - Builder for constructing agents with custom configuration.
- Agent
Checkpoint - Checkpoint payload exported by the agent runtime.
- Agent
Config - Configuration for agent behavior.
- Agent
Path - Where an agent stands in the tree of agents a run started: empty for the main agent, the subagent’s name beneath its parent’s path otherwise.
- Agent
Tools - Tools registry used by the agent.
- AnyClock
- A type-erased
Clock, what the agent stores. - BlockId
- Identifies one block of a response within its request.
- Budgeted
Model - A model with budget tracking.
- Cache
Entry - A cache entry for an uploaded file.
- Cache
Stats - Aggregate prompt-caching statistics collected across one agent session.
- Cache
Warmth - A shared view of one agent’s prompt-cache entry.
- Cancel
Handle - Cancels a
Runfrom outside, such as from another task while the run is being driven. Cloneable and cheap. - Checkpoints
- The newest checkpoint of a run in progress, readable while the run is being driven.
- Child
Events - Where a child’s events go: the parent’s stream.
- Compact
Result - Result of a compaction operation.
- Context
Window Metrics - Metrics describing the currently assembled context window.
- Context
Window Snapshot - Fully assembled LLM request window plus lifecycle metadata.
- File
Cache - File cache for tracking uploaded files across providers.
- Fork
Snapshot - The parent agent’s request, as a fork subagent starts from it.
- Fork
Source - The latest request of a parent agent, shared with whatever forks it.
- Instant
- A point on a
Clock’s timeline. - Manual
Clock - A clock that only moves when told to.
- Model
Group - A group of models with the same tier, ordered by preference.
- PauseId
- Identifies one pause, unique within an agent.
- Request
Cx - What the loop knows as it assembles a request.
- Request
Id - Identifies one request sent to the model, unique within an agent. A request sent again after its response stream broke has a new id.
- Run
- One run of an
Agent, fromAgent::runorAgent::resume. - RunId
- Identifies one run of an agent: from
Agent::runorAgent::resumeto itsRunEnded. - StopCx
- The model ended its turn with no tool call.
- Subagent
Run - One registered child.
- Subagent
RunInfo - Snapshot of one child in flight.
- Subagent
Runs - The registry of children in flight.
- System
Clock - The operating system’s monotonic clock that keeps counting while the machine sleeps; the default.
- Timed
Event - An
AgentEventwith the UTC time it was emitted and the agent that emitted it. - Tool
Invocation - A tool call the model made, before it runs.
- Tool
Outcome - A tool call after it ran.
- Tool
Panic - A tool’s future panicked while handling a call.
- Turn
Boundary Context - A turn that called tools has ended.
Enums§
- After
Tool - What
Hooks::after_tooldecides for a finished tool call. - Agent
Error - Errors that can occur during agent execution.
- Agent
Event - Events emitted during agent execution.
- Budget
- Budget limit for a model.
- Cache
State - The state of a prompt-cache entry at one moment.
- Checkpoint
Reason - Why a checkpoint was emitted.
- Compaction
Outcome - How a compaction announced by
AgentEvent::CompactionStartedended. - Compaction
Trigger - Why a compaction started.
- Context
Window Phase - Lifecycle phase of the assembled context window.
- Injection
Kind - What an injection into the conversation was.
- Model
Group Error - Error type for model group operations.
- Output
Kind - What a streamed block of the model’s response is.
- Request
Outcome - How a request ended.
- RunOutcome
- How a run ended.
- RunPause
- Why a run stopped short of an answer without failing.
- Stop
Decision - What
Hooks::on_stopdecides when the model ends its turn. - Tool
Decision - What
Hooks::before_tooldecides for a tool call. - Tool
Origin - Where a tool call runs.
- Tool
Verdict - What the agent settled on for a tool call before running it.
- Turn
Boundary Action - What
Hooks::on_turn_boundarydecides at a turn’s end.
Traits§
- Child
Agent - An agent that can run as a child of another.
- Clock
- A source of monotonic time.
- Hooks
- The embedder’s decisions at the loop’s control points.
- Tool
- Tools that can be called by language models.