Skip to main content

agent_runtime/
lib.rs

1//! Runtime engine for executing individual AI agents.
2//!
3//! The crate owns the agent execution loop: it prepares model requests, processes
4//! model turns, dispatches tool calls, enforces authorization policies, and
5//! records lifecycle events. It also defines the contracts that connect model
6//! adapters, tools, and the host application.
7//!
8//! The runtime deliberately does not own provider-specific APIs, durable
9//! conversation storage, scheduling, or service-level orchestration. Those
10//! concerns belong to the model, persistence, and service crates respectively;
11//! this crate focuses on executing one agent run with trusted host context.
12
13mod agent;
14mod agent_registry;
15mod error;
16mod model;
17mod policy;
18mod runtime;
19mod tool;
20mod types;
21
22pub use agent::AgentDefinition;
23pub use agent_models::{ModelError, ModelFailureCategory};
24pub use agent_registry::AgentRegistry;
25pub use error::{ErrorCategory, RuntimeError};
26pub(crate) use model::FixedModelRouter;
27pub use model::{
28    AgentModel, ModelAdapter, ModelRouter, ModelRoutingEvent, ModelRoutingEventSink,
29    RoutedModelTurn,
30};
31pub use policy::{AllowListPolicy, Authorization, AuthorizationError, PolicyEngine};
32pub use runtime::{
33    AgentRuntime, CancellationToken, CollectingEventSink, EventSink, RunEvent, RunEventKind,
34    RunFailure, RunResult, RunStatus,
35};
36pub use tool::{
37    FamilyContext, FamilyMemberContext, Tool, ToolContext, ToolDispatcher, ToolError, ToolRegistry,
38};
39pub use types::{Agent, Message, ModelRequest, ModelTurn, ToolCall, ToolDefinition};