pub enum AgentStreamEvent<Output = Value> {
Show 14 variants
RunStart {
run_id: String,
step: u32,
},
RequestStart {
step: u32,
},
TextDelta {
content: String,
part_index: usize,
},
ToolCallStart {
name: String,
tool_call_id: Option<String>,
index: usize,
},
ToolCallDelta {
args_delta: String,
index: usize,
},
ToolCallComplete {
name: String,
args: Value,
index: usize,
},
ToolResult {
name: String,
result: Value,
success: bool,
index: usize,
},
ThinkingDelta {
content: String,
index: usize,
},
PartialOutput {
output: Output,
},
ResponseComplete {
response: ModelResponse,
},
UsageUpdate {
usage: RequestUsage,
},
FinalOutput {
output: Output,
},
RunComplete {
run_id: String,
total_steps: u32,
},
Error {
message: String,
recoverable: bool,
},
}Expand description
Events emitted during streaming.
Variants§
RunStart
Run started.
RequestStart
Model request started.
TextDelta
Text delta received.
ToolCallStart
Tool call started.
Fields
ToolCallDelta
Tool call arguments delta.
ToolCallComplete
Tool call completed.
ToolResult
Tool result received.
Fields
ThinkingDelta
Thinking delta (for Claude extended thinking).
PartialOutput
Partial output available (validated incrementally).
Fields
§
output: OutputThe partial output.
ResponseComplete
Model response complete.
Fields
§
response: ModelResponseThe complete response.
UsageUpdate
Usage update.
Fields
§
usage: RequestUsageCurrent usage.
FinalOutput
Final output ready.
Fields
§
output: OutputThe final output.
RunComplete
Run complete.
Error
Error occurred.
Implementations§
Source§impl<Output> AgentStreamEvent<Output>
impl<Output> AgentStreamEvent<Output>
Sourcepub fn text_delta(content: impl Into<String>, part_index: usize) -> Self
pub fn text_delta(content: impl Into<String>, part_index: usize) -> Self
Create a text delta event.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if this is the final event.
Sourcepub fn map_output<U, F>(self, f: F) -> AgentStreamEvent<U>where
F: FnOnce(Output) -> U,
pub fn map_output<U, F>(self, f: F) -> AgentStreamEvent<U>where
F: FnOnce(Output) -> U,
Map the output type.
Trait Implementations§
Source§impl<Output: Clone> Clone for AgentStreamEvent<Output>
impl<Output: Clone> Clone for AgentStreamEvent<Output>
Source§fn clone(&self) -> AgentStreamEvent<Output>
fn clone(&self) -> AgentStreamEvent<Output>
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 moreSource§impl<Output: Debug> Debug for AgentStreamEvent<Output>
impl<Output: Debug> Debug for AgentStreamEvent<Output>
Source§impl<'de, Output> Deserialize<'de> for AgentStreamEvent<Output>where
Output: Deserialize<'de>,
impl<'de, Output> Deserialize<'de> for AgentStreamEvent<Output>where
Output: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<Output: Display> Display for AgentStreamEvent<Output>
impl<Output: Display> Display for AgentStreamEvent<Output>
Auto Trait Implementations§
impl<Output> Freeze for AgentStreamEvent<Output>where
Output: Freeze,
impl<Output> RefUnwindSafe for AgentStreamEvent<Output>where
Output: RefUnwindSafe,
impl<Output> Send for AgentStreamEvent<Output>where
Output: Send,
impl<Output> Sync for AgentStreamEvent<Output>where
Output: Sync,
impl<Output> Unpin for AgentStreamEvent<Output>where
Output: Unpin,
impl<Output> UnwindSafe for AgentStreamEvent<Output>where
Output: UnwindSafe,
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