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
146 changes: 146 additions & 0 deletions .github/workflows/evals.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: Evals

on:
pull_request:
paths:
- core/**
- sdks/python/**
- examples/sentry-assistant-python/**
- scripts/upload_evals.py
- .github/workflows/evals.yml

permissions:
contents: read

concurrency:
group: evals-${{ github.event.pull_request.number }}
cancel-in-progress: true

env:
DATASET: triage
EXAMPLE: examples/sentry-assistant-python
# The project the example's seeds fill with issues.
SENTRY_ORG: sentry-evals
SENTRY_PROJECT: eac-example

jobs:
compare:
name: Create the comparison
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
comparison: ${{ steps.create.outputs.comparison }}
base_sha: ${{ steps.create.outputs.base_sha }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Create the comparison
id: create
env:
GH_TOKEN: ${{ github.token }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
EVALS_API_TOKEN: ${{ secrets.EVALS_API_TOKEN }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: |
# Pull requests that don't get secrets, like Dependabot's, skip the evals.
if [ -z "$EVALS_API_TOKEN" ] || [ -z "$OPENROUTER_API_KEY" ] || [ -z "$SENTRY_AUTH_TOKEN" ]; then
echo "::notice::Skipping the evals: a secret they need isn't set."
exit 0
fi
base_sha=$(gh api "repos/$GITHUB_REPOSITORY/compare/$GITHUB_BASE_REF...$HEAD_SHA" --jq .merge_base_commit.sha)
echo "base_sha=$base_sha" >> "$GITHUB_OUTPUT"
echo "comparison=$(python3 scripts/upload_evals.py comparison "$DATASET")" >> "$GITHUB_OUTPUT"

eval:
name: Evals (${{ matrix.arm }})
needs: compare
if: needs.compare.outputs.comparison != ''
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- arm: base
sha: ${{ needs.compare.outputs.base_sha }}
- arm: head
sha: ${{ github.event.pull_request.head.sha }}
base_sha: ${{ needs.compare.outputs.base_sha }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ matrix.sha }}
path: arm

- name: Update Rust
run: rustup update stable --no-self-update && rustup default stable

- uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3

- name: Install Sentry CLI
run: npm install -g sentry@0.47.0

- name: Run the evals and upload them
id: run
env:
SHA: ${{ matrix.sha }}
BASE_SHA: ${{ matrix.base_sha }}
COMPARISON: ${{ needs.compare.outputs.comparison }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
EVALS_API_TOKEN: ${{ secrets.EVALS_API_TOKEN }}
run: |
# The pull request that adds the example has no base to compare against.
if [ ! -d "arm/$EXAMPLE" ]; then
echo "::notice::$EXAMPLE doesn't exist at the merge base, so there's no base run."
exit 0
fi
cargo build --manifest-path arm/core/Cargo.toml
cd "arm/$EXAMPLE"
uv sync --locked

# eac exits 1 when a case fails or errors, and 2 when eac itself
# fails. Low scores are worth uploading, so only 2 stops here.
status=0
run=$(../../core/target/debug/eac offline run) || status=$?
if [ "$status" -gt 1 ]; then exit "$status"; fi
echo "run=$run" >> "$GITHUB_OUTPUT"

python3 "$GITHUB_WORKSPACE/scripts/upload_evals.py" run ".eac/runs/$run" \
--comparison "$COMPARISON" --sha "$SHA" ${BASE_SHA:+--base-sha "$BASE_SHA"}

# A model's scores never fail the check. An errored case means a runner
# or judge threw, which on the head is likely this pull request's doing.
- name: Fail on errored cases
if: matrix.arm == 'head'
working-directory: arm/${{ env.EXAMPLE }}
env:
RUN: ${{ steps.run.outputs.run }}
run: |
errored=$(jq -s '[.[].cases[] | select(.status == "error")] | length' ".eac/runs/$RUN/results/"*.json)
if [ "$errored" -gt 0 ]; then
echo "::error::$errored cases errored. See the run's results above."
exit 1
fi

# Online runs can't join a comparison, so this only checks they work.
- name: Run the online evals
if: matrix.arm == 'head'
working-directory: arm/${{ env.EXAMPLE }}
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
run: ../../core/target/debug/eac online run --judge triage_llm_judge --since 1h > /dev/null

# Resolves the issues this run's seeds created in Sentry, even if a
# step above failed.
- name: Clean up the seeds
if: always()
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: |
if [ -d "arm/$EXAMPLE/.eac" ]; then
cd "arm/$EXAMPLE" && ../../core/target/debug/eac offline prune --all
fi
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
CARGO ?= cargo
PYTHON ?= python3
PNPM ?= pnpm
MANIFEST := core/Cargo.toml

.DEFAULT_GOAL := help
.PHONY: help build install test lint fmt generate generate-check version version-check
.PHONY: help build install test lint fmt generate generate-check version version-check docs

help: ## list the targets
@awk -F ':.*## ' '/^[a-z-]+:.*## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
Expand Down Expand Up @@ -35,3 +36,7 @@ version: ## copy the version in VERSION into the CLI and SDKs

version-check: ## fail if the CLI or an SDK doesn't match VERSION
$(PYTHON) scripts/version.py --check

docs: ## install the docs' dependencies and serve them at http://localhost:3000
$(PNPM) --dir docs install
$(PNPM) --dir docs dev
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ RESULTS

## Learn more

The [docs](https://eac.sentry.dev) cover judges, seeds, [online evals](https://eac.sentry.dev/online-evals) and the full CLI reference. [`examples/`](examples/) has complete projects to start from.
[`examples/`](examples/) has full examples to start from. The [docs](https://eac.sentry.dev) cover everything about EAC.

For contributors: [`core/README.md`](core/README.md) covers the CLI, [`core/PROTOCOL.md`](core/PROTOCOL.md) how it talks to an SDK, and [`CONTRIBUTING.md`](CONTRIBUTING.md) releasing.
## Contributors

- [`core/README.md`](core/README.md) covers the CLI
- [`core/PROTOCOL.md`](core/PROTOCOL.md) how the CLI talks to an SDK
- [`CONTRIBUTING.md`](CONTRIBUTING.md) covers releasing.

## License

Expand Down
22 changes: 13 additions & 9 deletions core/PROTOCOL.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ offline run all three phases, then seed.teardown for uncached seeds (comp
offline prune discover → seed.teardown
online execute discover → args.validate → online.execute
online judge args.validate → online.judge
list, catalog discover
auth discover → args.validate → credentials.check → credentials.login
list discover
```

Before each phase, eac also sends `credentials.check` for what the phase needs, and `credentials.login` if the user agrees to log in. The [credentials](#credentialscheck--credentialslogin) section covers both.
Expand Down Expand Up @@ -105,6 +104,9 @@ These types show up in the params and results of many methods:
"cache_write_tokens": 0, "reasoning_tokens": 0, "llm_duration_seconds": 0,
"llm_calls": 0, "tool_calls": 0, "cost_usd": 0}

// Window: the production runs to collect, from since up to until (RFC 3339)
{"since": "2026-11-19T11:00:00Z", "until": "2026-11-19T12:00:00Z", "limit": 500, "sample_rate": 0.1}

```

## Worker methods
Expand All @@ -115,7 +117,7 @@ The `dataset` param is always a DatasetRef. Every method that needs a dataset ge

Params: `{"dataset"}`.

Imports the dataset's code and returns what only the code knows. It shouldn't have side effects beyond the import. Everything else, like the name, agent, comparisons, shard config and online judges, comes from the `dataset.yml`.
Imports the dataset's code and returns what only the code knows. It shouldn't have side effects beyond the import. Everything else, like the name, comparisons and online judges, comes from the `dataset.yml`.

```jsonc
{"cases": [Case]} // offline: every case; online: nothing
Expand Down Expand Up @@ -153,7 +155,7 @@ Runs the system under test on one case.

### `case.judge`

Params: `{"dataset", "case", "judges"?, "error"?, "seeds": {name: handle}, "judge_args"?, "trace"?, "agent"?, "started_at"?, "ended_at"?}`.
Params: `{"dataset", "case", "judges"?, "error"?, "seeds": {name: handle}, "judge_args"?, "trace"?, "started_at"?, "ended_at"?}`.

Scores one case's output and returns `{"scores": [Score]}`.

Expand All @@ -162,17 +164,19 @@ Scores one case's output and returns `{"scores": [Score]}`.
- `judge_args` is `--judge-args`, keyed by judge name.
- `trace` is the case's agent trace, if an earlier judge phase saved one.

**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.
**Agent traces.** Without a `trace`, the judges may fetch the agent run's trace, looking it up by the case's `conversation_id` 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.execute`

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

Returns `{"cases": [Case]}`, at most `limit` of the window's runs. Each case has its `output`, and its `conversation_id` if it has one.

Returns `{"cases": [Case]}`, the production runs from the window between `since` and `until` (both RFC 3339 times), at most `limit` of them. Each case has its `output`, and its `conversation_id` if it has one.
Return only sampled runs: those whose id's SHA-256 has its first 8 bytes, as a big-endian integer, below `sample_rate × 2^64`. SDKs should give runners a helper for this, so every SDK picks the same runs.

### `online.judge`

Params: `{"dataset", "case", "judges", "judge_args"?, "trace"?, "agent"?}`.
Params: `{"dataset", "case", "judges", "judge_args"?, "trace"?}`.

Scores a collected case, with its `output` and `conversation_id`, with the named online judges and returns `{"scores": [Score]}`. The names are the ones in the DatasetRef, and `judge_args` is keyed by them. Agent traces work as in `case.judge`, and collected cases have no run times.

Expand All @@ -186,7 +190,7 @@ Before each phase, eac sends `credentials.check {"credentials": [Credential]}` w

**Logging in.**

For each credential that isn't set up, eac may send `credentials.login {"credential"}`, either when the user agrees to log in on a terminal or from `eac auth`. eac starts a separate worker for this with the terminal as its stdin and stderr, and its stdout going to eac's stderr, so login can prompt or run a command like `gh auth login`.
For each credential that isn't set up, eac may send `credentials.login {"credential"}`, when the user agrees to log in on a terminal. eac starts a separate worker for this with the terminal as its stdin and stderr, and its stdout going to eac's stderr, so login can prompt or run a command like `gh auth login`.

Return `{"env": {...}}` with any variables the credential needs, or an error saying why login failed.

Expand Down
15 changes: 7 additions & 8 deletions core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ eac online judge score each case with the picked judges

**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.
Asks each dataset's online runner for the production runs in a time window (`--since`, `--window-end`, `--limit`), sampled at `--sample-rate`, as cases with their outputs, and saves each output.

**Judge**

Expand All @@ -108,9 +108,9 @@ Seeds, runners and judges can declare the credentials they need, like a GitHub t

On a terminal, eac offers to log in first. Whatever a login returns is saved to `<artifacts>/credentials/saved.json` (owner-only, git-ignored and never your `.env`), and later commands use it ahead of `.env` and your shell. If a saved value goes stale, its check fails and logging in again replaces it.

`eac auth` checks and logs in to everything the datasets need up front, which is handy on a new machine. Checks are skipped when `$CI` is set, since CI sets up its own credentials.
Checks are skipped when `$CI` is set, since CI sets up its own credentials.

`eac --help` lists every other command (`list`, `compare`, `catalog`, ...) and flag.
`eac --help` lists every other command (`list`, `compare`, ...) and flag.

## Build

Expand All @@ -131,7 +131,7 @@ make version-check # fail if the CLI or an SDK doesn't match VERSION
`cargo run` builds and runs the CLI in one step, and the example project makes a handy target:

```sh
cargo run --manifest-path core/Cargo.toml -- list -C examples/basic-example-python
cargo run --manifest-path core/Cargo.toml -- list -C examples/sentry-assistant-python
```

### Tests
Expand Down Expand Up @@ -174,13 +174,12 @@ Seed caches shared between machines and agent trace sources aren't config. They'
```yaml
# evals/autofix/rca/dataset.yml
name: autofix_rca # lowercase letters, digits and _; unique in the project
agent: autofix # optional: the production agent, for traces
metadata: {team: seer} # optional: recorded in its results
runtime: python # required; python is the only one so far

offline:
runner: ./offline_runner.py:AutofixRcaEvalRunner # an OfflineRunner
cases: ./offline_cases.py:AUTOFIX_RCA_CASES # a sequence of Cases
shard_config: {cases_per_shard: 12, max_shards: 10}
concurrency: 4 # optional: cases run at once (default 1)
comparisons:
- name: coding_agents
Expand Down Expand Up @@ -210,7 +209,7 @@ online:
.eac/seed-cache.json cached seeds, shared across runs
.eac/credentials/saved.json values from credential logins, owner-only and git-ignored
.eac/runs/<id>/
manifest.json what was selected, the args, the source (git or CI), the variant
manifest.json what was selected, the args, the source (git or CI)
seeds.json handles of every seed the run used
outputs/<ds>/<case>.json
traces/<ds>/<case>.json agent traces the judges fetched
Expand All @@ -227,4 +226,4 @@ id=$(eac offline run --dataset chat); ./upload.py ".eac/runs/$id"

## Not built yet

Cost and token tracking, result caching, CI sharding and packaged binaries.
Cost and token tracking, result caching and packaged binaries.
Loading
Loading