pub enum AgentEvent {
Show 13 variants
RunStarted {
input: String,
timestamp: Instant,
},
RunCompleted {
output: String,
duration: Duration,
},
RunFailed {
error: String,
duration: Duration,
},
ModelCallStarted {
message_count: usize,
tool_count: usize,
timestamp: Instant,
},
ModelCallStreaming {
delta: String,
accumulated_length: usize,
},
ModelCallCompleted {
response_content: String,
tokens: Option<TokenUsage>,
duration: Duration,
stop_reason: Option<StopReason>,
},
ToolRequested {
tool_use_id: String,
name: String,
input: Value,
},
ToolExecuting {
tool_use_id: String,
name: String,
},
ToolCompleted {
tool_use_id: String,
name: String,
output: ToolResult,
duration: Duration,
},
ToolFailed {
tool_use_id: String,
name: String,
error: String,
duration: Duration,
},
PermissionRequired {
proposal_id: String,
tool_name: String,
params: Value,
params_hash: String,
},
PermissionGranted {
tool_use_id: String,
tool_name: String,
scope: Option<Scope>,
},
PermissionDenied {
tool_use_id: String,
tool_name: String,
reason: String,
},
}Expand description
Events emitted during agent execution
These events allow observers to track agent lifecycle, model calls, and tool executions in real-time.
Variants§
RunStarted
Agent.run() started
RunCompleted
Agent.run() completed
RunFailed
Agent.run() failed with error
ModelCallStarted
Model API call started
Fields
ModelCallStreaming
Model streaming a token (only if streaming enabled)
ModelCallCompleted
Model API call completed
Fields
§
tokens: Option<TokenUsage>Token usage statistics
§
stop_reason: Option<StopReason>Stop reason from model
ToolRequested
Model requested a tool (fires exactly once per tool use)
Fields
ToolExecuting
Tool execution actually starting (after permission granted)
ToolCompleted
Tool execution completed successfully
Fields
§
output: ToolResultTool output
ToolFailed
Tool execution failed
Fields
PermissionRequired
Tool execution requires permission
Fields
PermissionGranted
Permission granted (auto-approved or user-approved)
Fields
PermissionDenied
Permission denied
Trait Implementations§
Source§impl Clone for AgentEvent
impl Clone for AgentEvent
Source§fn clone(&self) -> AgentEvent
fn clone(&self) -> AgentEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AgentEvent
impl RefUnwindSafe for AgentEvent
impl Send for AgentEvent
impl Sync for AgentEvent
impl Unpin for AgentEvent
impl UnwindSafe for AgentEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more