#[non_exhaustive]pub enum AgentEvent {
Show 32 variants
AgentStart {
prompts: Vec<Message>,
session_id: Option<String>,
},
AgentEnd {
messages: Vec<Message>,
stop_reason: Option<String>,
session_id: Option<String>,
},
TurnStart {
turn_number: u32,
},
TurnEnd {
turn_number: u32,
assistant_message: Message,
tool_results: Vec<ToolResultMessage>,
},
MessageStart {
message: Message,
},
MessageUpdate {
message: Message,
delta: Option<String>,
},
MessageEnd {
message: Message,
},
ToolExecutionStart {
tool_call_id: String,
tool_name: String,
args: Value,
},
ToolExecutionUpdate {
tool_call_id: String,
tool_name: String,
partial_result: String,
},
ToolExecutionEnd {
tool_call_id: String,
tool_name: String,
result: ToolResult,
is_error: bool,
},
Start {
prompt: String,
},
Thinking,
ThinkingDelta {
text: String,
},
TextChunk {
text: String,
},
ToolCall {
tool_call: ToolCall,
},
ToolStart {
tool_call_id: String,
tool_name: String,
arguments: Value,
},
ToolProgress {
tool_call_id: String,
message: String,
},
ToolComplete {
result: ToolResult,
},
ToolError {
tool_call_id: String,
error: String,
},
Complete {
content: String,
stop_reason: String,
},
Error {
message: String,
session_id: Option<String>,
},
Iteration {
number: usize,
},
Usage {
input_tokens: usize,
output_tokens: usize,
},
Compaction {
event: CompactionEvent,
},
Retry {
attempt: usize,
max_retries: usize,
retry_after_secs: u64,
reason: String,
session_id: Option<String>,
},
Fallback {
from_model: String,
to_model: String,
},
Cancelled,
PartialResponse {
content: String,
},
AutoRetryStart {
attempt: usize,
max_attempts: usize,
delay_ms: u64,
error_message: String,
},
AutoRetryEnd {
success: bool,
attempt: usize,
final_error: Option<String>,
},
SteeringMessage {
message: Message,
},
FollowUpMessage {
message: Message,
},
}Expand description
Events emitted during agent execution.
Events are tagged with type and serialized as camelCase for JSON consumers.
This enum is #[non_exhaustive] — new variants may be added in future releases.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AgentStart
Emitted when the agent begins processing a batch of prompts.
Fields
AgentEnd
Emitted when the agent finishes all processing.
Fields
TurnStart
Emitted at the start of each agent loop turn.
TurnEnd
Emitted when a turn completes, including the assistant reply and tool results.
Fields
tool_results: Vec<ToolResultMessage>Tool results collected during this turn.
MessageStart
A new message has been created in the conversation.
MessageUpdate
A message has been updated with new content.
Fields
MessageEnd
A message has been finalized.
ToolExecutionStart
A tool is about to be executed.
Fields
ToolExecutionUpdate
Partial progress from a running tool execution.
Fields
ToolExecutionEnd
A tool execution has finished.
Fields
result: ToolResultThe tool result payload.
Start
Legacy: agent started processing a prompt.
Thinking
Agent is waiting for the first response token.
ThinkingDelta
Incremental thinking / reasoning text from the model.
TextChunk
A chunk of generated text from the model.
ToolCall
The model requested a tool call.
ToolStart
A tool execution has started.
Fields
ToolProgress
Progress update from a running tool.
Fields
ToolComplete
A tool execution has completed.
Fields
result: ToolResultThe tool result payload.
ToolError
A tool execution failed.
Complete
The agent produced a final response.
Error
An error occurred during agent execution.
Fields
Iteration
Agent loop iteration counter update.
Usage
Token usage report for a completed turn.
Fields
Compaction
Context compaction lifecycle event.
Fields
event: CompactionEventThe underlying compaction event detail.
Retry
The agent is retrying after a transient error.
Fields
Fallback
The agent switched to a fallback model.
Fields
Cancelled
The agent run was cancelled by the caller.
PartialResponse
A partial response delivered mid-stream (useful for UI rendering).
AutoRetryStart
An automatic retry attempt is starting.
Fields
AutoRetryEnd
An automatic retry attempt has concluded.
Fields
SteeringMessage
A system-level steering message injected into the conversation.
FollowUpMessage
A follow-up message appended to continue the conversation.
Implementations§
Source§impl AgentEvent
impl AgentEvent
Trait Implementations§
Source§impl Clone for AgentEvent
impl Clone for AgentEvent
Source§fn clone(&self) -> AgentEvent
fn clone(&self) -> AgentEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more