Enum Event

Source
pub enum Event<StateT: AgentState = JsonValue> {
Show 24 variants TextMessageStart(TextMessageStartEvent), TextMessageContent(TextMessageContentEvent), TextMessageEnd(TextMessageEndEvent), TextMessageChunk(TextMessageChunkEvent), ThinkingTextMessageStart(ThinkingTextMessageStartEvent), ThinkingTextMessageContent(ThinkingTextMessageContentEvent), ThinkingTextMessageEnd(ThinkingTextMessageEndEvent), ToolCallStart(ToolCallStartEvent), ToolCallArgs(ToolCallArgsEvent), ToolCallEnd(ToolCallEndEvent), ToolCallChunk(ToolCallChunkEvent), ToolCallResult(ToolCallResultEvent), ThinkingStart(ThinkingStartEvent), ThinkingEnd(ThinkingEndEvent), StateSnapshot(StateSnapshotEvent<StateT>), StateDelta(StateDeltaEvent), MessagesSnapshot(MessagesSnapshotEvent), Raw(RawEvent), Custom(CustomEvent), RunStarted(RunStartedEvent), RunFinished(RunFinishedEvent), RunError(RunErrorEvent), StepStarted(StepStartedEvent), StepFinished(StepFinishedEvent),
}
Expand description

Union of all possible events in the Agent User Interaction Protocol. This enum represents the full set of events that can be exchanged between the agent and the client.

Variants§

§

TextMessageStart(TextMessageStartEvent)

Signals the start of a text message from an agent. Contains the message ID and role information.

§

TextMessageContent(TextMessageContentEvent)

Represents a chunk of content being added to an in-progress text message. Contains the message ID and the text delta to append.

§

TextMessageEnd(TextMessageEndEvent)

Signals the completion of a text message. Contains the message ID of the completed message.

§

TextMessageChunk(TextMessageChunkEvent)

Represents a complete or partial message chunk in a single event. May contain optional message ID, role, and delta information.

§

ThinkingTextMessageStart(ThinkingTextMessageStartEvent)

Signals the start of a thinking text message. Used for internal agent thought processes that should be displayed to the user.

§

ThinkingTextMessageContent(ThinkingTextMessageContentEvent)

Represents content being added to an in-progress thinking text message. Contains the delta text to append.

§

ThinkingTextMessageEnd(ThinkingTextMessageEndEvent)

Signals the completion of a thinking text message.

§

ToolCallStart(ToolCallStartEvent)

Signals the start of a tool call by the agent. Contains the tool call ID, name, and optional parent message ID.

§

ToolCallArgs(ToolCallArgsEvent)

Represents arguments being added to an in-progress tool call. Contains the tool call ID and argument data delta.

§

ToolCallEnd(ToolCallEndEvent)

Signals the completion of a tool call. Contains the tool call ID of the completed call.

§

ToolCallChunk(ToolCallChunkEvent)

Represents a complete or partial tool call in a single event. May contain optional tool call ID, name, parent message ID, and delta.

§

ToolCallResult(ToolCallResultEvent)

Represents the result of a completed tool call. Contains the message ID, tool call ID, content, and optional role.

§

ThinkingStart(ThinkingStartEvent)

Signals the start of a thinking process. Contains an optional title describing the thinking process.

§

ThinkingEnd(ThinkingEndEvent)

Signals the end of a thinking process.

§

StateSnapshot(StateSnapshotEvent<StateT>)

Provides a complete snapshot of the current state. Contains the full state as a JSON value.

§

StateDelta(StateDeltaEvent)

Provides incremental changes to the state. Contains a vector of delta operations to apply to the state.

§

MessagesSnapshot(MessagesSnapshotEvent)

Provides a complete snapshot of all messages. Contains a vector of all current messages.

§

Raw(RawEvent)

Wraps a raw event from an external source. Contains the original event as a JSON value and an optional source identifier.

§

Custom(CustomEvent)

Represents a custom event type not covered by the standard events. Contains a name identifying the custom event type and an associated value.

§

RunStarted(RunStartedEvent)

Signals the start of an agent run. Contains thread ID and run ID to identify the run.

§

RunFinished(RunFinishedEvent)

Signals the completion of an agent run. Contains thread ID, run ID, and optional result data.

§

RunError(RunErrorEvent)

Signals an error that occurred during an agent run. Contains error message and optional error code.

§

StepStarted(StepStartedEvent)

Signals the start of a step within an agent run. Contains the name of the step being started.

§

StepFinished(StepFinishedEvent)

Signals the completion of a step within an agent run. Contains the name of the completed step.

Implementations§

Source§

impl Event

Source

pub fn event_type(&self) -> EventType

Get the event type

Source

pub fn timestamp(&self) -> Option<f64>

Get the timestamp if available

Trait Implementations§

Source§

impl<StateT: Clone + AgentState> Clone for Event<StateT>

Source§

fn clone(&self) -> Event<StateT>

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<StateT: Debug + AgentState> Debug for Event<StateT>

Source§

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

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

impl<'de, StateT: AgentState> Deserialize<'de> for Event<StateT>

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<StateT: PartialEq + AgentState> PartialEq for Event<StateT>

Source§

fn eq(&self, other: &Event<StateT>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<StateT> Serialize for Event<StateT>
where StateT: Serialize + AgentState,

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<StateT: AgentState> StructuralPartialEq for Event<StateT>

Auto Trait Implementations§

§

impl<StateT> Freeze for Event<StateT>
where StateT: Freeze,

§

impl<StateT> RefUnwindSafe for Event<StateT>
where StateT: RefUnwindSafe,

§

impl<StateT> Send for Event<StateT>

§

impl<StateT> Sync for Event<StateT>

§

impl<StateT> Unpin for Event<StateT>
where StateT: Unpin,

§

impl<StateT> UnwindSafe for Event<StateT>
where StateT: 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<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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,