Enum TurnEvent
pub enum TurnEvent {
Chunk {
delta: String,
},
Thinking {
delta: String,
},
ToolCall {
id: String,
name: String,
args: Value,
},
ToolResult {
id: String,
name: String,
output: String,
artifact: Option<ToolArtifact>,
},
Plan {
entries: Vec<PlanEntry>,
},
ApprovalRequest {
request_id: String,
tool_name: String,
arguments_summary: String,
timeout_secs: u64,
},
HistoryTrimmed {
dropped_messages: usize,
kept_turns: usize,
reason: String,
},
Usage {
input_tokens: Option<u64>,
cached_input_tokens: Option<u64>,
output_tokens: Option<u64>,
cost_usd: Option<f64>,
},
}Variants§
Chunk
A text chunk from the LLM response (may arrive many times).
Thinking
A reasoning/thinking chunk from a thinking model (may arrive many times).
ToolCall
The agent is invoking a tool.
Fields
id: StringStable correlation ID shared with the matching TurnEvent::ToolResult.
ToolResult
A tool has returned a result.
Fields
id: StringStable correlation ID shared with the originating TurnEvent::ToolCall.
artifact: Option<ToolArtifact>Typed metadata for a file-producing tool (e.g. deliver_file), so
channels attach the file structurally instead of parsing output.
None for ordinary tools.
Plan
ApprovalRequest
Fields
HistoryTrimmed
Older whole turns were dropped to fit either the context token budget or the configured message limit. Surfaces a user-visible “context was cut here” marker so trimming is never silent. Emitted whenever a trim occurs.
Usage
Per-LLM-call token usage and cost; a turn may emit several, one per
model call. None means “unavailable for this call”, not zero.