pub enum AgentEvent {
Show 15 variants
Start {
thread_id: ThreadId,
turn: usize,
},
Thinking {
message_id: String,
text: String,
},
ThinkingDelta {
message_id: String,
delta: String,
},
TextDelta {
message_id: String,
delta: String,
},
Text {
message_id: String,
text: String,
},
ToolCallStart {
id: String,
name: String,
display_name: String,
input: Value,
tier: ToolTier,
},
ToolCallEnd {
id: String,
name: String,
display_name: String,
result: ToolResult,
},
ToolProgress {
id: String,
name: String,
display_name: String,
stage: String,
message: String,
data: Option<Value>,
},
ToolRequiresConfirmation {
id: String,
name: String,
input: Value,
description: String,
},
TurnComplete {
turn: usize,
usage: TokenUsage,
},
Done {
thread_id: ThreadId,
total_turns: usize,
total_usage: TokenUsage,
duration: Duration,
},
Error {
message: String,
recoverable: bool,
},
Refusal {
message_id: String,
text: Option<String>,
},
ContextCompacted {
original_count: usize,
new_count: usize,
original_tokens: usize,
new_tokens: usize,
},
SubagentProgress {
subagent_id: String,
subagent_name: String,
tool_name: String,
tool_context: String,
completed: bool,
success: bool,
tool_count: u32,
total_tokens: u64,
},
}Expand description
Events emitted by the agent loop during execution. These are streamed to the client for real-time UI updates.
Variants§
Start
Agent loop has started
Thinking
Agent is “thinking” - complete thinking text after stream ends
ThinkingDelta
A thinking delta for streaming thinking content
TextDelta
A text delta for streaming responses
Text
Complete text block from the agent
ToolCallStart
Agent is about to call a tool
ToolCallEnd
Tool execution completed
ToolProgress
Progress update from an async tool operation
Fields
ToolRequiresConfirmation
Tool requires confirmation before execution. The application determines the confirmation type (normal, PIN, biometric).
TurnComplete
Agent turn completed (one LLM round-trip)
Done
Agent loop completed successfully
Error
An error occurred during execution
Refusal
The model refused the request (safety/policy).
ContextCompacted
Context was compacted to reduce size
Fields
SubagentProgress
Progress update from a running subagent
Fields
Implementations§
Source§impl AgentEvent
impl AgentEvent
pub const fn start(thread_id: ThreadId, turn: usize) -> Self
pub fn thinking(message_id: impl Into<String>, text: impl Into<String>) -> Self
pub fn thinking_delta( message_id: impl Into<String>, delta: impl Into<String>, ) -> Self
pub fn text_delta( message_id: impl Into<String>, delta: impl Into<String>, ) -> Self
pub fn text(message_id: impl Into<String>, text: impl Into<String>) -> Self
pub fn tool_call_start( id: impl Into<String>, name: impl Into<String>, display_name: impl Into<String>, input: Value, tier: ToolTier, ) -> Self
pub fn tool_call_end( id: impl Into<String>, name: impl Into<String>, display_name: impl Into<String>, result: ToolResult, ) -> Self
pub fn tool_progress( id: impl Into<String>, name: impl Into<String>, display_name: impl Into<String>, stage: impl Into<String>, message: impl Into<String>, data: Option<Value>, ) -> Self
pub const fn done( thread_id: ThreadId, total_turns: usize, total_usage: TokenUsage, duration: Duration, ) -> Self
pub fn error(message: impl Into<String>, recoverable: bool) -> Self
pub fn refusal(message_id: impl Into<String>, text: Option<String>) -> Self
pub const fn context_compacted( original_count: usize, new_count: usize, original_tokens: usize, new_tokens: usize, ) -> Self
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