Skip to main content

zeroclaw_eval/
lib.rs

1//! Agent evaluation harness for ZeroClaw.
2
3pub mod case;
4pub mod grader;
5pub mod observer;
6pub mod record;
7pub mod replay;
8pub mod report;
9pub mod runner;
10pub mod tools;
11
12pub use case::{LlmTrace, ToolPayloadExpect, TraceExpects};
13pub use observer::RecordedCall;
14pub use record::RunRecord;
15pub use report::{CaseReport, SuiteReport};
16pub use runner::{run_case, run_suite};
17
18use std::str::FromStr;
19
20/// How an evaluation suite is executed.
21#[derive(Debug, Clone, Copy, PartialEq, Eq)]
22pub enum Mode {
23    /// Deterministic replay against scripted LLM responses — no network, no cost.
24    Replay,
25    /// Live execution against a real provider. Added in a later phase; the Phase 0
26    /// runner returns a clear error so the variant can already be parsed from the CLI.
27    Live,
28}
29
30impl FromStr for Mode {
31    type Err = anyhow::Error;
32
33    fn from_str(s: &str) -> Result<Self, Self::Err> {
34        match s.trim().to_ascii_lowercase().as_str() {
35            "replay" => Ok(Mode::Replay),
36            "live" => Ok(Mode::Live),
37            other => anyhow::bail!("unknown eval mode '{other}' (expected 'replay' or 'live')"),
38        }
39    }
40}
41
42impl std::fmt::Display for Mode {
43    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
44        f.write_str(match self {
45            Mode::Replay => "replay",
46            Mode::Live => "live",
47        })
48    }
49}