pub enum AgentEvent {
Show 13 variants
TextStart,
TextDelta(String),
TextEnd,
ThinkingStart,
ThinkingDelta(String),
ThinkingEnd,
ToolCallsBegin(Vec<ToolCall>),
ToolCallsStart(Vec<ToolCall>),
ToolResult {
call_id: String,
output: Result<String, String>,
duration_ms: u64,
},
ToolCallsComplete,
UserSteered {
content: String,
},
Compact {
summary: String,
},
Done(AgentResponse),
}Expand description
A fine-grained event emitted during agent execution.
Yielded by Agent::run_stream() or emitted via Hook::on_event()
for real-time status reporting to clients.
Text and thinking deltas are bracketed by explicit
TextStart/TextEnd and ThinkingStart/ThinkingEnd markers so
clients can render coherent segments without inferring boundaries
from neighboring events. Only one segment is open at a time —
transitions emit the closing event of the previous segment before
the opening of the next.
Variants§
TextStart
A text segment is starting; subsequent TextDeltas belong to it.
TextDelta(String)
Text content delta from the model.
TextEnd
The current text segment has ended.
ThinkingStart
A thinking segment is starting; subsequent ThinkingDeltas belong to it.
ThinkingDelta(String)
Thinking/reasoning content delta from the model.
ThinkingEnd
The current thinking segment has ended.
ToolCallsBegin(Vec<ToolCall>)
Early notification: model is generating tool calls (names only, args incomplete).
ToolCallsStart(Vec<ToolCall>)
Model is calling tools (with the complete tool calls).
ToolResult
A single tool completed execution.
output is Ok for normal tool output and Err for a failure —
either a dispatch-level error (no sender, channel closed) or a
handler-reported failure. The inner string carries the text in
both cases so UIs can render it; the distinction lets clients
style errors differently and lets agents make retry decisions.
Fields
ToolCallsComplete
All tools completed, continuing to next iteration.
UserSteered
User steering message injected at turn boundary.
Compact
Context was compacted — carries the compaction summary.
Done(AgentResponse)
Agent finished with final response.
Trait Implementations§
Source§impl Clone for AgentEvent
impl Clone for AgentEvent
Source§fn clone(&self) -> AgentEvent
fn clone(&self) -> AgentEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more