pub enum AgentEvent {
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>,
},
ToolStarted {
id: String,
name: String,
input: Value,
approval_status: ToolApprovalStatus,
timestamp: Instant,
},
ToolCompleted {
id: String,
name: String,
output: ToolResult,
approval_status: ToolApprovalStatus,
duration: Duration,
},
ToolFailed {
id: String,
name: String,
error: String,
duration: Duration,
},
PermissionRequired {
proposal_id: String,
tool_name: String,
params: Value,
params_hash: String,
},
PermissionGranted {
proposal_id: String,
scope: Option<Scope>,
},
PermissionDenied {
proposal_id: 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
ToolStarted
Tool execution started
Fields
§
approval_status: ToolApprovalStatusHow this tool execution was approved
ToolCompleted
Tool execution completed successfully
Fields
§
output: ToolResultTool output
§
approval_status: ToolApprovalStatusHow this tool execution was approved
ToolFailed
Tool execution failed
Fields
PermissionRequired
Tool execution requires permission
Fields
PermissionGranted
Permission granted
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