Skip to main content

Outcome

Struct Outcome 

Source
#[non_exhaustive]
pub struct Outcome { pub agent: Agent, pub session: Option<String>, pub text: String, pub usage: Usage, pub stop: Stop, pub rate_limit: Option<RateLimit>, pub exit_code: i32, pub stderr: String, pub unparsed: usize, pub first_unparsed: Option<String>, }
Expand description

The result of one completed run.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§agent: Agent

Which agent produced it.

§session: Option<String>

The native session id, when the run had or produced one. This is the handle a later turn resumes with.

§text: String

The assistant’s final text.

§usage: Usage

Token and cost accounting.

§stop: Stop

Why it stopped.

§rate_limit: Option<RateLimit>

The last quota signal seen, if any.

§exit_code: i32

The process exit code.

§stderr: String

Raw stderr, kept for diagnostics and capped at crate::MAX_CAPTURE.

§unparsed: usize

How many output lines could not be parsed, with the first as a sample.

Agents interleave banners with their JSON, so a non-zero count is not automatically a fault. It becomes one when paired with an empty Self::text, which is what a vendor changing its output shape looks like from here. See Outcome::looks_like_a_format_change.

§first_unparsed: Option<String>

The first line that failed to parse.

Implementations§

Source§

impl Outcome

Source

pub fn is_ok(&self) -> bool

Whether the run finished cleanly: a zero exit and no error result.

Source

pub fn looks_like_a_format_change(&self) -> bool

Whether this run looks like the agent changed its output format.

The signature is a process that exited successfully while every line it printed was unreadable: the CLI is healthy and this crate’s parser is not. Worth logging loudly, because the alternative symptom is a successful run that mysteriously returns nothing.

Source§

impl Outcome

Reported by an agent that exited cleanly but said nothing useful.

Source

pub fn is_empty(&self) -> bool

Whether the agent produced any answer at all.

Trait Implementations§

Source§

impl Clone for Outcome

Source§

fn clone(&self) -> Outcome

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 Outcome

Source§

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

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

impl<'de> Deserialize<'de> for Outcome

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 PartialEq for Outcome

Source§

fn eq(&self, other: &Outcome) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Outcome

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 StructuralPartialEq for Outcome

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.