pub enum RunOutcome {
Success,
SuccessWithPendingToolCalls {
pending_tool_call_ids: Vec<ToolCallId>,
},
Interrupt {
interrupts: Vec<Interrupt>,
},
Cancelled,
}Expand description
How a run ended.
The field is optional on RUN_FINISHED: producers that predate the
interrupt protocol omit it entirely, which consumers must read as success.
Variants§
Success
The run completed.
SuccessWithPendingToolCalls
The run completed with frontend tool calls still awaiting answers.
This has the same wire discriminator as Self::Success. The separate
Rust variant keeps existing RunOutcome::Success callers working while
preserving the list supplied by an AG-UI 1.0 producer.
Fields
pending_tool_call_ids: Vec<ToolCallId>Tool calls to answer in the next run’s input, in call order.
Interrupt
The run is paused, waiting on the answers to interrupts.
Fields
interrupts: Vec<Interrupt>The pending requests. The protocol requires at least one; see
RunOutcome::validate.
Cancelled
The run was stopped before completion without an execution error.
Implementations§
Source§impl RunOutcome
impl RunOutcome
Sourcepub fn success_with_pending_tool_calls(
ids: impl IntoIterator<Item = impl Into<ToolCallId>>,
) -> Self
pub fn success_with_pending_tool_calls( ids: impl IntoIterator<Item = impl Into<ToolCallId>>, ) -> Self
A successful run with frontend tool calls to answer in the next input.
Sourcepub const fn is_interrupt(&self) -> bool
pub const fn is_interrupt(&self) -> bool
Whether the run is paused rather than finished.
Sourcepub const fn is_cancelled(&self) -> bool
pub const fn is_cancelled(&self) -> bool
Whether execution stopped without completing or failing.
Sourcepub fn pending_tool_call_ids(&self) -> &[ToolCallId]
pub fn pending_tool_call_ids(&self) -> &[ToolCallId]
Frontend tool calls still awaiting answers, in call order.
Sourcepub fn interrupts(&self) -> &[Interrupt]
pub fn interrupts(&self) -> &[Interrupt]
The pending interrupts, or an empty slice for a success outcome.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Checks that an interrupt outcome carries at least one interrupt and each ID is unique.
Deserializing does not enforce this, so that a stray empty array from a buggy producer surfaces as a protocol error you can log rather than as an unparseable event that kills the stream.
Trait Implementations§
Source§impl Clone for RunOutcome
impl Clone for RunOutcome
Source§impl ComposeSchema for RunOutcome
impl ComposeSchema for RunOutcome
Source§impl Debug for RunOutcome
impl Debug for RunOutcome
Source§impl<'de> Deserialize<'de> for RunOutcome
impl<'de> Deserialize<'de> for RunOutcome
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl JsonSchema for RunOutcome
impl JsonSchema for RunOutcome
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more