pub enum AgentEvent {
Show 18 variants
ToolStart {
tool_name: String,
tool_call_id: String,
input: Value,
display_name: Option<String>,
summary: Option<String>,
activity_description: Option<String>,
},
ToolComplete {
tool_name: String,
tool_call_id: String,
result: ToolResult,
display_name: Option<String>,
rendered_result: Option<String>,
},
ToolError {
tool_name: String,
tool_call_id: String,
error: String,
},
Thinking {
turn: u32,
},
Done {
result: QueryResult,
},
MessageStart {
message_id: String,
},
ContentBlockStart {
index: u32,
block_type: String,
},
ContentBlockDelta {
index: u32,
delta: ContentDelta,
},
ContentBlockStop {
index: u32,
},
MessageStop,
RequestStart,
StreamRequestEnd,
RateLimitStatus {
is_rate_limited: bool,
retry_after_secs: Option<f64>,
},
MaxTurnsReached {
max_turns: u32,
turn_count: u32,
},
Tombstone {
message: String,
},
Compact {
event: CompactProgressEvent,
},
TokenUsage {
usage: TokenUsage,
cost: f64,
},
ApiRetry {
attempt: u32,
max_retries: u32,
retry_delay_ms: u64,
error_status: Option<u16>,
error: String,
},
}Expand description
Agent event types for streaming updates (matches TypeScript behavior)
Variants§
ToolStart
Tool is about to be executed
Fields
ToolComplete
Tool execution completed
Fields
result: ToolResultToolError
Tool execution failed
Thinking
LLM is thinking (started a new turn)
Done
Final response ready
Fields
result: QueryResultMessageStart
Message started (streaming begins)
ContentBlockStart
Content block started (matches TypeScript StreamEvent content_block_start)
ContentBlockDelta
Content block delta (matches TypeScript StreamEvent content_block_delta)
ContentBlockStop
Content block stopped (matches TypeScript StreamEvent content_block_stop)
MessageStop
Message stopped (streaming ends)
RequestStart
Request started (before API call) - matches TypeScript ‘stream_request_start’
StreamRequestEnd
Request completed (API response received, streaming finished) Matches TypeScript ‘stream_request_end’ — useful for TUI spinner management.
RateLimitStatus
Rate limit status change — notifies TUI/CLI when a rate limit is hit or cleared
Fields
MaxTurnsReached
Max turns reached - matches TypeScript ‘max_turns_reached’ attachment
Tombstone
Tombstone event for orphaned messages on streaming fallback (matches TypeScript ‘tombstone’ event)
Compact
Compact progress event (hooks_start, compact_start, compact_end) Matches TypeScript ToolUseContext.onCompactProgress
Fields
event: CompactProgressEventTokenUsage
Actual API token usage from message_delta event Emitted after all content_block_stop events, before message_stop
ApiRetry
API retry progress — emitted during 429/529 retry backoff Matches TypeScript’s ‘api_retry’ subtype yielded by QueryEngine from createSystemAPIErrorMessage in withRetry.ts
Fields
Trait Implementations§
Source§impl Clone for AgentEvent
impl Clone for AgentEvent
Source§fn clone(&self) -> AgentEvent
fn clone(&self) -> AgentEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more