Skip to main content

AgentEvent

Enum AgentEvent 

Source
pub enum AgentEvent {
Show 19 variants ReasoningDelta(String), TextDelta(String), ToolStart { name: String, id: String, humanized: String, }, ToolBackgroundReady { id: String, request: Option<BackgroundRequest>, }, ToolResult { name: String, id: String, output: String, success: bool, elapsed_ms: u64, sources: Vec<Source>, }, ToolMedia { id: String, parts: Vec<ContentPart>, files: Vec<PathBuf>, }, Attachment { filename: String, media_type: String, data: Vec<u8>, }, AudioChunk { data: Vec<u8>, format: String, }, Status(String), Compacted(String), FileDiff { path: String, diff: Vec<DiffLine>, }, Usage(TokenUsage), Done(String), Cancelled, Error(String), ToolProgress { id: String, line: String, }, SpawnedEvent { id: String, task: String, model: Option<Model>, event: Box<AgentEvent>, }, Interrupted { tool_call_id: String, tool_name: String, output: String, payload: Option<Arc<dyn InterruptPayload>>, }, CompactionNeeded { reason: CompactionReason, },
}
Expand description

Events emitted by the agent turn loop as a Stream<Item = AgentEvent>.

Listeners (REPL, Slack, Telegram, etc.) receive these and render them incrementally. Consumers should handle all variants; unknown variants should be silently ignored so forward-compatibility is preserved.

Variants§

§

ReasoningDelta(String)

Incremental reasoning token (for models that surface internal thinking).

§

TextDelta(String)

Incremental text token from the assistant message.

§

ToolStart

A tool call has started execution.

Fields

§name: String
§humanized: String

Human-readable summary of the arguments (for display in TUI/cards).

§

ToolBackgroundReady

A running tool accepts a user request to continue in the background.

§

ToolResult

A tool has finished. The output may be truncated for display.

Fields

§name: String
§output: String
§success: bool
§elapsed_ms: u64
§sources: Vec<Source>
§

ToolMedia

Media a finished tool call returned or names on disk, sent just before its ToolResult so clients can show it.

Fields

§parts: Vec<ContentPart>

The non-text parts of the result, such as base64 images.

§files: Vec<PathBuf>

Local files the result shows.

§

Attachment

A file the model produced in its reply, such as a generated image.

Fields

§filename: String
§media_type: String
§data: Vec<u8>
§

AudioChunk

Incremental audio output chunk (raw bytes) for real-time playback.

Fields

§data: Vec<u8>
§format: String
§

Status(String)

Informational status message (compaction progress, retry attempts, etc.).

§

Compacted(String)

Conversation was compacted; payload is the summary text.

§

FileDiff

A file was modified by a tool.

Fields

§path: String
§

Usage(TokenUsage)

Token usage telemetry from the provider.

§

Done(String)

Final terminal event — processing complete with String as the full response.

§

Cancelled

The user cancelled the running turn.

§

Error(String)

Terminal error event.

§

ToolProgress

Incremental output from a running tool (e.g. stdout lines from bash).

Fields

§line: String
§

SpawnedEvent

A spawned agent produced an event while running in parallel.

Fields

§task: String
§model: Option<Model>
§

Interrupted

A tool requested interactive input. Emitted when a turn ends with TurnStatus::Interrupted. The caller should show the appropriate picker, inject the tool result, and resume.

Fields

§tool_call_id: String
§tool_name: String
§output: String
§

CompactionNeeded

The conversation needs compaction but auto_compact is off. The caller should compact and call agent.start() with AgentInput::Resume.

Fields

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<'de> Deserialize<'de> for AgentEvent

Source§

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 Serialize for AgentEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> 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