Skip to main content

Crate agent_runtime

Crate agent_runtime 

Source
Expand description

Runtime engine for executing individual AI agents.

The crate owns the agent execution loop: it prepares model requests, processes model turns, dispatches tool calls, enforces authorization policies, and records lifecycle events. It also defines the contracts that connect model adapters, tools, and the host application.

The runtime deliberately does not own provider-specific APIs, durable conversation storage, scheduling, or service-level orchestration. Those concerns belong to the model, persistence, and service crates respectively; this crate focuses on executing one agent run with trusted host context.

Structs§

Agent
Configuration for an agent.
AgentDefinition
AgentRegistry
AgentRuntime
AllowListPolicy
Allows execution of explicitly configured tools.
AuthorizationError
Error explaining why a tool invocation was denied.
CancellationToken
Shared cancellation signal for an agent run.
CollectingEventSink
An event sink that stores events in memory.
FamilyContext
Trusted family information resolved by the platform for an authenticated user.
FamilyMemberContext
One member of a family roster verified for the authenticated user.
ModelAdapter
Adapts an agent-models conversation client to the runtime interface.
ModelRequest
Input sent to the model.
ModelTurn
Response received from the model.
RoutedModelTurn
A model response together with the provider-qualified identity that produced it.
RunEvent
RunFailure
RunResult
ToolCall
A tool invocation requested by the model.
ToolContext
Trusted execution metadata supplied by the platform, never by the model.
ToolDefinition
Description of a tool exposed to the model.
ToolRegistry
In-memory registry of executable tools.

Enums§

Authorization
Result of an authorization decision.
ErrorCategory
Stable error classes for runtime decisions and observability.
Message
A message in the conversation.
ModelError
ModelFailureCategory
ModelRoutingEvent
Events emitted while a router evaluates compatible model candidates.
RunEventKind
RunStatus
RuntimeError
ToolError

Traits§

AgentModel
Interface used by the agent runtime to interact with a model.
EventSink
Receives runtime events as they occur.
ModelRouter
Selects and invokes a model for one agent turn.
ModelRoutingEventSink
Receives routing lifecycle events without exposing provider error payloads.
PolicyEngine
Determines whether an agent is allowed to execute a tool call.
Tool
An executable tool.
ToolDispatcher
Executes tools requested by the model.