Evals
Case schema
Every key of evals/case/v1, the YAML case format, with its type and meaning.
Schema id: https://getviewport.com/schemas/evals/case/v1.json (file spec/schemas/evals/case/v1.json, printed by
viewport-evals schema case). Unknown keys are errors everywhere. Range means a count: a number is exact,
{ min, max } is inclusive. Matcher is the matcher language. ~ (null) marks a
placeholder that --accept fills.
A file is a single case (an object with input) or a suite (an object with cases).
| Key | Type | Meaning |
|---|
$schema | string | optional schema URL, for editors |
defaults | object (suite only) | applied to every case: tags, agent, skip, xfail, runs, pass_threshold, min_passes, parallel_runs, retries, timeout_ms, clock, allow_empty, replay, world, expect |
cases | array of cases, at least one (suite only) | each case must have an id |
| Key | Type | Meaning |
|---|
id | string, [A-Za-z0-9][A-Za-z0-9._-]* | unique id; names the fixture. Defaults to the file stem in a single-case file |
description | string | shown in reports |
tags | array of strings | select with --tag; pytest markers |
agent | string | registered agent name; optional when one agent is registered |
skip | boolean or string | skip the case; a string is the reason |
xfail | boolean or string | expected to fail; an unexpected pass is xpass |
input | string or object | required. A prompt, or an Input object (below) |
runs | integer >= 1 | repetitions in live and record modes. Default 1 |
pass_threshold | number in (0, 1] | fraction of runs that must pass. Default 1 |
min_passes | integer >= 1 | absolute number of runs that must pass; exclusive with pass_threshold |
parallel_runs | boolean | run repetitions concurrently. Default false |
retries | integer >= 0 | re-run a crashed run, never a failed assertion |
timeout_ms | integer >= 1 | abort a run after this long, on wall time; the run records a TimeoutError |
clock | Clock | run on simulated time (below) |
world | object of name to WorldDecl | simulated worlds, a fresh instance per run (below) |
replay | Replay | serve tool calls from the fixture's imported trajectory (below) |
allow_empty | boolean | allow runs that capture no model call |
fixture | string | fixture path, relative to this file |
expect | Expect | the expectations (below) |
| Key | Type | Meaning |
|---|
prompt | string | one user prompt; exclusive with turns and script |
turns | array of strings, at least one | scripted user turns; the agent runs once per turn |
script | array of ScriptStep, at least one | episodes in order; exclusive with prompt and turns |
messages | array of { role: system | user | assistant, content: string } | prior conversation history |
context | object | free-form data passed to the agent untouched |
| Key | Type | Meaning |
|---|
tools | array of names, or Tools object | tool calls by tool_name; a list is shorthand for called |
model_calls | Range or ~ | number of model round trips |
budget | object | resource limits; each number means at most N |
output | Matcher, or array of Matchers | the final output; every matcher in a list must pass |
error | ErrorExpect | whether and how the run fails. Default false |
approvals | array of tool names, or Approvals object | human approvals (decision: ask) by tool_name, once per approval_id |
gated | array of tool names, or Gated object | every policy outcome (allow, ask, deny) by tool_name |
skills | array of names, or Skills object | skill loads by skill name |
agents | array of names, or Agents object | agent runs by name |
handoffs | array of names, or Sequence object | handoffs by target agent |
events | array of Event expectations | any event type |
invariants | { file }, or array of invariants and { file } | rules over the whole run (invariant/v1); one assertion per invariant |
world | object of world name to WorldExpect | end-state assertions per declared world |
use | array of name or { name: options } | assertion plugins |
when | array of When, at least one | expectations for matching models |
baseline | BaselineExpect | the behavior diff against the imported trajectory |
Shared by tools, approvals, gated, skills, agents and handoffs. Names may be globs (mcp__crm__*).
| Key | Type | Meaning |
|---|
called | array of names | each appears at least once, in any order |
not_called | array of names | none appears. Unions across suite defaults |
in_order | array of names | these appear as a subsequence; others may be interleaved |
exactly | array of names, or ~ | the full sequence equals this list |
unordered | array of names | the full sequence is this multiset, in any order |
only | array of names | nothing outside this allow-list appears |
first | name | the first entry |
last | name | the last entry |
count | Range | total number of entries |
counts | object of name to Range | per-name counts |
| Key | Type | Meaning |
|---|
no_errors | boolean | no tool call failed |
calls | array of ToolCallExpect | per-call expectations |
ToolCallExpect:
| Key | Type | Meaning |
|---|
tool_name | string | required. The tool |
args | Matcher | the arguments; plain objects match partially |
result | Matcher | the result |
error | ErrorExpect | whether and how the call failed |
which | any, all, first, last, or a 1-based integer | which calls are checked. Default any |
count | Range | how many of the checked calls must match; 0 means none may |
agent | string | only calls made under this agent |
| Key | Type | Meaning |
|---|
tokens | number >= 0 or ~ | input plus output tokens, at most |
input_tokens | number >= 0 or ~ | input tokens (cache reads and writes included), at most |
output_tokens | number >= 0 or ~ | output tokens, at most |
cost_usd | number >= 0 or ~ | cost in USD, at most; unpriceable models fail the check |
latency_ms | number >= 0 or ~ | recorded wall-clock time, at most |
false: the run (or call) must not fail. true: it must fail. { type, message }: it must fail this way; each key
is a Matcher on the error's type and message, at least one key required.
| Key | Type | Meaning |
|---|
status | object of tool name to pending, approved, denied, expired or cancelled | every approval for that tool ended with this status |
before_side_effect | boolean | each approved tool's first call comes after its approval |
| Key | Type | Meaning |
|---|
status | object of tool name to allowed, approved, denied, expired, cancelled or pending | every gated action for that tool ended with this status (latest event per approval_id) |
decision | object of tool name to allow, ask or deny | every policy decision for that tool was this |
| Key | Type | Meaning |
|---|
tokens | number >= 0 | budget on total skill_load tokens |
| Key | Type | Meaning |
|---|
within | object of agent name to Expect | expectations on the sub-trajectory under each named agent |
| Key | Type | Meaning |
|---|
type | string | required. The event type, including types Evals does not know |
where | Matcher | over the whole event |
count | Range | how many matching events. Default { min: 1 } |
| Key | Type | Meaning |
|---|
state | Matcher | over the whole end state |
changed | array of paths ($...) | exactly these paths changed, compared as a sorted set; no wildcards |
only_changed | array of path patterns | every change is at or under one of these (* matches one key or index) |
not_changed | array of path patterns | nothing changed at, under or above these; unions across suite defaults |
| Key | Type | Meaning |
|---|
model | string or array of strings | a model name or glob (claude-haiku-*), or a list |
expect | Expect without error, world or when | added for matching models; assertions are named when[<i>].<name> |
At least one key.
| Key | Type | Meaning |
|---|
tools | same | the tool sequence and every call's arguments equal the baseline's |
output | Matcher | over this run's output, reported next to the baseline's |
cost_usd | { max_increase: number | "<n>%" } | cost rose at most this many US dollars, or this percentage of the baseline |
| Key | Type | Meaning |
|---|
start | ISO 8601 instant | required. The simulated time each run starts at, such as 2026-11-25T09:00:00Z |
max_simulated | duration (30d, 12h, 500ms) | most simulated time a run may pass; default 30d; past it, evals.simulated_time_exceeded |
| Key | Type | Meaning |
|---|
use | string | the registered world (config worlds) or pack (crm, calendar, payments, inbox); default: the declared name |
seed | object | deep-merged over the world's default state; objects merge key by key, arrays and scalars replace |
World names match [A-Za-z][A-Za-z0-9_-]*.
| Key | Type | Meaning |
|---|
tools | recorded | serve tool results from the fixture's imported trajectory, by tool name plus canonical arguments, in recorded order |
on_miss | error, world or live | a call the recording never made: fail it with evals.replay_tool_miss (default), run the declared world's tool, or run the real tool |
allow_hosts | list of host patterns | hosts this case may reach in strict replay (its own tool services), on top of the config's replay.allow_hosts. Anything else without a recording errors the case with evals.replay_blocked. localhost also covers 127.0.0.0/8 and ::1; host:port limits the port |
Exactly one key per step.
| Key | Type | Meaning |
|---|
user | string | a user message; the agent runs with it as the prompt |
approval | { status, approval_id?, tool_name?, by?, reason?, edited_args? } | a human decision (approved, denied, expired, cancelled); the agent runs with it as event. edited_args (an object, approved only) is approve with edits. The step is input: it is never recorded as an approval event, so only the agent's own approvals count |
event | object with type | an external typed event; the agent runs with it as event |
advance | duration | move the case clock forward, waking due timers; the agent is not called; needs clock |