#[non_exhaustive]pub enum Event {
Show 20 variants
TurnBegin {
user_input: UserInput,
},
TurnEnd,
StepBegin {
n: u32,
},
StepInterrupted,
StepRetry {
n: u32,
next_attempt: u32,
max_attempts: u32,
wait_s: u32,
error_type: String,
status_code: Option<u32>,
},
CompactionBegin,
CompactionEnd,
StatusUpdate(StatusUpdate),
ContentPart(ContentPart),
ToolCall {
id: String,
function: ToolCallFunction,
extras: Option<Value>,
},
ToolCallPart {
arguments_part: Option<String>,
},
ToolResult {
tool_call_id: String,
return_value: ToolReturnValue,
},
ApprovalResponse {
request_id: String,
response: ApprovalResponseKind,
feedback: Option<String>,
},
SubagentEvent {
parent_tool_call_id: Option<String>,
agent_id: Option<String>,
subagent_type: Option<String>,
event: SubagentEventPayload,
},
SteerInput {
user_input: UserInput,
},
BtwBegin {
id: String,
question: String,
},
BtwEnd {
id: String,
response: Option<String>,
error: Option<String>,
},
PlanDisplay {
content: String,
file_path: String,
},
HookTriggered {
event: String,
target: String,
hook_count: u32,
},
HookResolved {
event: String,
target: String,
action: HookAction,
reason: String,
duration_ms: u64,
},
}Expand description
An event emitted by the agent during a turn.
Events are sent as JSON-RPC notifications (method: "event") and do not
require a response.
Serialization follows the official wire envelope format:
{"type": "TurnBegin", "payload": {"user_input": ...}}.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
TurnBegin
A new turn has started with the given user input.
TurnEnd
The current turn has ended.
StepBegin
A new step within the turn has started.
StepInterrupted
The current step was interrupted (e.g. by user input).
StepRetry
The current step attempt failed and will be retried.
Added in Wire protocol v1.10.
Fields
CompactionBegin
Context compaction has started.
CompactionEnd
Context compaction has finished.
StatusUpdate(StatusUpdate)
Server status update (token usage, context size, etc.).
ContentPart(ContentPart)
A content part (text, image, etc.) from the model.
ToolCall
A tool call from the model.
Wire envelope type is "ToolCall". The payload carries an inner
type: "function" discriminator, matching the official v1.10 spec.
Fields
function: ToolCallFunctionFunction name and arguments.
ToolCallPart
A partial tool call (streaming arguments).
ToolResult
Result of a tool execution.
Fields
return_value: ToolReturnValueReturn value from the tool.
ApprovalResponse
Response to an approval request (sent by the client).
Fields
response: ApprovalResponseKindApproval decision.
SubagentEvent
An event from a subagent.
Fields
event: SubagentEventPayloadNested wire message in envelope form.
SteerInput
Additional user input steering the current turn.
BtwBegin
A side question (/btw) has started processing.
Added in Wire protocol v1.9.
Fields
BtwEnd
A side question (/btw) has finished processing.
Added in Wire protocol v1.9.
Fields
PlanDisplay
Plan display content.
HookTriggered
A hook was triggered.
Fields
HookResolved
A hook was resolved.