pub enum AgentEvent {
Show 13 variants
Text(String),
Thinking(String),
RedactedThinking(String),
ToolUse {
id: String,
name: String,
input: Value,
server: bool,
},
ToolResult {
tool_use_id: String,
content: Value,
is_error: bool,
structured: Option<Value>,
},
Subagent {
parent_tool_use_id: String,
event: Box<AgentEvent>,
},
BackgroundTasks(Vec<BackgroundTask>),
ModelFallback {
from: String,
to: String,
trigger: String,
},
Compacted {
trigger: String,
pre_tokens: Option<u64>,
post_tokens: Option<u64>,
},
System {
subtype: String,
data: Value,
},
Other {
kind: String,
data: Value,
},
Done(TurnResult),
Error(TurnError),
}Variants§
Text(String)
A text delta (requires –include-partial-messages OR full assistant message).
Thinking(String)
A complete thinking block.
RedactedThinking(String)
Encrypted thinking, opaque to the host.
ToolUse
A tool call: one the CLI runs, or one the API runs itself
(server: true, e.g. web search).
ToolResult
The result of a tool call. content is a string or content blocks,
as sent to the model; structured is the tool’s full output when
the CLI reports one (e.g. Bash {stdout, stderr, interrupted, …}).
Subagent
An event of a subagent, started by the Agent/Task tool call
parent_tool_use_id.
BackgroundTasks(Vec<BackgroundTask>)
Background task tree updated (replace semantics).
ModelFallback
Model was switched during the turn.
Compacted
Context was compacted (trigger: “manual” for /compact, “auto”).
System
Any other system frame (init, api_retry, task_started,
hook_response, permission_denied, status, …), verbatim.
Other
Any other frame (rate_limit_event, tool_progress,
prompt_suggestion, command_lifecycle, …), verbatim.
Done(TurnResult)
Turn completed successfully.
Error(TurnError)
Turn failed.