Skip to main content

AgentEvent

Enum AgentEvent 

Source
#[non_exhaustive]
pub enum AgentEvent {
Show 38 variants Start { prompt: String, }, TurnStart { turn: usize, }, TextDelta { text: String, }, ToolStart { id: String, name: String, }, ToolInputDelta { delta: String, }, ToolEnd { id: String, name: String, output: String, exit_code: i32, }, ToolOutputDelta { id: String, name: String, delta: String, }, TurnEnd { turn: usize, usage: TokenUsage, }, End { text: String, usage: TokenUsage, }, Error { message: String, }, ConfirmationRequired { tool_id: String, tool_name: String, args: Value, timeout_ms: u64, }, ConfirmationReceived { tool_id: String, approved: bool, reason: Option<String>, }, ConfirmationTimeout { tool_id: String, action_taken: String, }, ExternalTaskPending { task_id: String, session_id: String, lane: SessionLane, command_type: String, payload: Value, timeout_ms: u64, }, ExternalTaskCompleted { task_id: String, session_id: String, success: bool, }, PermissionDenied { tool_id: String, tool_name: String, args: Value, reason: String, }, ContextResolving { providers: Vec<String>, }, ContextResolved { total_items: usize, total_tokens: usize, }, CommandDeadLettered { command_id: String, command_type: String, lane: String, error: String, attempts: u32, }, CommandRetry { command_id: String, command_type: String, lane: String, attempt: u32, delay_ms: u64, }, QueueAlert { level: String, alert_type: String, message: String, }, TaskUpdated { session_id: String, tasks: Vec<Task>, }, MemoryStored { memory_id: String, memory_type: String, importance: f32, tags: Vec<String>, }, MemoryRecalled { memory_id: String, content: String, relevance: f32, }, MemoriesSearched { query: Option<String>, tags: Vec<String>, result_count: usize, }, MemoryCleared { tier: String, count: u64, }, SubagentStart { task_id: String, session_id: String, parent_session_id: String, agent: String, description: String, }, SubagentProgress { task_id: String, session_id: String, status: String, metadata: Value, }, SubagentEnd { task_id: String, session_id: String, agent: String, output: String, success: bool, }, PlanningStart { prompt: String, }, PlanningEnd { plan: ExecutionPlan, estimated_steps: usize, }, StepStart { step_id: String, description: String, step_number: usize, total_steps: usize, }, StepEnd { step_id: String, status: TaskStatus, step_number: usize, total_steps: usize, }, GoalExtracted { goal: AgentGoal, }, GoalProgress { goal: String, progress: f32, completed_steps: usize, total_steps: usize, }, GoalAchieved { goal: String, total_steps: usize, duration_ms: i64, }, ContextCompacted { session_id: String, before_messages: usize, after_messages: usize, percent_before: f32, }, PersistenceFailed { session_id: String, operation: String, error: String, },
}
Expand description

Events emitted during agent execution

Subscribe via Session::subscribe_events(). New variants may be added in minor releases — always include a wildcard arm (_ => {}) when matching.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Start

Agent started processing

Fields

§prompt: String
§

TurnStart

LLM turn started

Fields

§turn: usize
§

TextDelta

Text delta from streaming

Fields

§text: String
§

ToolStart

Tool execution started

Fields

§name: String
§

ToolInputDelta

Tool input delta from streaming (partial JSON arguments)

Fields

§delta: String
§

ToolEnd

Tool execution completed

Fields

§name: String
§output: String
§exit_code: i32
§

ToolOutputDelta

Intermediate tool output (streaming delta)

Fields

§name: String
§delta: String
§

TurnEnd

LLM turn completed

Fields

§turn: usize
§

End

Agent completed

Fields

§text: String
§

Error

Error occurred

Fields

§message: String
§

ConfirmationRequired

Tool execution requires confirmation (HITL)

Fields

§tool_id: String
§tool_name: String
§args: Value
§timeout_ms: u64
§

ConfirmationReceived

Confirmation received from user (HITL)

Fields

§tool_id: String
§approved: bool
§reason: Option<String>
§

ConfirmationTimeout

Confirmation timed out (HITL)

Fields

§tool_id: String
§action_taken: String
§

ExternalTaskPending

External task pending (needs SDK processing)

Fields

§task_id: String
§session_id: String
§command_type: String
§payload: Value
§timeout_ms: u64
§

ExternalTaskCompleted

External task completed

Fields

§task_id: String
§session_id: String
§success: bool
§

PermissionDenied

Tool execution denied by permission policy

Fields

§tool_id: String
§tool_name: String
§args: Value
§reason: String
§

ContextResolving

Context resolution started

Fields

§providers: Vec<String>
§

ContextResolved

Context resolution completed

Fields

§total_items: usize
§total_tokens: usize
§

CommandDeadLettered

Command moved to dead letter queue after exhausting retries

Fields

§command_id: String
§command_type: String
§lane: String
§error: String
§attempts: u32
§

CommandRetry

Command retry attempt

Fields

§command_id: String
§command_type: String
§lane: String
§attempt: u32
§delay_ms: u64
§

QueueAlert

Queue alert (depth warning, latency alert, etc.)

Fields

§level: String
§alert_type: String
§message: String
§

TaskUpdated

Task list updated

Fields

§session_id: String
§tasks: Vec<Task>
§

MemoryStored

Memory stored

Fields

§memory_id: String
§memory_type: String
§importance: f32
§tags: Vec<String>
§

MemoryRecalled

Memory recalled

Fields

§memory_id: String
§content: String
§relevance: f32
§

MemoriesSearched

Memories searched

Fields

§tags: Vec<String>
§result_count: usize
§

MemoryCleared

Memory cleared

Fields

§tier: String
§count: u64
§

SubagentStart

Subagent task started

Fields

§task_id: String

Unique task identifier

§session_id: String

Child session ID

§parent_session_id: String

Parent session ID

§agent: String

Agent type (e.g., “explore”, “general”)

§description: String

Short description of the task

§

SubagentProgress

Subagent task progress update

Fields

§task_id: String

Task identifier

§session_id: String

Child session ID

§status: String

Progress status message

§metadata: Value

Additional metadata

§

SubagentEnd

Subagent task completed

Fields

§task_id: String

Task identifier

§session_id: String

Child session ID

§agent: String

Agent type

§output: String

Task output/result

§success: bool

Whether the task succeeded

§

PlanningStart

Planning phase started

Fields

§prompt: String
§

PlanningEnd

Planning phase completed

Fields

§estimated_steps: usize
§

StepStart

Step execution started

Fields

§step_id: String
§description: String
§step_number: usize
§total_steps: usize
§

StepEnd

Step execution completed

Fields

§step_id: String
§status: TaskStatus
§step_number: usize
§total_steps: usize
§

GoalExtracted

Goal extracted from prompt

Fields

§

GoalProgress

Goal progress update

Fields

§goal: String
§progress: f32
§completed_steps: usize
§total_steps: usize
§

GoalAchieved

Goal achieved

Fields

§goal: String
§total_steps: usize
§duration_ms: i64
§

ContextCompacted

Context automatically compacted due to high usage

Fields

§session_id: String
§before_messages: usize
§after_messages: usize
§percent_before: f32
§

PersistenceFailed

Session persistence failed — SDK clients should handle this

Fields

§session_id: String
§operation: String
§error: String

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
Source§

impl<'de> Deserialize<'de> for AgentEvent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for AgentEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,