Enum StreamEvent
pub enum StreamEvent {
TextDelta(StreamChunk),
ThinkingDelta(String),
ReasoningFinalized(String),
ToolCall(ToolCall),
PreExecutedToolCall {
name: String,
args: String,
},
PreExecutedToolResult {
name: String,
output: String,
},
Usage(TokenUsage),
Final,
}Expand description
Structured events emitted by model_provider streaming APIs. This extends plain text chunk streaming with explicit tool-call signals so agent loops can preserve native tool semantics without parsing payload text.
Variants§
TextDelta(StreamChunk)
Text delta from the assistant.
ThinkingDelta(String)
Transient, human-readable thinking progress. Surfaced to the user (gated by the runtime visibility policy) and never persisted into reasoning_content.
ReasoningFinalized(String)
Durable, replay-only finalized reasoning payload (signed thinking
blocks in the provider’s history-replay representation). Appended to
ChatResponse::reasoning_content for the next provider request and
never surfaced as user-visible progress.
ToolCall(ToolCall)
Structured tool call emitted during streaming.
PreExecutedToolCall
A tool call that was already executed by the model_provider (e.g. Claude Code proxy). Emitted for observability only — not re-executed by the agent’s dispatcher.
PreExecutedToolResult
The result of a pre-executed tool call.
Usage(TokenUsage)
Token usage reported by the provider, typically just before StreamEvent::Final.
Providers that do not surface usage in streaming responses simply omit this event.
Final
Stream has completed.
Implementations§
Source§impl StreamEvent
impl StreamEvent
pub fn from_chunk(chunk: StreamChunk) -> Self
Trait Implementations§
Source§impl Clone for StreamEvent
impl Clone for StreamEvent
Source§fn clone(&self) -> StreamEvent
fn clone(&self) -> StreamEvent
1.0.0 (const: unstable) · §fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more