zeroclaw_eval/record.rs
1//! The artifact produced by running one eval case — what graders score.
2
3use zeroclaw_api::model_provider::ConversationMessage;
4
5use crate::observer::RecordedCall;
6
7/// Everything captured from a single agent run, ready for grading.
8pub struct RunRecord {
9 /// The agent's final text response for the case.
10 pub final_response: String,
11 /// The full conversation trajectory (messages + tool calls + tool results).
12 pub history: Vec<ConversationMessage>,
13 /// Every dispatched tool call with its arguments and result, in call order.
14 /// This creates the canonical dispatch fact: names, success, arguments, and
15 /// results are derived from this list rather than copied into parallel fields.
16 pub tool_calls: Vec<RecordedCall>,
17 /// Accumulated input tokens reported by the provider.
18 pub input_tokens: u64,
19 /// Accumulated output tokens reported by the provider.
20 pub output_tokens: u64,
21}
22
23impl RunRecord {
24 /// Names of tools actually dispatched, in call order.
25 pub fn tool_names(&self) -> Vec<&str> {
26 self.tool_calls
27 .iter()
28 .map(|call| call.name.as_str())
29 .collect()
30 }
31
32 /// Whether every dispatched tool call succeeded (vacuously true if none).
33 pub fn all_tools_succeeded(&self) -> bool {
34 self.tool_calls.iter().all(|call| call.success)
35 }
36}