#[non_exhaustive]pub enum AgentEvent {
Show 39 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: StreamDelta,
},
MessageEnd {
message: Message,
},
ToolExecutionStart {
tool_call_id: String,
tool_name: String,
args: Value,
intent: Option<String>,
context: Option<ToolCallContext>,
},
ToolExecutionUpdate {
tool_call_id: String,
tool_name: String,
partial_result: String,
tab_id: Option<Uuid>,
context: Option<ToolCallContext>,
},
ToolExecutionEnd {
tool_call_id: String,
tool_name: String,
intent: Option<String>,
result: ToolResult,
is_error: bool,
},
ToolCallDelta {
tool_call_id: String,
args_delta: String,
},
Start {
prompt: String,
},
Thinking,
ThinkingDelta {
text: String,
},
ThinkingEnd,
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>,
},
TtsrInterrupt {
rule_name: String,
session_id: Option<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,
},
ApprovalRequired {
tool_call_id: String,
tool_name: String,
args: Value,
reason: String,
session_id: Option<String>,
},
ApprovalResult {
tool_call_id: String,
approved: bool,
reason: Option<String>,
},
SoftRequirementReminder {
tool_name: String,
reason: String,
session_id: Option<String>,
},
SoftRequirementEscalation {
tool_name: String,
reason: String,
session_id: Option<String>,
},
HarmonyLeakDetected {
preview: String,
session_id: Option<String>,
},
}Expand description
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
delta: StreamDeltaIncremental delta describing what changed.
MessageEnd
A message has been finalized.
ToolExecutionStart
A tool is about to be executed.
Fields
intent: Option<String>Intent trace — a concise description of what this tool call does.
None for tools without intent tracing.
context: Option<ToolCallContext>Semantic context inferred from tool name and arguments.
None for tools without a known context mapping.
ToolExecutionUpdate
Partial progress from a running tool execution.
Fields
tab_id: Option<Uuid>Browser tab id that produced this progress (if the tool is
tab-aware). None for tools that don’t have a tab concept,
or for older tool implementations that don’t propagate tab ids.
context: Option<ToolCallContext>Semantic context inferred from tool name and arguments. Carries structured information about what this update means.
ToolExecutionEnd
A tool execution has finished.
Fields
intent: Option<String>Intent trace — a concise description of what this tool call did.
None for tools without intent tracing.
result: ToolResultThe tool result payload.
ToolCallDelta
Partial tool-call arguments streamed by the LLM while it is still
constructing a tool call. Emitted between the provider’s
ToolCallStart and ToolCallEnd, before AgentEvent::ToolExecutionStart.
Each args_delta is a raw JSON fragment (not valid JSON on its own) —
downstream consumers accumulate per tool_call_id.
Fields
Start
Legacy: agent started processing a prompt.
Thinking
Agent is waiting for the first response token.
ThinkingDelta
Incremental thinking / reasoning text from the model.
ThinkingEnd
The model finished a reasoning/thinking span and is about to produce the answer (or begin another content block). Signal-only (no payload).
Emitted when the provider reports ThinkingEnd. For models that
interleave reasoning and text (Claude 4, o-series) this may fire more
than once per turn — once per thinking span.
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
TtsrInterrupt
A TTSR rule violation was detected during streaming. The stream was aborted and a system reminder will be injected.
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.
ApprovalRequired
A tool call requires human approval.
Fields
ApprovalResult
Result of an approval request.
Fields
SoftRequirementReminder
A soft-required tool was not called on the first turn. The loop injects a reminder steering message.
Fields
SoftRequirementEscalation
A soft-required tool was not called after multiple turns. Escalation — stronger action may be needed.
Fields
HarmonyLeakDetected
GPT-5 Harmony protocol leak detected in streaming output. The stream was aborted to prevent the leaked content from being persisted or acted upon.
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