Skip to main content

AgentEvent

Enum AgentEvent 

Source
pub enum AgentEvent {
Show 14 variants RunStarted {}, MessageDelta { message_id: MessageId, content_index: u32, delta: EventDelta, }, ToolCallRequested { tool_call_id: ToolCallId, tool_name: String, arguments: Value, }, ApprovalRequested { approval_id: ApprovalId, tool_call_id: ToolCallId, capabilities: Vec<String>, resources: Vec<String>, expires_at: ProtocolTimestamp, }, ToolExecutionProgress { tool_call_id: ToolCallId, message: String, completed_units: u64, total_units: Option<u64>, }, ToolExecutionPreview { tool_call_id: ToolCallId, presentation: ToolPresentation, }, HostedToolStarted { tool_call_id: ToolCallId, tool_name: String, }, HostedToolCompleted { tool_call_id: ToolCallId, tool_name: String, arguments: Value, outcome: HostedToolOutcome, source_count: u32, }, ModelRetryScheduled { message_id: MessageId, attempt: u32, max_retries: u32, delay_ms: u64, }, ModelRetryStarted { message_id: MessageId, attempt: u32, max_retries: u32, }, TurnCheckpointed {}, SessionCompacted { summary_message_id: MessageId, compacted_through_message_id: MessageId, }, SessionForked { source_branch_id: BranchId, branch_id: BranchId, from_message_id: MessageId, }, RunFinished { status: RunStatus, usage: Option<Usage>, cost: Option<ExactCost>, },
}
Expand description

A provider- and UI-neutral observable runtime event.

Variants§

§

RunStarted

A run started.

§

MessageDelta

A streaming message fragment was produced.

Fields

§message_id: MessageId

Message receiving the fragment.

§content_index: u32

Zero-based content-block index.

§delta: EventDelta

Bounded content fragment.

§

ToolCallRequested

A complete tool call was requested by the model.

Fields

§tool_call_id: ToolCallId

Canonical tool-call identifier.

§tool_name: String

Registered tool name.

§arguments: Value

Validated JSON object arguments.

§

ApprovalRequested

A tool call requires approval.

Fields

§approval_id: ApprovalId

Approval request identifier.

§tool_call_id: ToolCallId

Tool call awaiting approval.

§capabilities: Vec<String>

Bounded required capability names.

§resources: Vec<String>

Bounded affected resource identifiers.

§expires_at: ProtocolTimestamp

Decision deadline.

§

ToolExecutionProgress

Non-durable tool progress suitable for UI display.

Fields

§tool_call_id: ToolCallId

Tool call reporting progress.

§message: String

English technical progress diagnostic.

§completed_units: u64

Completed work units.

§total_units: Option<u64>

Total work units when known.

§

ToolExecutionPreview

A trusted tool computed a bounded preview before a pending approval.

Fields

§tool_call_id: ToolCallId

Tool call the preview describes.

§presentation: ToolPresentation

Typed UI-only data produced from the tool’s current workspace view.

§

HostedToolStarted

A provider-hosted tool started inside the active model response.

Fields

§tool_call_id: ToolCallId

Kernel-owned activity identifier.

§tool_name: String

Stable hosted tool name.

§

HostedToolCompleted

A provider-hosted tool completed inside the active model response.

Fields

§tool_call_id: ToolCallId

Kernel-owned activity identifier.

§tool_name: String

Stable hosted tool name.

§arguments: Value

Validated provider-neutral arguments, without continuation state.

§outcome: HostedToolOutcome

Normalized terminal outcome.

§source_count: u32

Number of normalized sources retained in the eventual durable block.

§

ModelRetryScheduled

A retryable model failure is waiting before another provider request.

Fields

§message_id: MessageId

Ephemeral assistant message whose failed partial output is discarded.

§attempt: u32

One-based retry number.

§max_retries: u32

Maximum retry count, excluding the initial request.

§delay_ms: u64

Selected bounded delay in milliseconds.

§

ModelRetryStarted

A scheduled retry completed its backoff and is starting another request.

Fields

§message_id: MessageId

Ephemeral assistant message reused by the next attempt.

§attempt: u32

One-based retry number.

§max_retries: u32

Maximum retry count, excluding the initial request.

§

TurnCheckpointed

A turn reached a durable checkpoint.

§

SessionCompacted

Session history was compacted through a source message.

Fields

§summary_message_id: MessageId

Summary message introduced by compaction.

§compacted_through_message_id: MessageId

Last source message covered by the summary.

§

SessionForked

A new branch was forked from an existing branch/message.

Fields

§source_branch_id: BranchId

Source branch identifier.

§branch_id: BranchId

New branch identifier.

§from_message_id: MessageId

Message at the fork point.

§

RunFinished

A run reached a terminal state.

Fields

§status: RunStatus

Terminal run status.

§usage: Option<Usage>

Provider-neutral usage when available.

§cost: Option<ExactCost>

Exact billable cost when available.

Implementations§

Source§

impl AgentEvent

Source

pub const fn event_type(&self) -> AgentEventType

Returns the stable event discriminator.

Trait Implementations§

Source§

impl Clone for AgentEvent

Source§

fn clone(&self) -> AgentEvent

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

Source§

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

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

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

Inequality operator !=. 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
Source§

impl StructuralPartialEq for AgentEvent

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, 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 = 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.