Why You Shouldn't Build a Toy Eval Runner: Real-Runtime Trials, 3-Layer Graders, pass^k, and Human Gates
Run a coding agent or multi-step workflow for more than a week and you hit the same uncomfortable question:
You edited two lines in a system prompt, mounted a new skill, swapped Claude for DeepSeek, or tweaked a workflow branch. How do you know the change actually improved things without silently breaking three guardrails that used to hold?
Most teams slide into one of two traps. Either they run two manual sanity chats and ship — discovering three days later that the front-desk agent stopped asking before risky actions or tanked Prompt Cache hit rates — or they write a separate offline script calling raw LLM APIs against JSON fixtures. That script passes at 96%, yet production still spins, skips skills, or times out.
The reason is structural: a standalone script tests a stunt double, not your production agent. The parts that actually break — tool registries, permission checks, progressive skill loading, Git worktree isolation, and compaction — are bypassed completely.
This post walks through how I built evals directly on top of the real runtime in CrewDesk: isolating live trials, layering deterministic graders before LLM judges, tracking pass^k instead of pass@1, and where human judgment still cannot be automated away.
1. Run Evals on the Real Engine — and Seal Five Isolation Leaks
To keep offline behavior identical to production, every eval trial executes on the same Agent Run and Workflow Execution engine, backed by just two primitives:
- Git-backed suites (
*.eval.json): plain JSON stored in local Git with atomic writes, history, and revert — covering single agents, skills, and workflows. - Immutable SQLite ledgers (
eval_run+eval_case_result): records model,ktrials, cost caps, and links every trial directly to its real execution trace (runIdorworkflowExecutionId).
Reusing the live engine is clean, provided you seal five risks upfront:
- Telemetry and notification isolation. Eval runs carry
authorization: "eval:<evalRunId>". Production dashboards queryscope=productionby default, and eval runs never send chat notifications or touch the operator inbox. - Ephemeral Git worktrees. Code cases check out a temporary worktree from the project mirror, run the agent plus test commands, and clean up automatically.
- Dry-run outbound tools. Tools with external side effects automatically switch to record-only interception inside eval runs, returning synthetic receipts while logging exact arguments for assertions.
- Hard cost fuses and partial reruns. Server-side concurrency limits (default
2) andmaxTotalCostUsdstop unstarted cases asbudget_stopped; prompt iteration supports single-case runs and rerun-failed-only. - Multi-turn human simulation (
mockAnswers). A careful coordinator should callask_questionbefore risky or ambiguous actions. Without scripted answers, automated evals stall at the human gate.
In apps/backend/src/features/evals/mock-ask.ts, a small interceptor answers ask_question calls by questionId, keyword match, or turn order, capped to prevent infinite loops:
export function resolveEvalMockAsk(
session: EvalMockAskSession,
questions: readonly AskQuestionItem[],
): AskQuestionResult | null {
if (session.mockAnswers.length === 0 || questions.length === 0) return null;
const matchers = session.mockAnswers.filter(
(entry) => typeof entry !== "string" && (Boolean(entry.questionId) || Boolean(entry.match)),
);
const sequential = session.mockAnswers.filter(
(entry) => typeof entry === "string" || (!entry.questionId && !entry.match),
);
const maxRounds = sequential.length > 0 ? sequential.length : Math.min(matchers.length, 3);
if (session.round >= maxRounds) return null;
for (const q of questions) {
const haystack = `${q.header ?? ""} ${q.question}`.toLowerCase();
const chosen =
matchers.find((m) => m.questionId === q.id) ??
matchers.find((m) => m.match && haystack.includes(m.match.toLowerCase())) ??
sequential[session.round];
// Return structured answer back into the live turn loop
}
session.round += 1;
return { answers };
}
That lets an automated suite verify the entire multi-turn flow: ask for the branch name → receive reply → dispatch with the exact branch → never touch bash.
2. Three-Layer Graders: Catch 80% of Regressions at Zero Token Cost
The most common eval mistake is throwing LLM-as-a-Judge at everything. Model judges are slow, expensive, and noisy, whereas most engineering agent failures — missed skills, wrong tools, bad arguments, skipped workflow nodes, broken unit tests — are objectively checkable in code.
In apps/backend/src/features/evals/graders.ts, grading runs in three layers, deterministic first:
| Layer | Model Cost | What It Checks | Best Fit |
|---|---|---|---|
| Layer 1: Contract | 0 tokens | skill_activated, tool_called (argsMatch, minCalls), tool_forbidden, workflow_outcome, output_match, command_check (real tests/typecheck in sandbox) | Default workhorse — instant, zero drift |
| Layer 2: Trajectory & Budget | 0 tokens | maxToolCalls, maxDurationMs (active time minus human wait), maxCostUsd, spinning === false | Blocks "brute-forced in 40 turns" false passes |
Layer 3: llm_judge | 1 judge call | Opt-in only when rubric is set; structured { pass, score: 1..5, reason } | Open-ended prose (reviews, research reports) |
Layer 1 checks are deliberately plain code over the observed run trace:
case "tool_called": {
const matches = obs.tools.filter((t) => {
if (!toolNameMatches(t.toolName, spec.toolName)) return false;
if (spec.argsMatch && !t.inputText.includes(spec.argsMatch)) return false;
return true;
});
const passed = matches.length >= spec.minCalls;
return { type: spec.type, label: `tool:${spec.toolName}`, passed, score: passed ? 1 : 0, reason };
}
case "tool_forbidden": {
const hits = obs.tools.filter((t) => toolNameMatches(t.toolName, spec.toolName));
return { type: spec.type, label: `forbid:${spec.toolName}`, passed: hits.length === 0, score: hits.length === 0 ? 1 : 0, reason };
}
3. Why pass@1 Lies — and Why Production Needs pass^k
Single-run pass rates hide flakiness. Running each case k > 1 times exposes two very different metrics:
pass@k(at least 1 ofkpasses): measures capability ceiling — can the model do it at all?pass^k(allkruns pass): measures production reliability — can I trust this in an unattended 3 AM loop?
Do the math for an agent with a 75% single-run pass rate (p = 0.75) over k = 3 trials:
pass@3is1 - 0.25^3 = 98.4%— looks rock solid.pass^3is only0.75^3 = 42.2%— in an unattended multi-step pipeline, it fails more often than it succeeds.
In Baseline vs. Candidate A/B diffs, surfacing pass^k, active P95 latency, cost, and Prompt Cache hit rate side by side — and pinning every Pass → Fail regression to the top with a direct link to the run trace — turns vague prompt tuning into real engineering.

4. Feeding Production Failures Back — While Keeping Auto-Tune Behind a Human Gate
Offline suites rot unless real production bugs flow back into them.
Before closing that loop, I hit an obvious telemetry distortion: counting the three hours a human took to click an approval button as "run latency" wrecked every P95 chart. Splitting every waterfall into model, tool, and human_wait segments made active P50/P95, TTFT, and Prompt Cache hit rate (cacheRead / (input + cacheRead)) actually meaningful.

Once telemetry is clean, the feedback loop takes three steps:
- Downvote a broken or spinning production run and run root-cause diagnostics.
- Promote its real input, activated skills, and tool trajectory into a Git-versioned regression case.
- Run
eval_auto_tuneto proposeSOUL.md, model, or thinking-budget adjustments, evaluate them via A/B diff, and emit a Proposal card.
One boundary stays deliberately manual: Propose ≠ Save. An auto-tuner never silently rewrites live prompts. Any eval suite only samples known failure modes; unmodeled regressions, tone shifts, and cost tradeoffs still require a human to read the diff and click adopt.
5. Takeaway and Honest Limits
You do not need an external ClickHouse or OTel stack to start doing real agent evals:
- Execute isolated trials on the real runtime so behavior cannot drift.
- Catch 80% of regressions with 0-token contract and budget assertions; reserve LLM judges for open prose.
- Judge production readiness on
pass^kandPass → Failregressions, notpass@1. - Feed production bugs back into Git-backed suites, and keep prompt promotion behind human signoff.
The limits are equally plain: evals only guard against failure modes you have already seen or modeled, and running k = 3 or k = 5 real-runtime trials costs real tokens — which is why single-case test runs, rerun-failed-only, and hard cost fuses matter as much as the graders themselves.
Source Code & Related Reading:
- Graders & multi-turn mock answers: graders.ts · mock-ask.ts
- ADR & guide: ADR 0085 · Observability & Evals Guide
- Companion posts: Open Loop vs. Closed Loop: Understanding Workflow and Super Agent Through Loop Engineering · LLM Wiki and Agent Knowledge Management