Skip to main content

AgentEvent

Enum AgentEvent 

Source
#[non_exhaustive]
pub enum AgentEvent {
Show 43 variants Start { prompt: String, }, AgentModeChanged { mode: String, agent: String, description: String, }, TurnStart { turn: usize, }, TextDelta { text: String, }, ReasoningDelta { text: String, }, ToolStart { id: String, name: String, }, ToolInputDelta { delta: String, }, ToolEnd { id: String, name: String, output: String, exit_code: i32, metadata: Option<Value>, error_kind: Option<ToolErrorKind>, }, ToolOutputDelta { id: String, name: String, delta: String, }, TurnEnd { turn: usize, usage: TokenUsage, }, End { text: String, usage: TokenUsage, verification_summary: Box<VerificationSummary>, meta: Option<LlmResponseMeta>, }, 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, }, BudgetThresholdHit { resource: String, kind: String, consumed: f64, limit: f64, message: Option<String>, }, PassivationRequested { reason: String, deadline_ms: Option<u64>, }, PeerInvocation { from_session_id: String, from_tenant_id: Option<String>, correlation_id: Option<String>, },
}
Expand description

Events emitted during agent execution

Subscribe via crate::AgentSession::stream. 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
§

AgentModeChanged

Runtime agent style/mode selected for the current execution.

Fields

§mode: String

Stable UI/runtime mode label, e.g. “general”, “planning”, “explore”.

§agent: String

Canonical built-in agent name associated with this mode.

§description: String

Human-readable explanation of the selected style.

§

TurnStart

LLM turn started

Fields

§turn: usize
§

TextDelta

Text delta from streaming

Fields

§text: String
§

ReasoningDelta

Reasoning/thinking delta from streaming (for models like kimi, deepseek)

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
§metadata: Option<Value>
§error_kind: Option<ToolErrorKind>

Structured discriminant set by tools that mapped their failure into a typed ToolErrorKind (e.g. edit / patch on a WorkspaceError::VersionConflict). None on success or untyped failure.

§

ToolOutputDelta

Intermediate tool output (streaming delta)

Fields

§name: String
§delta: String
§

TurnEnd

LLM turn completed

Fields

§turn: usize
§

End

Agent completed

Fields

§text: String
§verification_summary: Box<VerificationSummary>
§

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
§

BudgetThresholdHit

A budget threshold was crossed for this session/tenant.

Emitted by a host BudgetGuard impl when LLM/tool spend hits a soft or hard threshold. The session is not automatically halted — kind lets in-session policy decide (e.g. fast-compact at “soft”, refuse next LLM call at “hard”).

Fields

§resource: String

Logical resource: “llm_tokens”, “tool_calls”, “wall_time”, “usd_cost”, or host-defined.

§kind: String

“soft” or “hard”; host-defined semantics beyond that.

§consumed: f64

Current consumed amount in the same unit as limit.

§limit: f64

Threshold that was crossed.

§message: Option<String>

Optional explanation for logs / UI.

§

PassivationRequested

The host is asking the session to release in-memory state.

Emitted before the host calls session.close() or moves the session to another node. Session code that holds large caches can react (flush to memory store, drop derived state). The framework does not act on this event itself.

Fields

§reason: String

“idle_reaper”, “node_drain”, “migration”, “manual”, or host-defined.

§deadline_ms: Option<u64>

Optional deadline (Unix epoch ms) before forced close.

§

PeerInvocation

Another session in the cluster has invoked this one.

Lets in-session hooks distinguish “human-driven send” from “peer-driven send” without inspecting prompts. The host routes the actual prompt through the normal send / stream path; this event is metadata only.

Fields

§from_session_id: String

Session id of the invoking peer (cluster-stable).

§from_tenant_id: Option<String>

Optional tenant of the invoking peer.

§correlation_id: Option<String>

Distributed-trace correlation id linking the two sessions.

Trait Implementations§

Source§

impl Clone for AgentEvent

Source§

fn clone(&self) -> AgentEvent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

impl<T> ParallelSend for T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,