pub enum AgentEvent {
Show 17 variants
ReasoningDelta(String),
TextDelta(String),
ToolStart {
name: String,
id: String,
humanized: String,
},
ToolBackgroundReady {
id: String,
request: Option<BackgroundRequest>,
},
ToolResult {
name: String,
id: String,
output: String,
success: bool,
elapsed_ms: u64,
sources: Vec<Source>,
},
AudioChunk {
data: Vec<u8>,
format: String,
},
Status(String),
Compacted(String),
FileDiff {
path: String,
diff: Vec<DiffLine>,
},
Usage(TokenUsage),
Done(String),
Cancelled,
Error(String),
ToolProgress {
id: String,
line: String,
},
SpawnedEvent {
id: String,
task: String,
model: Option<Model>,
event: Box<AgentEvent>,
},
Interrupted {
tool_call_id: String,
tool_name: String,
output: String,
payload: Option<Arc<dyn InterruptPayload>>,
},
CompactionNeeded {
reason: CompactionReason,
},
}Expand description
Events emitted by the agent turn loop as a Stream<Item = AgentEvent>.
Listeners (REPL, Slack, Telegram, etc.) receive these and render them incrementally. Consumers should handle all variants; unknown variants should be silently ignored so forward-compatibility is preserved.
Variants§
ReasoningDelta(String)
Incremental reasoning token (for models that surface internal thinking).
TextDelta(String)
Incremental text token from the assistant message.
ToolStart
A tool call has started execution.
Fields
ToolBackgroundReady
A running tool accepts a user request to continue in the background.
ToolResult
A tool has finished. The output may be truncated for display.
AudioChunk
Incremental audio output chunk (raw bytes) for real-time playback.
Status(String)
Informational status message (compaction progress, retry attempts, etc.).
Compacted(String)
Conversation was compacted; payload is the summary text.
FileDiff
A file was modified by a tool.
Usage(TokenUsage)
Token usage telemetry from the provider.
Done(String)
Final terminal event — processing complete with String as the full response.
Cancelled
The user cancelled the running turn.
Error(String)
Terminal error event.
ToolProgress
Incremental output from a running tool (e.g. stdout lines from bash).
SpawnedEvent
A spawned agent produced an event while running in parallel.
Interrupted
A tool requested interactive input. Emitted when a turn ends with
TurnStatus::Interrupted. The caller should show the appropriate
picker, inject the tool result, and resume.
Fields
payload: Option<Arc<dyn InterruptPayload>>CompactionNeeded
The conversation needs compaction but auto_compact is off.
The caller should compact and call agent.start() with AgentInput::Resume.
Fields
reason: CompactionReason