pub struct AgentRunOutput {
pub answer: String,
pub history: Vec<AgentMessage>,
pub total_iterations: usize,
pub total_completion_tokens: Option<u64>,
}Expand description
Output returned by a successful AgentLoopPort::run invocation.
Using a named struct instead of a bare tuple keeps call sites self-documenting and allows new fields to be added without breaking existing destructures.
Fields§
§answer: StringThe final answer text produced by the agent.
history: Vec<AgentMessage>Full accumulated conversation history: the caller-supplied messages plus every assistant and tool-result message appended during the loop, including the final assistant reply.
Safe to pass directly as the messages argument for the next turn.
total_iterations: usizeNumber of loop iterations consumed before the agent produced its final answer. Always ≥ 1. Useful for logging and telemetry.
total_completion_tokens: Option<u64>Total completion tokens generated across every iteration, summed from each response’s trailing usage report.
None when no upstream response reported usage — distinct from zero,
which would be a real (if strange) measurement. Feeds the benchmark
speed axis (completion tokens over wall-clock time).