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: StringText 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: boolThe 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: ValueStructured evidence copied into the receipt (exit code, paths, status).
usage: UsageModel 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
impl ToolOutput
pub fn text(content: impl Into<String>) -> Self
pub fn error(content: impl Into<String>) -> Self
Sourcepub fn suspended(child: RunState) -> Self
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.