Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ You write the runner that calls your system, the cases, and the judges that scor

```sh
eac list # the datasets and cases eac found
eac offline run --dataset chat # seed, collect and judge every case in the chat dataset
eac offline run --dataset chat # seed, execute and judge every case in the chat dataset

# Alternatively, run each step separately
eac offline seed --dataset chat # seed (create fixtures) into a new run
eac offline collect # collect (run each case) for the latest run
eac offline judge # judge (judge output of collect) for the latest run
eac offline execute # execute (run each case) for the latest run
eac offline judge # judge (judge output of execute) for the latest run
```

[`examples/basic-example-python`](examples/basic-example-python) is a fuller
Expand Down Expand Up @@ -112,7 +112,7 @@ Online evals judge what your system already did in production, so nothing is re-
eac online run --dataset chat --judge greets --since 24h # collect the last 24h of production runs and judge them

# Alternatively, run each step separately
eac online collect --dataset chat --since 24h # collect production runs as cases into a new run
eac online execute --dataset chat --since 24h # execute (collect production runs as cases) into a new run
eac online judge --judge greets # judge the latest collected run
```

Expand Down
8 changes: 4 additions & 4 deletions core/PROTOCOL.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ Each phase sends its own methods, so a worker only needs to answer the ones for

```
offline seed discover → args.validate → seed.setup
offline collect case.run
offline execute case.run
offline judge case.judge
offline run all three phases, then seed.teardown for uncached seeds (compare does the same for each arm)
offline prune discover → seed.teardown
online collect discover → args.validate → online.collect
online execute discover → args.validate → online.execute
online judge args.validate → online.judge
list, catalog discover
auth discover → args.validate → credentials.check → credentials.login
Expand All @@ -71,7 +71,7 @@ These types show up in the params and results of many methods:
```jsonc
// Case: an offline case, or a production run collected for online judging
{"name": "get_dsn", "input": {}, "expected_output": {},
"output": {}, "conversation_id": "abc", // what the system produced: set by online.collect, and by eac when judging
"output": {}, "conversation_id": "abc", // what the system produced: set by online.execute, and by eac when judging
"splits": ["smoke"], "enabled": true, // disabled cases run only when picked by name or split
"seeds": [Seed], "judges": ["regex"]} // judge names are for display; judges run in the worker

Expand Down Expand Up @@ -164,7 +164,7 @@ Scores one case's output and returns `{"scores": [Score]}`.

**Agent traces.** Without a `trace`, the judges may fetch the agent run's trace, looking it up by the case's `conversation_id`, the dataset's `agent` and when the case ran (`started_at` and `ended_at`, RFC 3339). Give every judge the same trace, and return it as `"trace"`, with the LLM usage it records as `"trace_metrics"` (a Metrics). eac saves it under `traces/` in the run and sends it back as `trace` when the run is judged again. Its metrics replace the ones `case.run` returned. A failed fetch should only warn, since judges can run without a trace.

### `online.collect`
### `online.execute`

Params: `{"dataset", "since", "until", "limit", "args"}`.

Expand Down
10 changes: 5 additions & 5 deletions core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The CLI drives every run, but your code runs in separate SDK processes. The CLI
┌────────────────────────┐ ┌──────────────────────────────────┐
│ eac CLI │ ── requests ─► │ workers python -m eac.worker │
│ │ ◄─ responses ─ │ your runners, judges and seeds │
│ seed → collect → judge │ └──────────────────────────────────┘
│ seed → execute → judge │ └──────────────────────────────────┘
└────────────┬───────────┘
│ each phase's results
▼
Expand Down Expand Up @@ -65,15 +65,15 @@ Offline evals run evals on cases you wrote, in three phases:

```
eac offline seed pick the cases, create a run, set up its seeds -> seeds.json
eac offline collect run the system under test on each case & collect results -> outputs/
eac offline execute run the system under test on each case & save its output -> outputs/
eac offline judge score each output -> scores/ traces/ results/ summary.json
```

**Seed**

Picks the cases, creates the run and sets up each case's seeds (fixtures like a project or a database). Cases that share a seed share one setup, and cached seeds are reused from earlier runs, or loaded from the seed's own cache. The run id is printed to stdout so CI can pass it to the later phases.

**Collect**
**Execute**

Sends each case to a worker along with its seeds and a conversation id for tagging the agent's run. The worker calls the dataset's runner and eac saves whatever it returns as the case's output.

Expand All @@ -88,11 +88,11 @@ Runs the case's judges on its output, and saves the scores, results and a summar
Online evals judge what your system already did in production. There are no seeds, so there are only two phases:

```
eac online collect collect production runs from a time window as cases -> outputs/
eac online execute collect production runs from a time window as cases -> outputs/
eac online judge score each case with the picked judges -> scores/ traces/ results/ summary.json
```

**Collect**
**Execute**

Asks each dataset's online runner for the production runs in a time window (`--since`, `--window-end`, `--limit`), as cases with their outputs, and saves each output.

Expand Down
12 changes: 6 additions & 6 deletions core/src/cli/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ pub enum SchemaKind {
pub enum Offline {
/// Set up fixtures -> seeds.json, printing the new run's id
Seed(SeedArgs),
/// Collect outputs by running the system under test on a seeded run -> outputs/
Collect(PhaseArgs),
/// Execute a seeded run by running the system under test on each case -> outputs/
Execute(PhaseArgs),
/// Score recorded outputs -> scores/, results/, summary.json
Judge(PhaseArgs),
/// Seed, collect and judge in one go
/// Seed, execute and judge in one go
Run(RunArgs),
/// Run a dataset comparison, one run per arm with shared seeds
Compare(CompareArgs),
Expand All @@ -73,10 +73,10 @@ pub enum Offline {
#[derive(Subcommand)]
pub enum Online {
/// Collect production runs from a window as cases -> outputs/, printing the new run's id
Collect(OnlineCollectArgs),
Execute(OnlineExecuteArgs),
/// Score a collected run's cases with --judge -> scores/, results/, summary.json
Judge(OnlineJudgeArgs),
/// Collect and judge in one go
/// Execute and judge in one go
Run(OnlineRunArgs),
}

Expand Down Expand Up @@ -188,7 +188,7 @@ pub struct PruneArgs {
}

#[derive(Args)]
pub struct OnlineCollectArgs {
pub struct OnlineExecuteArgs {
#[command(flatten)]
pub scope: Scope,
#[command(flatten)]
Expand Down
4 changes: 2 additions & 2 deletions core/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ pub fn dispatch(command: Command) -> Result<()> {
Command::Schema { which } => commands::schema(which),
Command::Offline(Offline::Seed(a)) if a.teardown => offline::teardown(&a),
Command::Offline(Offline::Seed(a)) => offline::seed(&a),
Command::Offline(Offline::Collect(a)) => offline::collect(&a),
Command::Offline(Offline::Execute(a)) => offline::execute(&a),
Command::Offline(Offline::Judge(a)) => offline::judge(&a),
Command::Offline(Offline::Run(a)) => offline::run(&a),
Command::Offline(Offline::Compare(a)) => commands::compare(&a),
Command::Offline(Offline::Shards(a)) => offline::shards(&a),
Command::Offline(Offline::Prune(a)) => offline::prune(&a),
Command::Online(Online::Collect(a)) => online::collect(&a),
Command::Online(Online::Execute(a)) => online::execute(&a),
Command::Online(Online::Judge(a)) => online::judge(&a),
Command::Online(Online::Run(a)) => online::run(&a),
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/commands/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::slice;

use anyhow::{bail, Context, Result};

use super::runs::{check_judge_args, create_run, seed_collect_judge};
use super::runs::{check_judge_args, create_run, seed_execute_judge};
use crate::cli::CompareArgs;
use crate::eac::{select, ArmRef, Comparison, Dataset, Discovered, Engine, Manifest, ALL_PHASES};
use crate::report::{self, join_or_none};
Expand Down Expand Up @@ -115,7 +115,7 @@ fn compare_dataset(
let (run, m) = create_run(engine, m)?;
report::phase(&format!("arm {arm}"));
info!("run {}", run.id);
let summary = seed_collect_judge(engine, &run, &m, a.keep_seeds)?;
let summary = seed_execute_judge(engine, &run, &m, a.keep_seeds)?;
rows.push((arm, run.id, summary));
}
report::print_comparison(&format!("compare {label}"), &rows);
Expand Down
20 changes: 10 additions & 10 deletions core/src/commands/offline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::collections::HashSet;
use anyhow::Result;

use super::runs::{
check_judge_args, create_run, fail_on, judge_run, open_run, seed_collect_judge, seed_run,
check_judge_args, create_run, fail_on, judge_run, open_run, seed_execute_judge, seed_run,
teardown_uncached,
};
use crate::cli::{ListArgs, PhaseArgs, PruneArgs, RunArgs, RunFlags, SeedArgs};
Expand Down Expand Up @@ -42,16 +42,16 @@ pub fn teardown(a: &SeedArgs) -> Result<()> {
teardown_uncached(&mut engine, &seeds)
}

/// Collects a seeded run's outputs by running the system under test on each
/// case.
pub fn collect(a: &PhaseArgs) -> Result<()> {
/// Executes a seeded run: runs the system under test on each case and saves
/// its output.
pub fn execute(a: &PhaseArgs) -> Result<()> {
let mut engine = a.project.engine()?;
engine.set_concurrency(a.concurrency);
let (run, m) = open_run(&engine, &a.run, Mode::Offline, "collect")?;
engine.check_credentials(&m.datasets, &[Phase::Collect])?;
let (run, m) = open_run(&engine, &a.run, Mode::Offline, "execute")?;
engine.check_credentials(&m.datasets, &[Phase::Execute])?;
let seeds = run.read_seeds()?;
report::phase("collect");
engine.collect(&run, &m, &seeds)?;
report::phase("execute");
engine.execute(&run, &m, &seeds)?;
info!("run {}", run.id);
Ok(())
}
Expand All @@ -65,15 +65,15 @@ pub fn judge(a: &PhaseArgs) -> Result<()> {
fail_on(judge_run(&mut engine, &run, &m)?)
}

/// Seeds, collects and judges, then tears down uncached seeds.
/// Seeds, executes and judges, then tears down uncached seeds.
pub fn run(a: &RunArgs) -> Result<()> {
let mut engine = a.scope.project.engine()?;
engine.set_concurrency(a.concurrency);
let found = a.scope.discover(&mut engine, Some(Mode::Offline))?;
let selection = a.select.selection(Some(&a.shard));
let (run, m) =
start_run(&mut engine, &found, selection, &a.run_flags, &a.judge_args, ALL_PHASES)?;
fail_on(seed_collect_judge(&mut engine, &run, &m, a.keep_seeds)?)
fail_on(seed_execute_judge(&mut engine, &run, &m, a.keep_seeds)?)
}

/// Prints the most shards any selected dataset plans, for CI to fan out.
Expand Down
18 changes: 9 additions & 9 deletions core/src/commands/online.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ use anyhow::{bail, Context, Result};
use chrono::{DateTime, SecondsFormat, Utc};

use super::runs::{check_judge_args, create_run, judge_run, open_run};
use crate::cli::{OnlineCollectArgs, OnlineJudgeArgs, OnlineRunArgs, RunFlags, Scope, WindowFlags};
use crate::cli::{OnlineExecuteArgs, OnlineJudgeArgs, OnlineRunArgs, RunFlags, Scope, WindowFlags};
use crate::eac::{Dataset, Engine, Manifest, Phase, Run, Window};
use crate::report::{self, join_or_none};
use crate::schema::{Mode, Object};

/// Collects production runs from the window into a new run, printing its
/// id on stdout so CI can pass it to `eac online judge`.
pub fn collect(a: &OnlineCollectArgs) -> Result<()> {
pub fn execute(a: &OnlineExecuteArgs) -> Result<()> {
let window = parse_window(&a.window)?;
let mut engine = a.scope.project.engine()?;
let mut datasets = online_datasets(&mut engine, &a.scope)?;
validate_args(&mut engine, &mut datasets, &a.run_flags)?;
engine.check_credentials(&datasets, &[Phase::Collect])?;
let (run, _) = collect_run(&mut engine, datasets, window, &a.run_flags)?;
engine.check_credentials(&datasets, &[Phase::Execute])?;
let (run, _) = execute_run(&mut engine, datasets, window, &a.run_flags)?;
info!("run {}", run.id);
println!("{}", run.id);
Ok(())
Expand Down Expand Up @@ -69,8 +69,8 @@ pub fn run(a: &OnlineRunArgs) -> Result<()> {
let mut datasets = online_datasets(&mut engine, &a.scope)?;
pick_judges(&mut datasets, &a.judges, &a.judge_args.clone().unwrap_or_default())?;
validate_args(&mut engine, &mut datasets, &a.run_flags)?;
engine.check_credentials(&datasets, &[Phase::Collect, Phase::Judge])?;
let (run, m) = collect_run(&mut engine, datasets, window, &a.run_flags)?;
engine.check_credentials(&datasets, &[Phase::Execute, Phase::Judge])?;
let (run, m) = execute_run(&mut engine, datasets, window, &a.run_flags)?;
judge_run(&mut engine, &run, &m)?;
Ok(())
}
Expand Down Expand Up @@ -149,15 +149,15 @@ fn pick_judges(datasets: &mut [Dataset], judges: &[String], judge_args: &Object)
}

/// Collects each dataset's production runs in the window into a new run.
fn collect_run(
fn execute_run(
engine: &mut Engine,
mut datasets: Vec<Dataset>,
window: Window,
run_flags: &RunFlags,
) -> Result<(Run, Manifest)> {
report::phase("collect");
report::phase("execute");
detail!("{} -> {}, up to {} per dataset", window.since, window.until, window.limit);
let outputs = engine.collect_online(&mut datasets, &window)?;
let outputs = engine.execute_online(&mut datasets, &window)?;
let m = Manifest {
online: true,
window: Some(window),
Expand Down
8 changes: 4 additions & 4 deletions core/src/commands/runs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ pub fn seed_run(engine: &mut Engine, run: &Run, m: &Manifest) -> Result<Seeds> {
Ok(seeds)
}

/// Seeds, collects and judges a new run, then tears down its uncached seeds
/// Seeds, executes and judges a new run, then tears down its uncached seeds
/// unless they're kept.
pub fn seed_collect_judge(
pub fn seed_execute_judge(
engine: &mut Engine,
run: &Run,
m: &Manifest,
keep_seeds: bool,
) -> Result<Summary> {
let seeds = seed_run(engine, run, m)?;
report::phase("collect");
let summary = engine.collect(run, m, &seeds).and_then(|()| judge_run(engine, run, m));
report::phase("execute");
let summary = engine.execute(run, m, &seeds).and_then(|()| judge_run(engine, run, m));
if !keep_seeds {
let _ = teardown_uncached(engine, &seeds);
}
Expand Down
6 changes: 3 additions & 3 deletions core/src/eac/phases/credentials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ use crate::worker::{check_interrupted, Interrupted, Worker};
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum Phase {
Seed,
Collect,
Execute,
Judge,
}

pub const ALL_PHASES: &[Phase] = &[Phase::Seed, Phase::Collect, Phase::Judge];
pub const ALL_PHASES: &[Phase] = &[Phase::Seed, Phase::Execute, Phase::Judge];

/// A credential to check, with the runtime whose SDK checks it.
type Needed = (String, Credential);
Expand Down Expand Up @@ -191,7 +191,7 @@ fn needed(datasets: &[Dataset], phases: &[Phase]) -> Vec<Needed> {
let seeds = d.cases.iter().flat_map(|c| &c.seeds);
add(&mut needed, &d.runtime, seeds.flat_map(|s| &s.credentials));
}
if phases.contains(&Phase::Collect) {
if phases.contains(&Phase::Execute) {
add(&mut needed, &d.runtime, &d.runner_credentials);
}
if phases.contains(&Phase::Judge) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ use super::seed::handles_for;
use crate::eac::{Dataset, Engine, Manifest, Output, Run, Seeds, Window};
use crate::report::first_line;
use crate::schema::{
Case, CaseRunParams, CaseRunResult, Handle, OnlineCollectParams, OnlineCollectResult,
Case, CaseRunParams, CaseRunResult, Handle, OnlineExecuteParams, OnlineExecuteResult,
};
use crate::worker::{each, Interrupted, Worker};

impl Engine {
/// Runs the system under test on each case and records its raw output,
/// up to the dataset's concurrency at a time.
pub fn collect(&mut self, run: &Run, m: &Manifest, seeds: &Seeds) -> Result<()> {
pub fn execute(&mut self, run: &Run, m: &Manifest, seeds: &Seeds) -> Result<()> {
for d in &m.datasets {
let n = self.concurrency(d);
let jobs = d.cases.iter().map(|c| Ok((c, handles_for(seeds, d, c, true)?)));
Expand All @@ -28,23 +28,23 @@ impl Engine {

/// Collects each dataset's production runs in window as its cases, and
/// returns their outputs, so an online run is judged like any other.
pub fn collect_online(
pub fn execute_online(
&mut self,
datasets: &mut [Dataset],
window: &Window,
) -> Result<Vec<Output>> {
let mut outputs = Vec::new();
for d in datasets {
let params = OnlineCollectParams {
let params = OnlineExecuteParams {
dataset: &d.code,
since: &window.since,
until: &window.until,
limit: window.limit,
args: &d.args,
};
let res: OnlineCollectResult = self
.call(&d.runtime, "online.collect", params)
.with_context(|| format!("collecting {}", d.name))?;
let res: OnlineExecuteResult = self
.call(&d.runtime, "online.execute", params)
.with_context(|| format!("executing {}", d.name))?;
info!("{:<24} {} cases", d.name, res.cases.len());

for c in res.cases {
Expand Down
2 changes: 1 addition & 1 deletion core/src/eac/phases/judge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Engine {
let jobs = d.cases.iter().map(|c| {
let out = run.read_output(&d.name, &c.name).map_err(|_| {
anyhow!(
"no recorded output for {}/{}: run 'eac offline collect' first",
"no recorded output for {}/{}: run 'eac offline execute' first",
d.name,
c.name
)
Expand Down
4 changes: 2 additions & 2 deletions core/src/eac/phases/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! The phases a run goes through, each a method on Engine: discover, seed,
//! collect and judge, plus the credential checks that come before them.
//! execute and judge, plus the credential checks that come before them.

mod collect;
mod credentials;
mod discover;
mod execute;
mod judge;
mod seed;

Expand Down
2 changes: 1 addition & 1 deletion core/src/eac/run/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub struct Dataset {
/// --judge-args by judge name, kept so a re-judge uses the same ones.
#[serde(default, deserialize_with = "nullable", skip_serializing_if = "Object::is_empty")]
pub judge_args: Object,
/// What the runner needs with these args, checked before collecting.
/// What the runner needs with these args, checked before executing.
#[serde(default, deserialize_with = "nullable", skip_serializing_if = "Vec::is_empty")]
pub runner_credentials: Vec<Credential>,
/// What each judge needs, by judge name, checked before judging.
Expand Down
Loading
Loading