pub enum ToolOutcome<T> {
Output(T),
Suspend(Suspension),
}Expand description
The Ok side of a tool call: either the tool’s normal output, or a
Suspension.
Suspension is modeled here, on the success side, and not as a
ToolError. A parked run is a normal, expected outcome
of a human-in-the-loop tool, not a failure, and the runtime loop treats the two
branches differently: an Output feeds the next model
turn, a Suspend records a Suspended event and parks the
run. Encoding that split in the type keeps the loop from having to guess.
The typed layer produces ToolOutcome<Self::Output>; the type-erased layer
produces ToolOutcome<serde_json::Value>. The Suspend
branch is identical across both, so a suspension crosses the erasure
boundary unchanged.
Variants§
Output(T)
The tool finished and produced this output.
Suspend(Suspension)
The tool asks to park the run and wait for the described input.
Trait Implementations§
Source§impl<T: Clone> Clone for ToolOutcome<T>
impl<T: Clone> Clone for ToolOutcome<T>
Source§fn clone(&self) -> ToolOutcome<T>
fn clone(&self) -> ToolOutcome<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more