pub struct RunFinishedEvent {
pub base: BaseEvent,
pub thread_id: ThreadId,
pub run_id: RunId,
pub result: Option<Value>,
pub outcome: Option<RunOutcome>,
pub usage: Option<Vec<TokenUsage>>,
}Expand description
The last event of a run that did not error.
“Finished” includes paused: an RunOutcome::Interrupt outcome means the
agent is waiting on human input and the run continues on the next request.
Fields§
§base: BaseEventTimestamp and raw provider event.
thread_id: ThreadIdThe conversation this run belongs to.
run_id: RunIdThe run that finished.
result: Option<Value>Agent-defined return value.
outcome: Option<RunOutcome>How the run ended. Absent from producers that predate the interrupt
protocol, which consumers read as success. A JSON null also reads as
absent, for producers that serialize None rather than omitting it.
usage: Option<Vec<TokenUsage>>Token usage, one entry per (provider, model) the run invoked.
Implementations§
Source§impl RunFinishedEvent
impl RunFinishedEvent
Sourcepub fn new(thread_id: impl Into<ThreadId>, run_id: impl Into<RunId>) -> Self
pub fn new(thread_id: impl Into<ThreadId>, run_id: impl Into<RunId>) -> Self
Finishes a run without declaring an outcome (legacy shape).
Sourcepub fn with_outcome(self, outcome: RunOutcome) -> Self
pub fn with_outcome(self, outcome: RunOutcome) -> Self
Sets the outcome.
Sourcepub fn with_result(self, result: impl Into<Value>) -> Self
pub fn with_result(self, result: impl Into<Value>) -> Self
Sets the return value.
Sourcepub fn with_usage(self, usage: impl Into<Vec<TokenUsage>>) -> Self
pub fn with_usage(self, usage: impl Into<Vec<TokenUsage>>) -> Self
Sets the token usage.
Trait Implementations§
Source§impl Clone for RunFinishedEvent
impl Clone for RunFinishedEvent
Source§fn clone(&self) -> RunFinishedEvent
fn clone(&self) -> RunFinishedEvent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ComposeSchema for RunFinishedEvent
impl ComposeSchema for RunFinishedEvent
Source§impl Debug for RunFinishedEvent
impl Debug for RunFinishedEvent
Source§impl Default for RunFinishedEvent
impl Default for RunFinishedEvent
Source§fn default() -> RunFinishedEvent
fn default() -> RunFinishedEvent
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for RunFinishedEvent
impl<'de> Deserialize<'de> for RunFinishedEvent
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<RunFinishedEvent> for Event
impl From<RunFinishedEvent> for Event
Source§fn from(payload: RunFinishedEvent) -> Self
fn from(payload: RunFinishedEvent) -> Self
Converts to this type from the input type.
Source§impl JsonSchema for RunFinishedEvent
impl JsonSchema for RunFinishedEvent
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for RunFinishedEvent
impl PartialEq for RunFinishedEvent
Source§fn eq(&self, other: &RunFinishedEvent) -> bool
fn eq(&self, other: &RunFinishedEvent) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for RunFinishedEvent
impl Serialize for RunFinishedEvent
impl StructuralPartialEq for RunFinishedEvent
Auto Trait Implementations§
impl Freeze for RunFinishedEvent
impl RefUnwindSafe for RunFinishedEvent
impl Send for RunFinishedEvent
impl Sync for RunFinishedEvent
impl Unpin for RunFinishedEvent
impl UnsafeUnpin for RunFinishedEvent
impl UnwindSafe for RunFinishedEvent
Blanket Implementations§
impl<T> AgentState for T
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
Mutably borrows from an owned value. Read more