Skip to main content

StreamEvent

Enum StreamEvent 

Source
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

Fields

§execution_id: Option<String>
§

TextDelta

Incremental text chunk

Fields

§delta: String
§

TextEnd

Text generation ended

Fields

§

StartStep

Step boundary start (AI SDK step concept)

Fields

§step_id: Option<String>
§

FinishStep

Step boundary end (AI SDK step concept)

Fields

§step_id: Option<String>
§

ToolInputStart

Tool input started

Fields

§tool_call_id: String
§tool_name: String
§

ToolInputDelta

Tool input delta (streaming input)

Fields

§tool_call_id: String
§input_text_delta: String
§

ToolInputAvailable

Tool input available (complete input)

Fields

§tool_call_id: String
§tool_name: String
§input: Value
§

ToolOutputAvailable

Tool output available

Fields

§tool_call_id: String
§output: Value
§

PermissionRequest

Human-in-the-loop permission request before tool execution

Fields

§execution_id: String
§tool_name: String
§arguments: Value
§policy: String
§timestamp: i64
§

Start

Stream/message start

Fields

§message_id: String
§execution_id: Option<String>
§

Finish

Stream/message finish

Fields

§message_id: String
§final_output: Option<String>
§

Error

Error occurred

Fields

§

ExecutionStart

Execution started

Fields

§execution_id: String
§parent_id: Option<String>
§parent_type: Option<String>
§timestamp: i64
§

ExecutionEnd

Execution completed successfully

Fields

§execution_id: String
§final_output: Option<String>
§duration_ms: u64
§timestamp: i64
§

ExecutionFailed

Execution failed

Fields

§execution_id: String
§timestamp: i64
§

ExecutionPaused

Execution paused

Fields

§execution_id: String
§reason: String
§timestamp: i64
§

ExecutionResumed

Execution resumed

Fields

§execution_id: String
§timestamp: i64
§

ExecutionCancelled

Execution cancelled

Fields

§execution_id: String
§reason: String
§timestamp: i64
§

StepStart

Step started (with full metadata)

Fields

§execution_id: String
§step_id: String
§step_type: String
§name: String
§timestamp: i64
§

StepEnd

Step completed

Fields

§execution_id: String
§step_id: String
§output: Option<String>
§duration_ms: u64
§timestamp: i64
§

StepFailed

Step failed

Fields

§execution_id: String
§step_id: String
§timestamp: i64
§

StepDiscovered

Step discovered during execution (dynamic discovery for agentic loops)

Fields

§execution_id: String
§step_id: String
§discovered_by: Option<String>
§source_type: String
§reason: String
§depth: u32
§timestamp: i64
§

ArtifactCreated

Artifact created

Fields

§execution_id: String
§step_id: String
§artifact_id: String
§artifact_type: String
§timestamp: i64
§

StateSnapshot

State snapshot captured

Fields

§execution_id: String
§step_id: Option<String>
§state: Value
§timestamp: i64
§

CheckpointSaved

Checkpoint saved (Goal-driven persistence)

Fields

§execution_id: String
§step_id: Option<String>
§checkpoint_id: String
§state_hash: String
§timestamp: i64
§

GoalEvaluated

Goal evaluated

Fields

§execution_id: String
§step_id: Option<String>
§goal_id: String
§status: String
§score: Option<f64>
§reason: Option<String>
§timestamp: i64
§

InboxMessage

Inbox message received (INV-INBOX-003: audit trail)

Fields

§execution_id: String
§message_id: String
§message_type: String
§timestamp: i64
§

PolicyDecision

Policy decision made (audit trail for tool policy evaluation)

Fields

§execution_id: String
§step_id: Option<String>
§tool_name: String
§decision: String
§reason: Option<String>
§timestamp: i64
§

LlmCallStart

LLM call started

Fields

§execution_id: String
§step_id: Option<String>
§callable_name: String
§history_length: usize
§timestamp: i64
§

LlmCallEnd

LLM call completed

Fields

§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

LLM call failed

Fields

§execution_id: String
§step_id: Option<String>
§error: String
§duration_ms: Option<u64>
§timestamp: i64
§

TokenUsageRecorded

Token usage recorded (cumulative)

Fields

§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

Memory recalled (retrieved from memory store)

Fields

§execution_id: String
§step_id: Option<String>
§query: String
§memories_count: usize
§duration_ms: u64
§session_id: Option<String>
§timestamp: i64
§

MemoryStored

Memory stored

Fields

§execution_id: String
§step_id: Option<String>
§memory_type: String
§session_id: Option<String>
§timestamp: i64
§

GuardrailEvaluated

Guardrail evaluated

Fields

§execution_id: String
§step_id: Option<String>
§guardrail_name: String
§decision: String
§reason: Option<String>
§score: Option<f64>
§timestamp: i64
§

ReasoningTrace

Reasoning trace captured

Fields

§execution_id: String
§step_id: Option<String>
§reasoning_type: String
§content: String
§truncated: Option<bool>
§timestamp: i64
§

ContextSnapshot

Context window snapshot

Fields

§execution_id: String
§step_id: Option<String>
§message_count: usize
§estimated_tokens: u32
§max_tokens: Option<u32>
§utilization_pct: f64
§timestamp: i64
§

FeedbackReceived

Feedback received

Fields

§execution_id: String
§step_id: Option<String>
§feedback_type: String
§score: Option<f64>
§comment: Option<String>
§user_id: Option<String>
§timestamp: i64

Implementations§

Source§

impl StreamEvent

Source

pub fn text_start(execution_id: Option<&ExecutionId>) -> Self

Create a text-start event

Source

pub fn text_delta(id: impl Into<String>, delta: impl Into<String>) -> Self

Create a text-delta event

Source

pub fn text_end(id: impl Into<String>) -> Self

Create a text-end event

Source

pub fn start( message_id: impl Into<String>, execution_id: Option<&ExecutionId>, ) -> Self

Create a start event

Source

pub fn finish( message_id: impl Into<String>, final_output: Option<String>, ) -> Self

Create a finish event

Source

pub fn error(error: ExecutionError) -> Self

Create an error event

Source

pub fn start_step(step_id: Option<&StepId>) -> Self

Create a start-step event (AI SDK)

Source

pub fn finish_step(step_id: Option<&StepId>) -> Self

Create a finish-step event (AI SDK)

Source

pub fn tool_input_start( tool_call_id: impl Into<String>, tool_name: impl Into<String>, ) -> Self

Create a tool-input-start event

Source

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

Source

pub fn tool_output_available( tool_call_id: impl Into<String>, output: Value, ) -> Self

Create a tool-output-available event

Source

pub fn permission_request( execution_id: &ExecutionId, tool_name: impl Into<String>, arguments: Value, policy: impl Into<String>, ) -> Self

Create a permission-request event

Source

pub fn execution_start(execution_id: &ExecutionId) -> Self

Create an execution-start event

Source

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

Source

pub fn execution_end( execution_id: &ExecutionId, final_output: Option<String>, duration_ms: u64, ) -> Self

Create an execution-end event

Source

pub fn execution_failed( execution_id: &ExecutionId, error: ExecutionError, ) -> Self

Create an execution-failed event

Source

pub fn execution_paused( execution_id: &ExecutionId, reason: impl Into<String>, ) -> Self

Create an execution-paused event

Source

pub fn execution_resumed(execution_id: &ExecutionId) -> Self

Create an execution-resumed event

Source

pub fn execution_cancelled( execution_id: &ExecutionId, reason: impl Into<String>, ) -> Self

Create an execution-cancelled event

Source

pub fn step_start( execution_id: &ExecutionId, step_id: &StepId, step_type: StepType, name: impl Into<String>, ) -> Self

Create a step-start event

Source

pub fn step_end( execution_id: &ExecutionId, step_id: &StepId, output: Option<String>, duration_ms: u64, ) -> Self

Create a step-end event

Source

pub fn step_failed( execution_id: &ExecutionId, step_id: &StepId, error: ExecutionError, ) -> Self

Create a step-failed event

Source

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).

Source

pub fn artifact_created( execution_id: &ExecutionId, step_id: &StepId, artifact_id: &ArtifactId, artifact_type: impl Into<String>, ) -> Self

Create an artifact-created event

Source

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.

Source

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.

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn is_control_event(&self) -> bool

Check if this is a control event (pause/resume/cancel)

Source

pub fn is_delta_event(&self) -> bool

Check if this is a delta/streaming event

Source

pub fn is_summary_event(&self) -> bool

Check if this is a summary-level event (not a delta)

Source

pub fn to_sse(&self) -> String

Serialize to SSE format: data: {...}\n\n

Source

pub fn done() -> String

Create a [DONE] termination signal

Trait Implementations§

Source§

impl Clone for StreamEvent

Source§

fn clone(&self) -> StreamEvent

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 StreamEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for StreamEvent

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 StreamEvent

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> 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> 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,