Skip to main content

Crate agent_types

Crate agent_types 

Source
Expand description

Pure type definitions for the agent-base runtime.

This crate contains data structures and enums with zero runtime dependencies — no async, no I/O, no trait objects. It exists so that downstream crates (SDKs, protocol layers, tool definitions) can depend on just the types without pulling in the full agent-base runtime.

agent-base re-exports everything from this crate, so existing use agent_base::Content continues to work.

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.
MigrationSource
Provenance mark for checkpoint data converted on read (T5 migration layer): the payload was written by a pre-M3 binary in an older wire shape.
Notice
Display-only notice from an engine mechanism.
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.
RunState
Run-level state tracking for the react loop.
SessionId
Unique identifier for an agent session.
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.

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).
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.
MessageRole
MigrationKind
NoticeKind
Notice category — decides how consumers render the notification.
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.
RiskLevel
RunOutcome
The outcome of an Agent turn or run.
ToolExposure
Visibility level of a tool to the LLM model.

Constants§

CHECKPOINT_VERSION
The checkpoint payload version this build writes and understands. Payloads without a version field are pre-versioning and read as 0.

Functions§

content_details
Extract structured detail metadata from tool output. When multiple Detail entries exist, they are merged into a single object. Returns None if no Detail entries are present.
content_images
Extract the pictures a tool’s output hands the model to look at, in the order they were produced — the image face of a tool result, exactly as content_text is its textual face. Empty when the output carried none.
content_text
Join the textual portion of tool output into a single string for display and session history. Non-text variants (e.g. Image, Detail) are skipped; Artifact is skipped too — its model face is the summary+reference line already carried in Text (the typed channel marks the artifact for UI).