Skip to main content

AgentStreamEvent

Enum AgentStreamEvent 

Source
pub enum AgentStreamEvent {
Show 15 variants RunStart { run_id: String, }, ContextInfo { estimated_tokens: usize, request_bytes: usize, context_limit: Option<u64>, }, ContextCompressed { original_tokens: usize, compressed_tokens: usize, strategy: String, messages_before: usize, messages_after: usize, }, RequestStart { step: u32, }, TextDelta { text: String, }, ToolCallStart { tool_name: String, tool_call_id: Option<String>, }, ToolCallDelta { delta: String, tool_call_id: Option<String>, }, ToolCallComplete { tool_name: String, tool_call_id: Option<String>, }, ToolExecuted { tool_name: String, tool_call_id: Option<String>, success: bool, error: Option<String>, }, ThinkingDelta { text: String, }, ResponseComplete { step: u32, }, OutputReady, RunComplete { run_id: String, }, Error { message: String, }, Cancelled { partial_text: Option<String>, partial_thinking: Option<String>, pending_tools: Vec<String>, },
}
Expand description

Events emitted during streaming.

Variants§

§

RunStart

Run started.

Fields

§run_id: String
§

ContextInfo

Context size information (emitted before each model request).

Fields

§estimated_tokens: usize

Estimated token count (~request_bytes / 4).

§request_bytes: usize

Raw request size in bytes (serialized messages + tools).

§context_limit: Option<u64>

Model’s context window limit (if known).

§

ContextCompressed

Context was compressed to fit within limits.

Fields

§original_tokens: usize

Token count before compression.

§compressed_tokens: usize

Token count after compression.

§strategy: String

Strategy used: “truncate” or “summarize”.

§messages_before: usize

Number of messages before compression.

§messages_after: usize

Number of messages after compression.

§

RequestStart

Model request started.

Fields

§step: u32
§

TextDelta

Text delta.

Fields

§text: String
§

ToolCallStart

Tool call started.

Fields

§tool_name: String
§tool_call_id: Option<String>
§

ToolCallDelta

Tool call arguments delta.

Fields

§delta: String
§tool_call_id: Option<String>
§

ToolCallComplete

Tool call completed (arguments fully received).

Fields

§tool_name: String
§tool_call_id: Option<String>
§

ToolExecuted

Tool executed.

Fields

§tool_name: String
§tool_call_id: Option<String>
§success: bool
§

ThinkingDelta

Thinking delta (for reasoning models).

Fields

§text: String
§

ResponseComplete

Model response completed.

Fields

§step: u32
§

OutputReady

Output ready.

§

RunComplete

Run completed.

Fields

§run_id: String
§

Error

Error occurred.

Fields

§message: String
§

Cancelled

Run was cancelled.

Fields

§partial_text: Option<String>

Partial text accumulated before cancellation.

§partial_thinking: Option<String>

Partial thinking content accumulated before cancellation.

§pending_tools: Vec<String>

Tool calls that were in progress when cancelled.

Trait Implementations§

Source§

impl Clone for AgentStreamEvent

Source§

fn clone(&self) -> AgentStreamEvent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AgentStreamEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more