AgentEvent

Enum AgentEvent 

Source
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

Fields

§input: String

User input message

§timestamp: Instant

Timestamp

§

RunCompleted

Agent.run() completed

Fields

§output: String

Final response to user

§duration: Duration

Total execution duration

§

RunFailed

Agent.run() failed with error

Fields

§error: String

Error message

§duration: Duration

How long before failure

§

ModelCallStarted

Model API call started

Fields

§message_count: usize

Messages being sent to model

§tool_count: usize

Number of tools available to model

§timestamp: Instant

Timestamp

§

ModelCallStreaming

Model streaming a token (only if streaming enabled)

Fields

§delta: String

Incremental text delta

§accumulated_length: usize

Accumulated length so far

§

ModelCallCompleted

Model API call completed

Fields

§response_content: String

Response content

§tokens: Option<TokenUsage>

Token usage statistics

§duration: Duration

API call duration

§stop_reason: Option<StopReason>

Stop reason from model

§

ToolRequested

Model requested a tool (fires exactly once per tool use)

Fields

§tool_use_id: String

Unique ID for this tool use

§name: String

Tool name

§input: Value

Input parameters

§

ToolExecuting

Tool execution actually starting (after permission granted)

Fields

§tool_use_id: String

Unique ID for this tool use

§name: String

Tool name

§

ToolCompleted

Tool execution completed successfully

Fields

§tool_use_id: String

Matching ID from ToolRequested

§name: String

Tool name

§output: ToolResult

Tool output

§duration: Duration

Execution duration

§

ToolFailed

Tool execution failed

Fields

§tool_use_id: String

Matching ID from ToolRequested

§name: String

Tool name

§error: String

Error message

§duration: Duration

How long before failure

§

PermissionRequired

Tool execution requires permission

Fields

§proposal_id: String

Unique ID for this permission request

§tool_name: String

Tool name

§params: Value

Tool input parameters

§params_hash: String

Hash of parameters (for creating exact-match grants)

§

PermissionGranted

Permission granted (auto-approved or user-approved)

Fields

§tool_use_id: String

Tool use ID

§tool_name: String

Tool name

§scope: Option<Scope>

The scope of the grant (None if one-time approval)

§

PermissionDenied

Permission denied

Fields

§tool_use_id: String

Tool use ID

§tool_name: String

Tool name

§reason: String

Reason for denial

Trait Implementations§

Source§

impl Clone for AgentEvent

Source§

fn clone(&self) -> AgentEvent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AgentEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.