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
StepStarted
A logical step inside a run has started (e.g. prefetch, tool_loop).
Fields
StepFinished
A logical step inside a run has finished.
Fields
RunFinished
The run has completed successfully.
RunError
The run has terminated with an error.
Fields
TextMessageStart
Start of a streamed assistant text message.
Fields
TextMessageContent
Streamed text delta for an open TEXT_MESSAGE_START.
Fields
TextMessageEnd
End of a streamed assistant text message.
Fields
ToolCallStart
The agent has decided to invoke a tool.
Fields
ToolCallArgs
Streamed tool-call argument delta (typically used when arguments are generated token-by-token by the LLM).
Fields
ToolCallEnd
Tool invocation has completed (arguments fully formed, execution dispatched).
Fields
ToolCallResult
Tool execution produced a result.
Fields
StateSnapshot
Full snapshot of the agent’s shared state.
Fields
StateDelta
Incremental state update as a JSON Patch (RFC 6902) document.
Fields
MessagesSnapshot
Full snapshot of the current message list.
Fields
Raw
Raw, provider-specific event passthrough. Clients that understand the
source may consume payload; generic clients should ignore it.
Fields
Custom
Custom application-defined event. Useful for channel-specific affordances (e.g. Telegram typing indicator hints, web UI tooltips).
Fields
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
impl AgUiEvent
Sourcepub const fn kind(&self) -> AgUiEventKind
pub const fn kind(&self) -> AgUiEventKind
Return the discriminant kind without cloning the event.
Sourcepub fn run_id(&self) -> &str
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.
Sourcepub fn run_started(run_id: impl Into<String>, thread_id: Option<&str>) -> Self
pub fn run_started(run_id: impl Into<String>, thread_id: Option<&str>) -> Self
Convenience constructor for RUN_STARTED.
Sourcepub fn step_started(
run_id: impl Into<String>,
step_name: impl Into<String>,
) -> Self
pub fn step_started( run_id: impl Into<String>, step_name: impl Into<String>, ) -> Self
Convenience constructor for STEP_STARTED.
Sourcepub fn step_finished(
run_id: impl Into<String>,
step_name: impl Into<String>,
) -> Self
pub fn step_finished( run_id: impl Into<String>, step_name: impl Into<String>, ) -> Self
Convenience constructor for STEP_FINISHED.
Sourcepub fn run_finished(run_id: impl Into<String>) -> Self
pub fn run_finished(run_id: impl Into<String>) -> Self
Convenience constructor for RUN_FINISHED.
Sourcepub fn run_error(
run_id: impl Into<String>,
code: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn run_error( run_id: impl Into<String>, code: impl Into<String>, message: impl Into<String>, ) -> Self
Convenience constructor for RUN_ERROR.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AgUiEvent
impl<'de> Deserialize<'de> for AgUiEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for AgUiEvent
impl RefUnwindSafe for AgUiEvent
impl Send for AgUiEvent
impl Sync for AgUiEvent
impl Unpin for AgUiEvent
impl UnsafeUnpin for AgUiEvent
impl UnwindSafe for AgUiEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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