#[non_exhaustive]pub enum AgentEvent {
Show 35 variants
RunStarted {
session_id: SessionId,
prompt: ContentInput,
},
RunCompleted {
session_id: SessionId,
result: String,
structured_output: Option<Value>,
extraction_required: bool,
usage: Usage,
terminal_cause_kind: Option<TurnTerminalCauseKind>,
},
ExtractionSucceeded {
session_id: SessionId,
structured_output: Value,
schema_warnings: Option<Vec<SchemaWarning>>,
},
ExtractionFailed {
session_id: SessionId,
last_output: String,
attempts: u32,
reason: String,
},
RunFailed {
session_id: SessionId,
error_class: AgentErrorClass,
error: String,
terminal_cause_kind: Option<TurnTerminalCauseKind>,
error_report: Option<AgentErrorReport>,
},
HookStarted {
hook_id: HookId,
point: HookPoint,
},
HookCompleted {
hook_id: HookId,
point: HookPoint,
duration_ms: u64,
},
HookFailed {
hook_id: HookId,
point: HookPoint,
error: String,
},
HookDenied {
hook_id: HookId,
point: HookPoint,
reason_code: HookReasonCode,
message: String,
payload: Option<Value>,
},
TurnStarted {
turn_number: u32,
},
ReasoningDelta {
delta: String,
},
ReasoningComplete {
content: String,
},
TextDelta {
delta: String,
},
TextComplete {
content: String,
},
ServerToolContent {
id: Option<String>,
name: String,
content: Value,
},
AssistantImageAppended {
image: AssistantImageEvent,
},
ToolCallRequested {
id: String,
name: String,
args: ToolCallArguments,
},
ToolResultReceived {
id: String,
name: String,
content: Vec<ContentBlock>,
is_error: bool,
},
TurnCompleted {
stop_reason: StopReason,
usage: Usage,
},
ToolExecutionStarted {
id: String,
name: String,
},
ToolExecutionCompleted {
id: String,
name: String,
result: String,
content: Vec<ContentBlock>,
is_error: bool,
duration_ms: u64,
},
ToolExecutionTimedOut {
id: String,
name: String,
timeout_ms: u64,
},
CompactionStarted {
input_tokens: u64,
estimated_history_tokens: u64,
message_count: usize,
},
CompactionCompleted {
summary_tokens: u64,
messages_before: usize,
messages_after: usize,
},
CompactionFailed {
error: String,
},
BudgetWarning {
budget_type: BudgetType,
used: u64,
limit: u64,
percent: f32,
},
Retrying {
attempt: u32,
max_attempts: u32,
error: String,
delay_ms: u64,
retry: Option<LlmRetrySchedule>,
},
SkillsResolved {
skills: Vec<SkillKey>,
injection_bytes: usize,
},
SkillResolutionFailed {
skill_key: Option<SkillKey>,
reason: SkillResolutionFailureReason,
reference: String,
error: String,
},
InteractionComplete {
interaction_id: InteractionId,
result: String,
structured_output: Option<Value>,
},
InteractionCallbackPending {
interaction_id: InteractionId,
tool_name: String,
args: Value,
},
InteractionFailed {
interaction_id: InteractionId,
error: String,
},
StreamTruncated {
reason: String,
},
ToolConfigChanged {
payload: ToolConfigChangedPayload,
},
BackgroundJobCompleted {
job_id: String,
display_name: String,
legacy_status: Option<String>,
terminal_status: BackgroundJobTerminalStatus,
detail: String,
},
}Expand description
Events emitted during agent execution
These events form the streaming API for consumers.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
RunStarted
Agent run started
RunCompleted
Agent run completed successfully
Fields
structured_output: Option<Value>Structured output from the completed run, when schema extraction produced a typed value.
extraction_required: boolWhether a separate extraction terminal event is expected after this completed main run.
terminal_cause_kind: Option<TurnTerminalCauseKind>ExtractionSucceeded
Structured-output extraction succeeded after a completed main run.
ExtractionFailed
Structured-output extraction failed after a completed main run.
RunFailed
Agent run failed
Fields
error_class: AgentErrorClassterminal_cause_kind: Option<TurnTerminalCauseKind>error_report: Option<AgentErrorReport>HookStarted
Hook invocation started.
HookCompleted
Hook invocation completed.
HookFailed
Hook invocation failed.
HookDenied
Hook denied an action.
Fields
reason_code: HookReasonCodeTurnStarted
New turn started (calling LLM)
ReasoningDelta
Streaming reasoning/thinking from the model
ReasoningComplete
Reasoning/thinking complete for this block
TextDelta
Streaming text from the model
TextComplete
Text generation complete for this turn
ServerToolContent
Provider-executed tool content surfaced during a model turn.
AssistantImageAppended
Canonical assistant image block appended to transcript history.
Fields
image: AssistantImageEventToolCallRequested
Model requested a tool call
ToolResultReceived
Tool result received (injected into conversation)
TurnCompleted
Turn completed
ToolExecutionStarted
Starting tool execution
ToolExecutionCompleted
Tool execution completed
Fields
content: Vec<ContentBlock>Canonical typed tool-result content.
ToolExecutionTimedOut
Tool execution timed out
CompactionStarted
Context compaction started.
Fields
CompactionCompleted
Context compaction completed successfully.
Fields
CompactionFailed
Context compaction failed (non-fatal — agent continues with uncompacted history).
BudgetWarning
Budget warning (approaching limits)
Retrying
Retrying after error
SkillsResolved
Skills resolved for this turn.
SkillResolutionFailed
A skill reference could not be resolved.
Fields
reason: SkillResolutionFailureReasonStructured reason for the failure. Legacy payloads deserialize as unknown.
InteractionComplete
An interaction completed successfully (terminal event for tap subscribers).
Fields
interaction_id: InteractionIdInteractionCallbackPending
An interaction reached an external callback boundary and is waiting for tool results before the session can continue.
InteractionFailed
An interaction failed (terminal event for tap subscribers).
StreamTruncated
Some streaming events were dropped due to channel backpressure. Best-effort marker — the terminal event is authoritative.
ToolConfigChanged
Live tool configuration changed for this session.
Fields
payload: ToolConfigChangedPayloadBackgroundJobCompleted
A background shell job completed (or failed/cancelled/timed out).
Implementations§
Source§impl AgentEvent
impl AgentEvent
pub fn background_job_completed( job_id: impl Into<String>, display_name: impl Into<String>, terminal_status: BackgroundJobTerminalStatus, detail: impl Into<String>, ) -> Self
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 JsonSchema for AgentEvent
impl JsonSchema for AgentEvent
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more