pub struct TurnOutcome {
pub new_messages: Vec<Message>,
pub final_text: Option<String>,
pub finish_reason: FinishReason,
pub usage: TokenUsage,
pub last_prompt_tokens: u32,
pub llm_latency_ms: u64,
pub steps: usize,
pub tool_audits: HashMap<AuditKey, AuditMeta>,
pub turn: u32,
}Expand description
The result of executing one turn.
Returned to the Wrapper, which appends new_messages to its transcript, persists them, handles side effects, and tracks costs.
Fields§
§new_messages: Vec<Message>All messages produced during this turn (assistant responses + tool results). Does NOT include the input messages — only what the kernel generated.
final_text: Option<String>The final assistant text (convenience — also the last assistant msg in new_messages).
finish_reason: FinishReasonWhy the turn ended.
usage: TokenUsageCumulative token usage across all LLM calls in this turn.
last_prompt_tokens: u32prompt_tokens from the last LLM call only (not accumulated).
Use for cross-turn compaction; usage.prompt_tokens is the turn sum.
llm_latency_ms: u64Total LLM call latency in milliseconds (excluding tool execution time).
steps: usizeNumber of steps (LLM invocations) executed in this turn.
tool_audits: HashMap<AuditKey, AuditMeta>Goal-153: audit records for tool results, keyed by (turn, tool_call_id).
Passed through from RunInnerOutcome so the persistence layer
can emit MessageAppendedWithAudit for tool messages.
turn: u32Turn index (0-based) this outcome belongs to. Redundant with the key
prefix in tool_audits, but needed for emit_turn_messages lookup.