Skip to main content

AgUiEvent

Enum AgUiEvent 

Source
pub enum AgUiEvent {
Show 18 variants RunStarted { run_id: String, thread_id: Option<String>, timestamp: u64, }, StepStarted { run_id: String, step_name: String, timestamp: u64, }, StepFinished { run_id: String, step_name: String, timestamp: u64, }, RunFinished { run_id: String, timestamp: u64, }, RunError { run_id: String, code: String, message: String, timestamp: u64, }, TextMessageStart { run_id: String, message_id: String, role: String, timestamp: u64, }, TextMessageContent { run_id: String, message_id: String, delta: String, timestamp: u64, }, TextMessageEnd { run_id: String, message_id: String, timestamp: u64, }, ToolCallStart { run_id: String, tool_call_id: String, tool_name: String, timestamp: u64, }, ToolCallArgs { run_id: String, tool_call_id: String, delta: String, timestamp: u64, }, ToolCallEnd { run_id: String, tool_call_id: String, timestamp: u64, }, ToolCallResult { run_id: String, tool_call_id: String, result: Value, timestamp: u64, }, StateSnapshot { run_id: String, snapshot: Value, timestamp: u64, }, StateDelta { run_id: String, delta: Value, timestamp: u64, }, MessagesSnapshot { run_id: String, messages: Value, timestamp: u64, }, Raw { run_id: String, source: String, payload: Value, timestamp: u64, }, Custom { run_id: String, name: String, payload: Value, timestamp: u64, }, Unknown,
}
Expand description

AG-UI event emitted by an agent run.

Events are tagged by the type field using the AG-UI protocol’s screaming-snake-case naming (e.g. RUN_STARTED, TEXT_MESSAGE_CONTENT). All variants carry a timestamp (ms since epoch) and a run_id for correlation.

Variants§

§

RunStarted

A new agent run has started.

Fields

§run_id: String

Unique identifier for this run (UUID or opaque token).

§thread_id: Option<String>

Conversation/thread the run belongs to.

§timestamp: u64

Milliseconds since the Unix epoch.

§

StepStarted

A logical step inside a run has started (e.g. prefetch, tool_loop).

Fields

§run_id: String

Run identifier.

§step_name: String

Human-readable step name, e.g. "prefetch", "compaction", "tool_loop".

§timestamp: u64

Milliseconds since the Unix epoch.

§

StepFinished

A logical step inside a run has finished.

Fields

§run_id: String

Run identifier.

§step_name: String

Step name that matches a prior STEP_STARTED.

§timestamp: u64

Milliseconds since the Unix epoch.

§

RunFinished

The run has completed successfully.

Fields

§run_id: String

Run identifier.

§timestamp: u64

Milliseconds since the Unix epoch.

§

RunError

The run has terminated with an error.

Fields

§run_id: String

Run identifier.

§code: String

Short machine-readable error code.

§message: String

Human-readable error message.

§timestamp: u64

Milliseconds since the Unix epoch.

§

TextMessageStart

Start of a streamed assistant text message.

Fields

§run_id: String

Run identifier.

§message_id: String

Unique identifier for the streamed message (used to correlate CONTENT chunks).

§role: String

Author role (typically "assistant").

§timestamp: u64

Milliseconds since the Unix epoch.

§

TextMessageContent

Streamed text delta for an open TEXT_MESSAGE_START.

Fields

§run_id: String

Run identifier.

§message_id: String

Message identifier that matches a prior TEXT_MESSAGE_START.

§delta: String

Delta text to append. Clients should concatenate deltas in order.

§timestamp: u64

Milliseconds since the Unix epoch.

§

TextMessageEnd

End of a streamed assistant text message.

Fields

§run_id: String

Run identifier.

§message_id: String

Message identifier that matches a prior TEXT_MESSAGE_START.

§timestamp: u64

Milliseconds since the Unix epoch.

§

ToolCallStart

The agent has decided to invoke a tool.

Fields

§run_id: String

Run identifier.

§tool_call_id: String

Unique identifier for this tool call (used to correlate ARGS/END/RESULT).

§tool_name: String

Name of the tool being invoked.

§timestamp: u64

Milliseconds since the Unix epoch.

§

ToolCallArgs

Streamed tool-call argument delta (typically used when arguments are generated token-by-token by the LLM).

Fields

§run_id: String

Run identifier.

§tool_call_id: String

Tool call identifier that matches a prior TOOL_CALL_START.

§delta: String

Delta of the serialized JSON arguments.

§timestamp: u64

Milliseconds since the Unix epoch.

§

ToolCallEnd

Tool invocation has completed (arguments fully formed, execution dispatched).

Fields

§run_id: String

Run identifier.

§tool_call_id: String

Tool call identifier that matches a prior TOOL_CALL_START.

§timestamp: u64

Milliseconds since the Unix epoch.

§

ToolCallResult

Tool execution produced a result.

Fields

§run_id: String

Run identifier.

§tool_call_id: String

Tool call identifier that matches a prior TOOL_CALL_START.

§result: Value

Result payload as an opaque JSON value (provider-specific).

§timestamp: u64

Milliseconds since the Unix epoch.

§

StateSnapshot

Full snapshot of the agent’s shared state.

Fields

§run_id: String

Run identifier.

§snapshot: Value

Full state document as an opaque JSON value.

§timestamp: u64

Milliseconds since the Unix epoch.

§

StateDelta

Incremental state update as a JSON Patch (RFC 6902) document.

Fields

§run_id: String

Run identifier.

§delta: Value

JSON Patch array describing the delta.

§timestamp: u64

Milliseconds since the Unix epoch.

§

MessagesSnapshot

Full snapshot of the current message list.

Fields

§run_id: String

Run identifier.

§messages: Value

Messages as an opaque JSON array.

§timestamp: u64

Milliseconds since the Unix epoch.

§

Raw

Raw, provider-specific event passthrough. Clients that understand the source may consume payload; generic clients should ignore it.

Fields

§run_id: String

Run identifier.

§source: String

Provider label, e.g. "gemini", "groq", "copilot_headless".

§payload: Value

Raw payload as an opaque JSON value.

§timestamp: u64

Milliseconds since the Unix epoch.

§

Custom

Custom application-defined event. Useful for channel-specific affordances (e.g. Telegram typing indicator hints, web UI tooltips).

Fields

§run_id: String

Run identifier.

§name: String

Custom event name.

§payload: Value

Arbitrary payload as an opaque JSON value.

§timestamp: u64

Milliseconds since the Unix epoch.

§

Unknown

Forward-compat catch-all for wire-format events whose type field does not match any variant above.

When a newer AG-UI implementation adds an event kind the current embacle release does not know about, deserialization still succeeds and produces this variant. Producers never emit it; consumers typically ignore it. The original type string and payload are dropped because serde’s #[serde(other)] mandates a unit variant — callers that need the raw JSON should deserialize into serde_json::Value first and hand-dispatch.

Implementations§

Source§

impl AgUiEvent

Source

pub const fn kind(&self) -> AgUiEventKind

Return the discriminant kind without cloning the event.

Source

pub fn run_id(&self) -> &str

Return the run identifier this event belongs to, or "" for the forward-compat Self::Unknown variant which has no recoverable fields.

Source

pub fn run_started(run_id: impl Into<String>, thread_id: Option<&str>) -> Self

Convenience constructor for RUN_STARTED.

Source

pub fn step_started( run_id: impl Into<String>, step_name: impl Into<String>, ) -> Self

Convenience constructor for STEP_STARTED.

Source

pub fn step_finished( run_id: impl Into<String>, step_name: impl Into<String>, ) -> Self

Convenience constructor for STEP_FINISHED.

Source

pub fn run_finished(run_id: impl Into<String>) -> Self

Convenience constructor for RUN_FINISHED.

Source

pub fn run_error( run_id: impl Into<String>, code: impl Into<String>, message: impl Into<String>, ) -> Self

Convenience constructor for RUN_ERROR.

Source

pub fn tool_call_start( run_id: impl Into<String>, tool_call_id: impl Into<String>, tool_name: impl Into<String>, ) -> Self

Convenience constructor for TOOL_CALL_START.

Source

pub fn tool_call_result( run_id: impl Into<String>, tool_call_id: impl Into<String>, result: Value, ) -> Self

Convenience constructor for TOOL_CALL_RESULT.

Trait Implementations§

Source§

impl Clone for AgUiEvent

Source§

fn clone(&self) -> AgUiEvent

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 AgUiEvent

Source§

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

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

impl<'de> Deserialize<'de> for AgUiEvent

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 AgUiEvent

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoMaybeUndefined<T> for T

Source§

impl<T> IntoOption<T> for T

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

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