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.

File

A file is a single case (an object with input) or a suite (an object with cases).

KeyTypeMeaning
$schemastringoptional schema URL, for editors
defaultsobject (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
casesarray of cases, at least one (suite only)each case must have an id

Case

KeyTypeMeaning
idstring, [A-Za-z0-9][A-Za-z0-9._-]*unique id; names the fixture. Defaults to the file stem in a single-case file
descriptionstringshown in reports
tagsarray of stringsselect with --tag; pytest markers
agentstringregistered agent name; optional when one agent is registered
skipboolean or stringskip the case; a string is the reason
xfailboolean or stringexpected to fail; an unexpected pass is xpass
inputstring or objectrequired. A prompt, or an Input object (below)
runsinteger >= 1repetitions in live and record modes. Default 1
pass_thresholdnumber in (0, 1]fraction of runs that must pass. Default 1
min_passesinteger >= 1absolute number of runs that must pass; exclusive with pass_threshold
parallel_runsbooleanrun repetitions concurrently. Default false
retriesinteger >= 0re-run a crashed run, never a failed assertion
timeout_msinteger >= 1abort a run after this long, on wall time; the run records a TimeoutError
clockClockrun on simulated time (below)
worldobject of name to WorldDeclsimulated worlds, a fresh instance per run (below)
replayReplayserve tool calls from the fixture's imported trajectory (below)
allow_emptybooleanallow runs that capture no model call
fixturestringfixture path, relative to this file
expectExpectthe expectations (below)

Input

KeyTypeMeaning
promptstringone user prompt; exclusive with turns and script
turnsarray of strings, at least onescripted user turns; the agent runs once per turn
scriptarray of ScriptStep, at least oneepisodes in order; exclusive with prompt and turns
messagesarray of { role: system | user | assistant, content: string }prior conversation history
contextobjectfree-form data passed to the agent untouched

Expect

KeyTypeMeaning
toolsarray of names, or Tools objecttool calls by tool_name; a list is shorthand for called
model_callsRange or ~number of model round trips
budgetobjectresource limits; each number means at most N
outputMatcher, or array of Matchersthe final output; every matcher in a list must pass
errorErrorExpectwhether and how the run fails. Default false
approvalsarray of tool names, or Approvals objecthuman approvals (decision: ask) by tool_name, once per approval_id
gatedarray of tool names, or Gated objectevery policy outcome (allow, ask, deny) by tool_name
skillsarray of names, or Skills objectskill loads by skill name
agentsarray of names, or Agents objectagent runs by name
handoffsarray of names, or Sequence objecthandoffs by target agent
eventsarray of Event expectationsany event type
invariants{ file }, or array of invariants and { file }rules over the whole run (invariant/v1); one assertion per invariant
worldobject of world name to WorldExpectend-state assertions per declared world
usearray of name or { name: options }assertion plugins
whenarray of When, at least oneexpectations for matching models
baselineBaselineExpectthe behavior diff against the imported trajectory

Sequence keys

Shared by tools, approvals, gated, skills, agents and handoffs. Names may be globs (mcp__crm__*).

KeyTypeMeaning
calledarray of nameseach appears at least once, in any order
not_calledarray of namesnone appears. Unions across suite defaults
in_orderarray of namesthese appear as a subsequence; others may be interleaved
exactlyarray of names, or ~the full sequence equals this list
unorderedarray of namesthe full sequence is this multiset, in any order
onlyarray of namesnothing outside this allow-list appears
firstnamethe first entry
lastnamethe last entry
countRangetotal number of entries
countsobject of name to Rangeper-name counts

Tools object extras

KeyTypeMeaning
no_errorsbooleanno tool call failed
callsarray of ToolCallExpectper-call expectations

ToolCallExpect:

KeyTypeMeaning
tool_namestringrequired. The tool
argsMatcherthe arguments; plain objects match partially
resultMatcherthe result
errorErrorExpectwhether and how the call failed
whichany, all, first, last, or a 1-based integerwhich calls are checked. Default any
countRangehow many of the checked calls must match; 0 means none may
agentstringonly calls made under this agent

Budget

KeyTypeMeaning
tokensnumber >= 0 or ~input plus output tokens, at most
input_tokensnumber >= 0 or ~input tokens (cache reads and writes included), at most
output_tokensnumber >= 0 or ~output tokens, at most
cost_usdnumber >= 0 or ~cost in USD, at most; unpriceable models fail the check
latency_msnumber >= 0 or ~recorded wall-clock time, at most

ErrorExpect

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.

Approvals object extras

KeyTypeMeaning
statusobject of tool name to pending, approved, denied, expired or cancelledevery approval for that tool ended with this status
before_side_effectbooleaneach approved tool's first call comes after its approval

Gated object extras

KeyTypeMeaning
statusobject of tool name to allowed, approved, denied, expired, cancelled or pendingevery gated action for that tool ended with this status (latest event per approval_id)
decisionobject of tool name to allow, ask or denyevery policy decision for that tool was this

Skills object extras

KeyTypeMeaning
tokensnumber >= 0budget on total skill_load tokens

Agents object extras

KeyTypeMeaning
withinobject of agent name to Expectexpectations on the sub-trajectory under each named agent

Event expectation

KeyTypeMeaning
typestringrequired. The event type, including types Evals does not know
whereMatcherover the whole event
countRangehow many matching events. Default { min: 1 }

WorldExpect

KeyTypeMeaning
stateMatcherover the whole end state
changedarray of paths ($...)exactly these paths changed, compared as a sorted set; no wildcards
only_changedarray of path patternsevery change is at or under one of these (* matches one key or index)
not_changedarray of path patternsnothing changed at, under or above these; unions across suite defaults

When

KeyTypeMeaning
modelstring or array of stringsa model name or glob (claude-haiku-*), or a list
expectExpect without error, world or whenadded for matching models; assertions are named when[<i>].<name>

BaselineExpect

At least one key.

KeyTypeMeaning
toolssamethe tool sequence and every call's arguments equal the baseline's
outputMatcherover 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

Clock

KeyTypeMeaning
startISO 8601 instantrequired. The simulated time each run starts at, such as 2026-11-25T09:00:00Z
max_simulatedduration (30d, 12h, 500ms)most simulated time a run may pass; default 30d; past it, evals.simulated_time_exceeded

WorldDecl

KeyTypeMeaning
usestringthe registered world (config worlds) or pack (crm, calendar, payments, inbox); default: the declared name
seedobjectdeep-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_-]*.

Replay

KeyTypeMeaning
toolsrecordedserve tool results from the fixture's imported trajectory, by tool name plus canonical arguments, in recorded order
on_misserror, world or livea 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_hostslist of host patternshosts 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

ScriptStep

Exactly one key per step.

KeyTypeMeaning
userstringa 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
eventobject with typean external typed event; the agent runs with it as event
advancedurationmove the case clock forward, waking due timers; the agent is not called; needs clock

On this page