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) -> StreamEvent
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 moreAuto Trait Implementations§
impl Freeze for StreamEvent
impl RefUnwindSafe for StreamEvent
impl Send for StreamEvent
impl Sync for StreamEvent
impl Unpin for StreamEvent
impl UnsafeUnpin for StreamEvent
impl UnwindSafe for StreamEvent
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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