pub enum AgentEvent {
Token(String),
ToolCallStart {
id: String,
name: String,
},
ToolCallArgsDelta {
id: String,
delta: String,
},
ToolCall(ToolCallInfo),
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.ToolCallStart { id, name }— emitted the moment a tool call’s name is known during streaming, before any arguments have arrived. Allows UIs to show the tool name immediately. Only emitted in streaming mode.ToolCallArgsDelta { id, delta }— an incremental fragment of the tool call’s JSON arguments, emitted once per SSE chunk during streaming. Accumulate these to reconstruct the full arguments string. Only emitted in streaming mode.ToolCall(ToolCallInfo)— the model has requested a tool invocation, emitted once the full arguments are assembled (end of stream). In non-streaming mode this is the only tool-call event. Execution begins after this event.ToolResult(ToolCallResult)— a tool has finished executing. One event is emitted per call, in the same order as the correspondingToolCallevents.
Variants§
Token(String)
ToolCallStart
Emitted in streaming mode the instant a tool call’s id+name are known.
ToolCallArgsDelta
Emitted in streaming mode for each incremental fragment of the arguments JSON.
ToolCall(ToolCallInfo)
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