Skip to main content

Crate agent_base

Crate agent_base 

Source

Re-exports§

pub use engine::AgentBuilder;
pub use engine::AgentRuntime;
pub use engine::AgentSession;
pub use engine::DefaultPipeline;
pub use engine::InMemorySessionStore;
pub use engine::QueueMode;
pub use engine::SessionStore;
pub use engine::ToolExecutionPipeline;
pub use engine::AllowAllApprovalHandler;
pub use engine::ApprovalHandler;
pub use engine::CompactionKind;
pub use engine::CompactionOutcome;
pub use engine::ConsecutiveFailureRecovery;
pub use engine::ContextCompaction;
pub use engine::ContextWindowManager;
pub use engine::DenyAllApprovalHandler;
pub use engine::InvalidArgsAction;
pub use engine::InvalidArgsCtx;
pub use engine::InvalidArgsHandler;
pub use engine::Middleware;
pub use engine::NoopGuard;
pub use engine::NoticeHandle;
pub use engine::PostLlmCtx;
pub use engine::PreLlmCtx;
pub use engine::ProviderHandle;
pub use engine::ReactLoopGuard;
pub use engine::ReissueMissingFields;
pub use engine::RetryOnError;
pub use engine::StopOnError;
pub use engine::ToolEnforcementConfig;
pub use engine::ToolEnforcementMiddleware;
pub use engine::ToolErrorAction;
pub use engine::ToolErrorRecovery;
pub use engine::TurnFactMiddleware;
pub use engine::TurnToolLimitMiddleware;
pub use engine::UserMessageCtx;
pub use engine::estimate_messages_tokens;
pub use engine::first_system_prompt;
pub use tool::ActivateTool;
pub use tool::AutoContinueTool;
pub use tool::DeferredTool;
pub use tool::DenyAllToolPolicy;
pub use tool::ExecClock;
pub use tool::ExecPauseGuard;
pub use tool::Tool;
pub use tool::ToolActivation;
pub use tool::ToolContext;
pub use tool::ToolDecision;
pub use tool::ToolPolicy;
pub use tool::ToolRegistry;
pub use tool::TypedTool;
pub use tool::UpdatePlanTool;
pub use types::RuntimeEvent;
pub use types::UserEvent;
pub use engine::ActionBackend;
pub use engine::ActionExecutor;
pub use engine::DEFAULT_INTERACT_TIMEOUT;
pub use engine::ExecCtx;
pub use engine::ExecError;
pub use engine::INTERRUPTED_SUMMARY;
pub use engine::InteractionChannel;
pub use engine::InteractionError;
pub use engine::LlmTurnResult;
pub use engine::ParseError;
pub use engine::ParseOutcome;
pub use engine::SessionError;
pub use engine::SessionHandle;
pub use types::AgentError;
pub use types::AgentResult;
pub use types::ErrorKind;
pub use types::AgentConfig;
pub use types::Language;
pub use types::Message;
pub use types::RetryConfig;
pub use types::SafetyConfig;
pub use types::SessionConfig;
pub use types::SessionIdGenerator;
pub use types::TurnContext;
pub use types::shared_session_ids;
pub use llm_trait;

Modules§

engine
image_ops
Image mechanics shared by tools and the wire layer: magic sniffing, header-only dimension reads, the downscale-to-fit pass, and the per-image / per-message byte budget that keeps request bodies under the gateway’s limit (the HTTP 413 cure — see apply_image_budget).
llm
LLM provider integration.
prelude
tool
types

Structs§

Action
One unit of “something the model asked the runtime to do”.
ActionOutcome
Per-action result — the model-visible fate of one Action (D9: a policy refusal lands here, never as a silent drop). Batch-level failure is ExecError; “something went wrong along the way” is an outcome, not an error.
ActivationContext
Context passed to Tool::should_activate for Deferred tools.
ApprovalRequest
AskOption
One candidate the user can pick. id is the caller’s stable key (echoed back on pick); label is what the picker shows and what comes back with the answer.
CheckpointData
GuardCtx
Guard context information — built by runtime, passed to guard.
Observation
What the runtime observed after executing a batch of actions (D15: always returned once anything ran — ExecError is reserved for “nothing ran”).
PlanItem
A single step in a lightweight plan checklist.
ReasoningConfig
Reasoning/thinking configuration, unifying reasoning/thinking parameters across vendors.
RunState
Run-level state tracking for the react loop.
SessionId
Unique identifier for an agent session.
StreamIntegrity
Structural integrity facts about one assembled tool-call batch.
ToolCallMessage
A tool call embedded in an assistant message.
ToolMetadata
Machine-readable metadata for a registered tool — origin, version, and runtime requirements in a stable shape consumers can inspect without parsing the LLM-facing definition JSON.
ToolResultData
Legacy per-result record from the pre-M3 checkpoint payload. Kept so the T5 migration layer can read old AfterToolCalls { results } data.
UpdatePlanArgs
Arguments for the update_plan tool.
UsageInfo
Token usage information for an LLM call.

Enums§

ActionFormat
Which protocol an action came from. The format label travels with every Action so mixed backends stay distinguishable in persisted payloads.
ApprovalDecision
AskAnswer
What the user did with an ask.
BatchStatus
Batch-level health of an execution round (D15).
ChatMessage
A chat message in a conversation.
CheckpointStep
Content
Structured content returned by a tool, aligned with the MCP content array shape (no envelope, no orchestration/failure/truncation semantics).
FinishReason
Semantic finish reason, replacing scattered Option<String> matching.
GuardDecision
Guard decision — returned by guard, executed by base loop.
ImageAttachment
Image attachment for multimodal messages.
ImageDetail
Image detail level.
MessageRole
ObservationEvent
The tax-3 channel: observations become events, big payloads stay behind a reference (D9: no Error variant — refusals and interceptions live in ActionOutcome).
PlanStepStatus
Lightweight plan step status — display-only, no execution semantics.
ReasoningEffort
Reasoning intensity/depth enumeration.
ResponseFormat
Response format configuration.
RiskLevel
RunOutcome
The outcome of an Agent turn or run.
StreamChunk
Streaming response chunk.
ToolExposure
Visibility level of a tool to the LLM model.