#[non_exhaustive]pub enum MessageChunk {
Delta(String),
ToolCall {
id: String,
name: String,
arguments: String,
},
ToolResult {
id: String,
name: String,
content: String,
},
Done(RunSummary),
Cancelled,
}Expand description
Message chunks for a streaming run — the streaming output of one run, sliced into pieces.
Delta / ToolCall / ToolResult are the streaming projection of the
message record (text the model is generating, recorded Assistant tool
requests, and returned ToolResult messages); Done / Cancelled are
terminal markers. These are not “events” — real events are the
application-level event abstraction
AgentEvent(trait, where each Agent implementation defines its own
event variants (the framework doesn’t anticipate them), flowing through
an event pipeline.
§Reasoning
Reasoning produces no chunks: reasoning deltas from thinking models do
not appear in this enum — matching on MessageChunk::Reasoning won’t
compile, and that’s intentional. To surface reasoning, attach an
EventChannel and subscribe to
ReActEvent::Reasoning, or consume
StreamEvent::Reasoning at
the Provider layer.
The enum carries #[non_exhaustive] (reserved for extension): matches
must include a wildcard arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Delta(String)
An increment of the reply text; increments within the same round are concatenated in order.
ToolCall
The model requested a tool call (the tool_calls of a recorded Assistant message).
Fields
id: StringThe id of this call, matching ToolCall::id
in the recorded memory; used to pair multiple calls of the same
tool within a round.
ToolResult
A tool execution completed (records a ToolResult message; on failure the content is the error text).
Fields
id: StringThe id of this execution, matching
Message::ToolResult in the
recorded memory; paired with the
ToolCall id in the same round.
Done(RunSummary)
The run ended normally; carries the execution summary for this run
(RunSummary); the stream produces no further chunks afterwards.
Cancelled
The run was cooperatively cancelled (via the CancellationToken passed to run/run_stream); terminal chunk, the stream produces no further chunks afterwards (no Done).
Trait Implementations§
Source§impl Clone for MessageChunk
impl Clone for MessageChunk
Source§fn clone(&self) -> MessageChunk
fn clone(&self) -> MessageChunk
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 MessageChunk
impl Debug for MessageChunk
impl Eq for MessageChunk
Source§impl PartialEq for MessageChunk
impl PartialEq for MessageChunk
impl StructuralPartialEq for MessageChunk
Auto Trait Implementations§
impl Freeze for MessageChunk
impl RefUnwindSafe for MessageChunk
impl Send for MessageChunk
impl Sync for MessageChunk
impl Unpin for MessageChunk
impl UnsafeUnpin for MessageChunk
impl UnwindSafe for MessageChunk
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.