Skip to main content

AgentEvent

Enum AgentEvent 

Source
pub enum AgentEvent {
    ToolCall {
        call_id: String,
        name: String,
        arguments: String,
    },
    ToolResult {
        call_id: String,
        name: String,
        output: String,
        is_error: bool,
    },
    Delta(String),
    ReasoningDelta(String),
    ToolCallDelta {
        index: u64,
        json: String,
    },
    Message(String),
    ContextTrimmed {
        turns: usize,
        messages: usize,
        memory: MemoryStatus,
        judgement: JudgementStatus,
    },
    SchemaRejected {
        error: String,
        retrying: bool,
    },
    TurnStats {
        usage: TurnUsage,
        context_tokens: usize,
        budget_tokens: usize,
    },
}
Expand description

Progress notifications emitted while a prompt is being processed.

Variants§

§

ToolCall

Fields

§call_id: String

The model’s id for this call (#366). The result carries the same one, so a surface pairs them by identity instead of by “the newest row with this name” — which is wrong the moment a turn calls one tool twice, and moves a ✗ onto the call that worked.

§name: String
§arguments: String
§

ToolResult

Fields

§call_id: String
§name: String
§output: String
§is_error: bool
§

Delta(String)

A piece of assistant text, as generated. Only sent by streaming providers; may be followed by tool calls instead of a final Message.

§

ReasoningDelta(String)

A piece of reasoning/thinking text, as generated.

§

ToolCallDelta

A fragment of a tool call’s JSON arguments, as generated.

Fields

§index: u64
§json: String
§

Message(String)

Complete assistant text for this turn (always sent, streamed or not).

§

ContextTrimmed

Older turns were left out of the request to respect provider.context_budget_tokens. Sent when the amount changes, not on every call. memory reports what happened to the session’s stored memory and judgement what the bounded judgement pass did when the config asked for one — the two things that decide whether the system prompt carries something model-written or only the plain trim note.

Fields

§turns: usize
§messages: usize
§memory: MemoryStatus

What happened with the session’s stored memory (<id>.memory.json).

§judgement: JudgementStatus

What the bounded judgement pass did, when the config asked for it.

§

SchemaRejected

What one provider request cost, sent once per request (so a turn with tool calls reports each request, which is what the numbers are actually about). A reply that was not the shape the caller asked for. Sent before the single retry (retrying: true) and again if the retry missed too (false), so the readout shows a schema being argued with rather than a run that mysteriously took two turns.

Fields

§error: String
§retrying: bool
§

TurnStats

Fields

§context_tokens: usize

Estimated size of the prompt that was assembled: the conversation, the system prompt and any trim note. Compare with Self::TurnStats::budget_tokens.

§budget_tokens: usize

The rail this request was planned against: an explicit provider.context_budget_tokens, else [context] compact_at of the model’s window, else 0 when no window is known and no rail is in force. It is the number Agent::context_budget returns, so a front end that shows it shows what was used.

Trait Implementations§

Source§

impl Clone for AgentEvent

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for AgentEvent

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for AgentEvent

Source§

impl PartialEq for AgentEvent

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AgentEvent

Auto Trait Implementations§

§

impl Forget for AgentEvent

§

impl Freeze for AgentEvent
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze,

§

impl Move for AgentEvent

§

impl RefUnwindSafe for AgentEvent

§

impl Send for AgentEvent
where RawVecInner: Send,

§

impl Sync for AgentEvent
where RawVecInner: Sync,

§

impl Unpin for AgentEvent
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for AgentEvent

§

impl UnwindSafe for AgentEvent
where RawVecInner: UnwindSafe,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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: Sized + 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: Sized + 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 = !

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

fn try_from(value: U) -> Result<T, !>

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