Expand description
Agent message shapes.
AgentMessage is the canonical typed conversation transcript. Apps that
need richer shapes either extend the Custom variant (kind-tagged JSON
payload) or wrap the entire enum in their own outer enum. The loop never
peeks into Custom — it’s pass-through context.
The discriminator lives on the role tag, content is typed, and the loop
avoids Value walking via field-name strings.
Structs§
- Agent
Context - Snapshot of agent state passed into the loop.
- Assistant
Content - Assistant-message content. Carries text, hidden reasoning blocks, and tool call requests in source order.
- Image
Content - Reasoning
Details Content - Persistent envelope for provider-native reasoning items on an
assistant turn. The wire shape is
Vec<Value>matching OpenRouter’sreasoning_details[]schema (the broadest typed surface across providers);as_itemslifts it to typedcrate::reasoning::ReasoningItems for codec operations andfrom_itemsprojects typed items back. Thedetailsfield stays the source of truth so persisted trajectories round-trip byte-exact, even when a future provider sends shapes the typed enum doesn’t yet recognize. - RunIdentity
- Identity of one agent run.
- Text
Content - Tool
Result Content - Tool result content. Multiple blocks support image-returning tools.
- Usage
- Provider-reported token accounting for one LLM call.
Enums§
- Agent
Message - One message in the conversation transcript.
- Assistant
Block - Blocks an assistant message can carry.
- Stop
Reason - Why an assistant turn ended.
- Tool
Result Block - User
Block - User
Content - User-message content. Plain text is the common case; the block form supports images, attachments, and other multimodal inputs.