#[non_exhaustive]pub struct RunOutcome { /* private fields */ }Expand description
The result of one finished run: the answer and how it was reached.
text is the answer as text; output is the raw final value.
Read it through the getters.
Implementations§
Source§impl RunOutcome
impl RunOutcome
Sourcepub fn text(&self) -> &str
pub fn text(&self) -> &str
Returns the answer as text: a string output as is, any other
output as JSON text.
The same text run returns.
Sourcepub fn output(&self) -> &Value
pub fn output(&self) -> &Value
Returns the final output value of the run. A string for plain agents, a JSON value for typed output. Never null for a finished run.
Sourcepub fn usage(&self) -> Usage
pub fn usage(&self) -> Usage
Returns the tokens and cost the run used, summed over calls. Cost is in millionths of a US dollar. Includes eval and repair calls.
Sourcepub fn model_calls(&self) -> u32
pub fn model_calls(&self) -> u32
Returns how many model calls the run made. Retried calls count once per attempt that reached the model. At least one for a finished run.
Sourcepub fn run_id(&self) -> RunId
pub fn run_id(&self) -> RunId
Returns the id of the run, for resume and logs.
Unique per run.
Stable across checkpoints.
Sourcepub fn messages(&self) -> &[Message]
pub fn messages(&self) -> &[Message]
Returns the whole conversation, input first. Includes tool calls and tool results. The last message is the answer.
Sourcepub fn trace_path(&self) -> Option<&Path>
pub fn trace_path(&self) -> Option<&Path>
Returns the trace file this run was written to.
None when tracing is off or goes to a custom sink.
Every run of one built agent shares the file.