pub enum StreamEvent {
Show 39 variants
TextStart {
id: String,
execution_id: Option<String>,
},
TextDelta {
id: String,
delta: String,
},
TextEnd {
id: String,
},
StartStep {
step_id: Option<String>,
},
FinishStep {
step_id: Option<String>,
},
ToolInputStart {
tool_call_id: String,
tool_name: String,
},
ToolInputDelta {
tool_call_id: String,
input_text_delta: String,
},
ToolInputAvailable {
tool_call_id: String,
tool_name: String,
input: Value,
},
ToolOutputAvailable {
tool_call_id: String,
output: Value,
},
PermissionRequest {
execution_id: String,
tool_name: String,
arguments: Value,
policy: String,
timestamp: i64,
},
Start {
message_id: String,
execution_id: Option<String>,
},
Finish {
message_id: String,
final_output: Option<String>,
},
Error {
error: ExecutionError,
},
ExecutionStart {
execution_id: String,
parent_id: Option<String>,
parent_type: Option<String>,
timestamp: i64,
},
ExecutionEnd {
execution_id: String,
final_output: Option<String>,
duration_ms: u64,
timestamp: i64,
},
ExecutionFailed {
execution_id: String,
error: ExecutionError,
timestamp: i64,
},
ExecutionPaused {
execution_id: String,
reason: String,
timestamp: i64,
},
ExecutionResumed {
execution_id: String,
timestamp: i64,
},
ExecutionCancelled {
execution_id: String,
reason: String,
timestamp: i64,
},
StepStart {
execution_id: String,
step_id: String,
step_type: String,
name: String,
timestamp: i64,
},
StepEnd {
execution_id: String,
step_id: String,
output: Option<String>,
duration_ms: u64,
timestamp: i64,
},
StepFailed {
execution_id: String,
step_id: String,
error: ExecutionError,
timestamp: i64,
},
StepDiscovered {
execution_id: String,
step_id: String,
discovered_by: Option<String>,
source_type: String,
reason: String,
depth: u32,
timestamp: i64,
},
ArtifactCreated {
execution_id: String,
step_id: String,
artifact_id: String,
artifact_type: String,
timestamp: i64,
},
StateSnapshot {
execution_id: String,
step_id: Option<String>,
state: Value,
timestamp: i64,
},
CheckpointSaved {
execution_id: String,
step_id: Option<String>,
checkpoint_id: String,
state_hash: String,
timestamp: i64,
},
GoalEvaluated {
execution_id: String,
step_id: Option<String>,
goal_id: String,
status: String,
score: Option<f64>,
reason: Option<String>,
timestamp: i64,
},
InboxMessage {
execution_id: String,
message_id: String,
message_type: String,
timestamp: i64,
},
PolicyDecision {
execution_id: String,
step_id: Option<String>,
tool_name: String,
decision: String,
reason: Option<String>,
timestamp: i64,
},
LlmCallStart {
execution_id: String,
step_id: Option<String>,
callable_name: String,
model: Option<String>,
history_length: usize,
timestamp: i64,
},
LlmCallEnd {
execution_id: String,
step_id: Option<String>,
duration_ms: u64,
prompt_tokens: Option<u32>,
completion_tokens: Option<u32>,
total_tokens: Option<u32>,
timestamp: i64,
},
LlmCallFailed {
execution_id: String,
step_id: Option<String>,
error: String,
duration_ms: Option<u64>,
timestamp: i64,
},
TokenUsageRecorded {
execution_id: String,
step_id: Option<String>,
prompt_tokens: u32,
completion_tokens: u32,
total_tokens: u32,
cumulative_tokens: u64,
cost_usd: Option<f64>,
cumulative_cost_usd: Option<f64>,
timestamp: i64,
},
MemoryRecalled {
execution_id: String,
step_id: Option<String>,
query: String,
memories_count: usize,
duration_ms: u64,
session_id: Option<String>,
timestamp: i64,
},
MemoryStored {
execution_id: String,
step_id: Option<String>,
memory_type: String,
session_id: Option<String>,
timestamp: i64,
},
GuardrailEvaluated {
execution_id: String,
step_id: Option<String>,
guardrail_name: String,
decision: String,
reason: Option<String>,
score: Option<f64>,
timestamp: i64,
},
ReasoningTrace {
execution_id: String,
step_id: Option<String>,
reasoning_type: String,
content: String,
truncated: Option<bool>,
timestamp: i64,
},
ContextSnapshot {
execution_id: String,
step_id: Option<String>,
message_count: usize,
estimated_tokens: u32,
max_tokens: Option<u32>,
utilization_pct: f64,
timestamp: i64,
},
FeedbackReceived {
execution_id: String,
step_id: Option<String>,
feedback_type: String,
score: Option<f64>,
comment: Option<String>,
user_id: Option<String>,
timestamp: i64,
},
}Expand description
StreamEvent - All streaming events with data-* prefix
Events are tagged for direct SSE serialization. UI adapters can consume these directly or transform as needed.
Variants§
TextStart
Text generation started
TextDelta
Incremental text chunk
TextEnd
Text generation ended
StartStep
Step boundary start (AI SDK step concept)
FinishStep
Step boundary end (AI SDK step concept)
ToolInputStart
Tool input started
ToolInputDelta
Tool input delta (streaming input)
ToolInputAvailable
Tool input available (complete input)
ToolOutputAvailable
Tool output available
PermissionRequest
Human-in-the-loop permission request before tool execution
Start
Stream/message start
Finish
Stream/message finish
Error
Error occurred
Fields
error: ExecutionErrorExecutionStart
Execution started
ExecutionEnd
Execution completed successfully
ExecutionFailed
Execution failed
ExecutionPaused
Execution paused
ExecutionResumed
Execution resumed
ExecutionCancelled
Execution cancelled
StepStart
Step started (with full metadata)
StepEnd
Step completed
StepFailed
Step failed
StepDiscovered
Step discovered during execution (dynamic discovery for agentic loops)
Fields
ArtifactCreated
Artifact created
Fields
StateSnapshot
State snapshot captured
CheckpointSaved
Checkpoint saved (Goal-driven persistence)
Fields
GoalEvaluated
Goal evaluated
Fields
InboxMessage
Inbox message received (INV-INBOX-003: audit trail)
PolicyDecision
Policy decision made (audit trail for tool policy evaluation)
Fields
LlmCallStart
LLM call started
Fields
LlmCallEnd
LLM call completed
Fields
LlmCallFailed
LLM call failed
Fields
TokenUsageRecorded
Token usage recorded (cumulative)
Fields
MemoryRecalled
Memory recalled (retrieved from memory store)
Fields
MemoryStored
Memory stored
Fields
GuardrailEvaluated
Guardrail evaluated
Fields
ReasoningTrace
Reasoning trace captured
Fields
ContextSnapshot
Context window snapshot
Fields
FeedbackReceived
Feedback received
Implementations§
Source§impl StreamEvent
impl StreamEvent
Sourcepub fn text_start(execution_id: Option<&ExecutionId>) -> Self
pub fn text_start(execution_id: Option<&ExecutionId>) -> Self
Create a text-start event
Sourcepub fn text_delta(id: impl Into<String>, delta: impl Into<String>) -> Self
pub fn text_delta(id: impl Into<String>, delta: impl Into<String>) -> Self
Create a text-delta event
Sourcepub fn start(
message_id: impl Into<String>,
execution_id: Option<&ExecutionId>,
) -> Self
pub fn start( message_id: impl Into<String>, execution_id: Option<&ExecutionId>, ) -> Self
Create a start event
Sourcepub fn finish(
message_id: impl Into<String>,
final_output: Option<String>,
) -> Self
pub fn finish( message_id: impl Into<String>, final_output: Option<String>, ) -> Self
Create a finish event
Sourcepub fn error(error: ExecutionError) -> Self
pub fn error(error: ExecutionError) -> Self
Create an error event
Sourcepub fn start_step(step_id: Option<&StepId>) -> Self
pub fn start_step(step_id: Option<&StepId>) -> Self
Create a start-step event (AI SDK)
Sourcepub fn finish_step(step_id: Option<&StepId>) -> Self
pub fn finish_step(step_id: Option<&StepId>) -> Self
Create a finish-step event (AI SDK)
Sourcepub fn tool_input_start(
tool_call_id: impl Into<String>,
tool_name: impl Into<String>,
) -> Self
pub fn tool_input_start( tool_call_id: impl Into<String>, tool_name: impl Into<String>, ) -> Self
Create a tool-input-start event
Sourcepub fn tool_input_available(
tool_call_id: impl Into<String>,
tool_name: impl Into<String>,
input: Value,
) -> Self
pub fn tool_input_available( tool_call_id: impl Into<String>, tool_name: impl Into<String>, input: Value, ) -> Self
Create a tool-input-available event
Sourcepub fn tool_output_available(
tool_call_id: impl Into<String>,
output: Value,
) -> Self
pub fn tool_output_available( tool_call_id: impl Into<String>, output: Value, ) -> Self
Create a tool-output-available event
Sourcepub fn permission_request(
execution_id: &ExecutionId,
tool_name: impl Into<String>,
arguments: Value,
policy: impl Into<String>,
) -> Self
pub fn permission_request( execution_id: &ExecutionId, tool_name: impl Into<String>, arguments: Value, policy: impl Into<String>, ) -> Self
Create a permission-request event
Sourcepub fn execution_start(execution_id: &ExecutionId) -> Self
pub fn execution_start(execution_id: &ExecutionId) -> Self
Create an execution-start event
Sourcepub fn execution_start_with_parent(
execution_id: &ExecutionId,
parent_id: impl Into<String>,
parent_type: impl Into<String>,
) -> Self
pub fn execution_start_with_parent( execution_id: &ExecutionId, parent_id: impl Into<String>, parent_type: impl Into<String>, ) -> Self
Create an execution-start event with parent
Sourcepub fn execution_end(
execution_id: &ExecutionId,
final_output: Option<String>,
duration_ms: u64,
) -> Self
pub fn execution_end( execution_id: &ExecutionId, final_output: Option<String>, duration_ms: u64, ) -> Self
Create an execution-end event
Sourcepub fn execution_failed(
execution_id: &ExecutionId,
error: ExecutionError,
) -> Self
pub fn execution_failed( execution_id: &ExecutionId, error: ExecutionError, ) -> Self
Create an execution-failed event
Sourcepub fn execution_paused(
execution_id: &ExecutionId,
reason: impl Into<String>,
) -> Self
pub fn execution_paused( execution_id: &ExecutionId, reason: impl Into<String>, ) -> Self
Create an execution-paused event
Sourcepub fn execution_resumed(execution_id: &ExecutionId) -> Self
pub fn execution_resumed(execution_id: &ExecutionId) -> Self
Create an execution-resumed event
Sourcepub fn execution_cancelled(
execution_id: &ExecutionId,
reason: impl Into<String>,
) -> Self
pub fn execution_cancelled( execution_id: &ExecutionId, reason: impl Into<String>, ) -> Self
Create an execution-cancelled event
Sourcepub fn step_start(
execution_id: &ExecutionId,
step_id: &StepId,
step_type: StepType,
name: impl Into<String>,
) -> Self
pub fn step_start( execution_id: &ExecutionId, step_id: &StepId, step_type: StepType, name: impl Into<String>, ) -> Self
Create a step-start event
Sourcepub fn step_end(
execution_id: &ExecutionId,
step_id: &StepId,
output: Option<String>,
duration_ms: u64,
) -> Self
pub fn step_end( execution_id: &ExecutionId, step_id: &StepId, output: Option<String>, duration_ms: u64, ) -> Self
Create a step-end event
Sourcepub fn step_failed(
execution_id: &ExecutionId,
step_id: &StepId,
error: ExecutionError,
) -> Self
pub fn step_failed( execution_id: &ExecutionId, step_id: &StepId, error: ExecutionError, ) -> Self
Create a step-failed event
Sourcepub fn step_discovered(
execution_id: &ExecutionId,
step_id: &StepId,
discovered_by: Option<&StepId>,
source_type: StepSourceType,
reason: impl Into<String>,
depth: u32,
) -> Self
pub fn step_discovered( execution_id: &ExecutionId, step_id: &StepId, discovered_by: Option<&StepId>, source_type: StepSourceType, reason: impl Into<String>, depth: u32, ) -> Self
Create a step-discovered event
Emitted when a new step is dynamically discovered during agentic execution. This enables full audit trails for discovered steps (doc-30 Resource Discovery).
Sourcepub fn artifact_created(
execution_id: &ExecutionId,
step_id: &StepId,
artifact_id: &ArtifactId,
artifact_type: impl Into<String>,
) -> Self
pub fn artifact_created( execution_id: &ExecutionId, step_id: &StepId, artifact_id: &ArtifactId, artifact_type: impl Into<String>, ) -> Self
Create an artifact-created event
Sourcepub fn inbox_message(
execution_id: &ExecutionId,
message_id: &str,
message_type: InboxMessageType,
) -> Self
pub fn inbox_message( execution_id: &ExecutionId, message_id: &str, message_type: InboxMessageType, ) -> Self
Create an inbox-message event for audit trail
§Invariant INV-INBOX-003
All inbox messages MUST emit events for audit trail.
Sourcepub fn policy_decision_allow(
execution_id: &ExecutionId,
step_id: Option<&StepId>,
tool_name: impl Into<String>,
) -> Self
pub fn policy_decision_allow( execution_id: &ExecutionId, step_id: Option<&StepId>, tool_name: impl Into<String>, ) -> Self
Create a policy-decision event for audit trail
Records tool policy evaluation decisions for compliance and audit.
Sourcepub fn policy_decision_deny(
execution_id: &ExecutionId,
step_id: Option<&StepId>,
tool_name: impl Into<String>,
reason: impl Into<String>,
) -> Self
pub fn policy_decision_deny( execution_id: &ExecutionId, step_id: Option<&StepId>, tool_name: impl Into<String>, reason: impl Into<String>, ) -> Self
Create a policy-decision deny event
Sourcepub fn policy_decision_warn(
execution_id: &ExecutionId,
step_id: Option<&StepId>,
tool_name: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn policy_decision_warn( execution_id: &ExecutionId, step_id: Option<&StepId>, tool_name: impl Into<String>, message: impl Into<String>, ) -> Self
Create a policy-decision warn event
Sourcepub fn llm_call_start(
execution_id: &ExecutionId,
step_id: Option<&StepId>,
callable_name: impl Into<String>,
model: Option<String>,
history_length: usize,
) -> Self
pub fn llm_call_start( execution_id: &ExecutionId, step_id: Option<&StepId>, callable_name: impl Into<String>, model: Option<String>, history_length: usize, ) -> Self
Create an llm-call-start event
Sourcepub fn llm_call_end(
execution_id: &ExecutionId,
step_id: Option<&StepId>,
duration_ms: u64,
prompt_tokens: Option<u32>,
completion_tokens: Option<u32>,
total_tokens: Option<u32>,
) -> Self
pub fn llm_call_end( execution_id: &ExecutionId, step_id: Option<&StepId>, duration_ms: u64, prompt_tokens: Option<u32>, completion_tokens: Option<u32>, total_tokens: Option<u32>, ) -> Self
Create an llm-call-end event
Sourcepub fn llm_call_failed(
execution_id: &ExecutionId,
step_id: Option<&StepId>,
error: impl Into<String>,
duration_ms: Option<u64>,
) -> Self
pub fn llm_call_failed( execution_id: &ExecutionId, step_id: Option<&StepId>, error: impl Into<String>, duration_ms: Option<u64>, ) -> Self
Create an llm-call-failed event
Sourcepub fn token_usage_recorded(
execution_id: &ExecutionId,
step_id: Option<&StepId>,
prompt_tokens: u32,
completion_tokens: u32,
cumulative_tokens: u64,
cost_usd: Option<f64>,
cumulative_cost_usd: Option<f64>,
) -> Self
pub fn token_usage_recorded( execution_id: &ExecutionId, step_id: Option<&StepId>, prompt_tokens: u32, completion_tokens: u32, cumulative_tokens: u64, cost_usd: Option<f64>, cumulative_cost_usd: Option<f64>, ) -> Self
Create a token-usage-recorded event
Sourcepub fn memory_recalled(
execution_id: &ExecutionId,
step_id: Option<&StepId>,
query: impl Into<String>,
memories_count: usize,
duration_ms: u64,
session_id: Option<String>,
) -> Self
pub fn memory_recalled( execution_id: &ExecutionId, step_id: Option<&StepId>, query: impl Into<String>, memories_count: usize, duration_ms: u64, session_id: Option<String>, ) -> Self
Create a memory-recalled event
Sourcepub fn memory_stored(
execution_id: &ExecutionId,
step_id: Option<&StepId>,
memory_type: impl Into<String>,
session_id: Option<String>,
) -> Self
pub fn memory_stored( execution_id: &ExecutionId, step_id: Option<&StepId>, memory_type: impl Into<String>, session_id: Option<String>, ) -> Self
Create a memory-stored event
Sourcepub fn guardrail_evaluated(
execution_id: &ExecutionId,
step_id: Option<&StepId>,
guardrail_name: impl Into<String>,
decision: impl Into<String>,
reason: Option<String>,
score: Option<f64>,
) -> Self
pub fn guardrail_evaluated( execution_id: &ExecutionId, step_id: Option<&StepId>, guardrail_name: impl Into<String>, decision: impl Into<String>, reason: Option<String>, score: Option<f64>, ) -> Self
Create a guardrail-evaluated event
Sourcepub fn reasoning_trace(
execution_id: &ExecutionId,
step_id: Option<&StepId>,
reasoning_type: impl Into<String>,
content: impl Into<String>,
truncated: Option<bool>,
) -> Self
pub fn reasoning_trace( execution_id: &ExecutionId, step_id: Option<&StepId>, reasoning_type: impl Into<String>, content: impl Into<String>, truncated: Option<bool>, ) -> Self
Create a reasoning-trace event
Sourcepub fn context_window_snapshot(
execution_id: &ExecutionId,
step_id: Option<&StepId>,
message_count: usize,
estimated_tokens: u32,
max_tokens: Option<u32>,
utilization_pct: f64,
) -> Self
pub fn context_window_snapshot( execution_id: &ExecutionId, step_id: Option<&StepId>, message_count: usize, estimated_tokens: u32, max_tokens: Option<u32>, utilization_pct: f64, ) -> Self
Create a context-window-snapshot event
Sourcepub fn feedback_received(
execution_id: &ExecutionId,
step_id: Option<&StepId>,
feedback_type: impl Into<String>,
score: Option<f64>,
comment: Option<String>,
user_id: Option<String>,
) -> Self
pub fn feedback_received( execution_id: &ExecutionId, step_id: Option<&StepId>, feedback_type: impl Into<String>, score: Option<f64>, comment: Option<String>, user_id: Option<String>, ) -> Self
Create a feedback-received event
Sourcepub fn is_control_event(&self) -> bool
pub fn is_control_event(&self) -> bool
Check if this is a control event (pause/resume/cancel)
Sourcepub fn is_delta_event(&self) -> bool
pub fn is_delta_event(&self) -> bool
Check if this is a delta/streaming event
Sourcepub fn is_summary_event(&self) -> bool
pub fn is_summary_event(&self) -> bool
Check if this is a summary-level event (not a delta)
Trait Implementations§
Source§impl Clone for StreamEvent
impl Clone for StreamEvent
Source§fn clone(&self) -> StreamEvent
fn clone(&self) -> StreamEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more