pub enum AgentEvent {
Token(String),
ReasoningToken(String),
ToolCall(ToolCallChunk),
ToolResult(ToolCallResult),
}Expand description
Events emitted by AgentStream.
Each variant represents a distinct, self-contained event in the agent lifecycle:
Token(String)— a text fragment from the assistant. In streaming mode eachTokenis a single SSE delta; in non-streaming mode the full response text arrives as oneToken.ToolCall(id, name, delta)— a tool call fragment. Behaves exactly likeToken: in streaming mode one event is emitted per SSE chunk (first chunk has an emptydeltaand carries the tool name; subsequent chunks carry incremental argument JSON). In non-streaming mode a single event is emitted with the complete arguments string. Accumulatedeltavalues byidto reconstruct the full argument JSON. Execution begins after all chunks for a turn are delivered.ToolResult(ToolCallResult)— a tool has finished executing. One event is emitted per call, in the same order as the correspondingToolCallevents.
Variants§
Token(String)
ReasoningToken(String)
Emitted when the model produces reasoning/thinking content (e.g. deepseek-reasoner). In streaming mode this arrives token-by-token before the main reply.
ToolCall(ToolCallChunk)
ToolResult(ToolCallResult)
Trait Implementations§
Source§impl Clone for AgentEvent
impl Clone for AgentEvent
Source§fn clone(&self) -> AgentEvent
fn clone(&self) -> AgentEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AgentEvent
impl RefUnwindSafe for AgentEvent
impl Send for AgentEvent
impl Sync for AgentEvent
impl Unpin for AgentEvent
impl UnsafeUnpin for AgentEvent
impl UnwindSafe for AgentEvent
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
Mutably borrows from an owned value. Read more