Skip to main content

ToolOutput

Struct ToolOutput 

Source
pub struct ToolOutput {
    pub content: String,
    pub images: Vec<Image>,
    pub is_error: bool,
    pub details: Value,
    pub usage: Usage,
    pub trust: Option<SourceTrust>,
    pub finish: Option<Finish>,
    pub suspended: Option<Box<RunState>>,
}
Expand description

What a tool hands back to the model, plus structured details for receipts.

Fields§

§content: String

Text the model will read.

§images: Vec<Image>

Images the model will see with the text (a screenshot, a rendered page, an image file the tool read).

§is_error: bool

The tool ran but the outcome is a failure the model should react to (non-zero exit, HTTP 4xx, no match). Recorded as a failed receipt.

§details: Value

Structured evidence copied into the receipt (exit code, paths, status).

§usage: Usage

Model usage spent inside the tool (for example a sub-agent). The loop adds it to the run’s usage, so budgets cover delegated work.

§trust: Option<SourceTrust>

Overrides Tool::source_trust for this result (for example a fetch tool that knows this particular URL is the owner’s own).

§finish: Option<Finish>

End the run after this call’s batch (see ToolOutput::finish).

§suspended: Option<Box<RunState>>

A paused child run: this call has no result yet, and the run pauses with it (see ToolOutput::suspended).

Implementations§

Source§

impl ToolOutput

Source

pub fn text(content: impl Into<String>) -> Self

Source

pub fn error(content: impl Into<String>) -> Self

Source

pub fn suspended(child: RunState) -> Self

The child this call started is interrupted: pause the calling run too, with child saved in its crate::Pending. The answer reaches the tool through Tool::resume_child. Only a tool whose Tool::suspends is true may return this, and child must be interrupted; anything else is a failed call.

Source

pub fn with_usage(self, usage: Usage) -> Self

Source

pub fn with_images(self, images: impl IntoIterator<Item = Image>) -> Self

Source

pub fn with_details(self, details: Value) -> Self

Source

pub fn with_trust(self, trust: SourceTrust) -> Self

Source

pub fn finish(self, finish: Finish) -> Self

End the run once the batch this call belongs to completes. Every call in the batch still runs and gets its receipt; if several calls finish, the first in call order wins.

Trait Implementations§

Source§

impl Clone for ToolOutput

Source§

fn clone(&self) -> Self

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 ToolOutput

Source§

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

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

impl<'de> Deserialize<'de> for ToolOutput

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 ToolOutput

Source§

fn eq(&self, other: &Self) -> 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 ToolOutput

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 ToolOutput

Auto Trait Implementations§

§

impl Forget for ToolOutput

§

impl Freeze for ToolOutput

§

impl Move for ToolOutput

§

impl RefUnwindSafe for ToolOutput

§

impl Send for ToolOutput
where RawVecInner: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send, BoxRaw<RunState>: Send,

§

impl Sync for ToolOutput
where RawVecInner: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync, BoxRaw<RunState>: Sync,

§

impl Unpin for ToolOutput
where *const u8 is !null: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin, Box<RunState>: Unpin,

§

impl UnsafeUnpin for ToolOutput

§

impl UnwindSafe for ToolOutput
where RawVecInner: UnwindSafe, BTreeMap<String, Value>: UnwindSafe, BoxRaw<RunState>: UnwindSafe,

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.