#[non_exhaustive]pub enum AgentEvent {
Show 44 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 {
id: Option<String>,
delta: String,
},
ToolExecutionStart {
id: String,
name: String,
args: Value,
},
ToolEnd {
id: String,
name: String,
args: Option<Value>,
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,
started_ms: u64,
},
SubagentProgress {
task_id: String,
session_id: String,
status: String,
metadata: Value,
},
SubagentEnd {
task_id: String,
session_id: String,
agent: String,
output: String,
success: bool,
finished_ms: u64,
},
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,
summary: Option<String>,
},
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
Start
Agent started processing
AgentModeChanged
Runtime agent style/mode selected for the current execution.
Fields
TurnStart
LLM turn started. The same turn number is emitted again when an interrupted response stream is retried; consumers should roll back provisional output from that turn before applying replacement deltas.
TextDelta
Text delta from streaming
ReasoningDelta
Reasoning/thinking delta from streaming (for models like kimi, deepseek)
ToolStart
The model started preparing a streamed tool call.
ToolInputDelta
Tool input delta from streaming (partial JSON arguments)
ToolExecutionStart
A fully prepared tool call passed safety/confirmation and began execution.
ToolEnd
Tool execution completed
Fields
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)
TurnEnd
LLM turn completed
End
Agent completed
Fields
usage: TokenUsageverification_summary: Box<VerificationSummary>meta: Option<LlmResponseMeta>Error
Error occurred
ConfirmationRequired
Tool execution requires confirmation (HITL)
ConfirmationReceived
Confirmation received from user (HITL)
ConfirmationTimeout
Confirmation timed out (HITL)
ExternalTaskPending
External task pending (needs SDK processing)
Fields
lane: SessionLaneExternalTaskCompleted
External task completed
PermissionDenied
Tool execution denied by permission policy
ContextResolving
Context resolution started
ContextResolved
Context resolution completed
CommandDeadLettered
Command moved to dead letter queue after exhausting retries
CommandRetry
Command retry attempt
QueueAlert
Queue alert (depth warning, latency alert, etc.)
TaskUpdated
Task list updated
MemoryStored
Memory stored
MemoryRecalled
Memory recalled
MemoriesSearched
Memories searched
MemoryCleared
Memory cleared
SubagentStart
Subagent task started
Fields
SubagentProgress
Subagent task progress update
Fields
SubagentEnd
Subagent task completed
Fields
PlanningStart
Planning phase started
PlanningEnd
Planning phase completed
StepStart
Step execution started
StepEnd
Step execution completed
GoalExtracted
Goal extracted from prompt
GoalProgress
Goal progress update
GoalAchieved
Goal achieved
ContextCompacted
Context automatically compacted due to high usage
Fields
PersistenceFailed
Session persistence failed — SDK clients should handle this
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
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
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.
Implementations§
Source§impl AgentEvent
impl AgentEvent
Sourcepub const fn event_type_v1(&self) -> &'static str
pub const fn event_type_v1(&self) -> &'static str
Return the canonical version-1 wire type for this event.
This match is deliberately exhaustive. Adding an AgentEvent
variant without assigning it a stable wire name is a compile
error rather than an SDK event named unknown.
Trait Implementations§
Source§impl Clone for AgentEvent
impl Clone for AgentEvent
Source§fn clone(&self) -> AgentEvent
fn clone(&self) -> AgentEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AgentEvent
impl Debug for AgentEvent
Source§impl<'de> Deserialize<'de> for AgentEvent
impl<'de> Deserialize<'de> for AgentEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for AgentEvent
impl Serialize for AgentEvent
Source§impl TryFrom<&AgentEvent> for EventEnvelopeV1
impl TryFrom<&AgentEvent> for EventEnvelopeV1
Source§type Error = EventProtocolError
type Error = EventProtocolError
Source§impl TryFrom<&AgentEvent> for AgentEventProjectionV1
impl TryFrom<&AgentEvent> for AgentEventProjectionV1
Source§type Error = EventProtocolError
type Error = EventProtocolError
Source§impl TryFrom<AgentEvent> for EventEnvelopeV1
impl TryFrom<AgentEvent> for EventEnvelopeV1
Source§type Error = EventProtocolError
type Error = EventProtocolError
Source§impl TryFrom<AgentEvent> for AgentEventProjectionV1
impl TryFrom<AgentEvent> for AgentEventProjectionV1
Source§type Error = EventProtocolError
type Error = EventProtocolError
Auto Trait Implementations§
impl Freeze for AgentEvent
impl RefUnwindSafe for AgentEvent
impl Send for AgentEvent
impl Sync for AgentEvent
impl Unpin for AgentEvent
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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