CLI
viewport-evals commands and flags. The Python and TypeScript CLIs share commands, flags, output, reports and exit codes.
Both packages ship a viewport-evals command on their own native runner, so a Python project needs no Node and a
TypeScript project needs no Python. In a repository with both, uv run viewport-evals and
pnpm exec viewport-evals agree on every case.
uv add --dev viewport-evals && uv run viewport-evals run
pnpm add -D @viewportai/evals && pnpm exec viewport-evals run
npx @viewportai/evals run # one-off, without installingviewport-evals --version prints the version; viewport-evals <command> --help prints a command's options.
run
viewport-evals run [globs...] [options] runs YAML cases: the globs given, else the config's cases, else
evals/**/*.yaml. __fixtures__ directories are never read as cases.
| Flag | Does |
|---|---|
--mode <mode> | auto, replay, record, rescore or live. Default: replay under CI, else auto. Under CI, a mode that calls models prints one warning |
--rerecord | same as --mode record |
--tag <tag> | only cases with this tag; repeatable |
--exclude-tag <tag> | skip cases with this tag; repeatable |
--grep <pattern> | only cases whose id or description matches the regular expression |
--reporter <name[=path]> | pretty, json, junit, markdown, github, or a score exporter: langfuse, braintrust, langsmith, phoenix, otel; repeatable. See reporters |
--strict-export | fail the run when a score export fails (default: print a warning and keep the verdicts) |
--model <a,b,...> | run every case once per model and print a side-by-side table; repeatable. Default: the config's models. See model matrix |
--repeat <n> | re-run each failed case n times and classify it flaky (some re-run passed) or regressed (none did); flaky failures do not fail the run |
--concurrency <n> | cases in parallel; default 4 |
--accept | fill ~ placeholders in expect from this run's recordings |
--watch | re-run when cases, fixtures or code change |
--bail | stop starting cases after the first failure |
--results, --no-results | write the results directory or not. Default: on locally, off under CI |
--tenant <id> | record the run under this tenant |
--config <path> | the config file: viewport.config.{ts,mts,js,mjs} or a pyproject.toml |
Output, the same in both languages (here, two cases rescored against the quickstart example's fixture):
PASS refund-happy-path 3ms
FAIL wrong-first-tool 4ms
x tools.first: expected first issue_refund; got lookup_order
tools: lookup_order > issue_refund | 3 model calls | 423 tokens | $0.002025
1 passed, 1 failed (rescore) in 0.00svalidate
viewport-evals validate [globs...] [--config <path>] loads and validates case files without running them. Every
issue prints as file:line:column path: message, with a did-you-mean where one applies, and hints such as
expect.model_calls: 4 means exactly 4 model calls; did you mean { max: 4 }?. Exits 2 on any issue.
show
viewport-evals show <fixture.json> [--run <n>] [--config <path>] prints a recorded run as a tree: agents, model
calls with tokens and cost, tool calls with arguments, approvals and skill loads.
schema
viewport-evals schema [name] prints a JSON Schema: case (the default), fixture, report, verdict, run,
index, world, invariants or trajectory_diff. --project writes .viewport/case.schema.json: the case schema
with your registered agent names and assertion plugin options, for editor autocomplete. Point case files at a schema
with a modeline: # yaml-language-server: $schema=https://getviewport.com/schemas/evals/case/v1.json.
init
viewport-evals init [--no-ci] creates an example case, a config (TypeScript: viewport.config.ts; Python:
evals/agent.py, and it prints the pyproject.toml section to add) and .github/workflows/evals.yml. Existing files
are left alone.
import
viewport-evals import <source> --case <id> [options] turns production traces into regression tests: a fixture whose
runs are the traces (source: imported), plus a case file with ~ placeholders when --case names a new case. See
production replay.
| Source | Credentials and settings |
|---|---|
langfuse:<trace id> | LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, LANGFUSE_BASE_URL |
langsmith:<trace id> | LANGSMITH_API_KEY, LANGSMITH_ENDPOINT, LANGSMITH_PROJECT_ID (optional) |
braintrust:<root span id> | BRAINTRUST_API_KEY, BRAINTRUST_PROJECT_ID, BRAINTRUST_API_URL |
| a file or directory | trajectory JSON or JSONL segments, trajectory store records, OTLP JSON, or a Langfuse, LangSmith or Braintrust export |
| Flag | Does |
|---|---|
--case <id> | the case to write (required) |
--sample <n> | pick n traces and write one case each (<id>-1, <id>-2, ...) |
--tag <tag> | add a tag to new cases; repeatable, such as --tag golden |
--redact <keys> | extra comma-separated keys whose values are redacted |
--dir <dir> | where new cases go (default: the first cases glob's directory) |
--append | add runs to an existing fixture instead of replacing it |
--out <file> | write the fixture here (one case only; no case file) |
diff
viewport-evals diff <baseline> <candidate> compares two runs: tool steps aligned by longest common subsequence with
argument diffs, the output, and model call, token, cost and latency deltas. Each side is a fixture, a report (with
--case), a trajectory JSON or JSONL file, or an import source. --against imported <candidate> uses the imported
trace as the baseline. --run <n> picks a run (1-based), --json prints evals/trajectory_diff/v1, --out <file>
also writes it, and --fail-on-change exits 1 when anything changed.
ui
viewport-evals ui [dir] [--port 7073] [--open] [--bundle <dir>] serves the results directory on
http://127.0.0.1:7073/, read-only and reachable from this machine only, until ctrl+c. --port 0 picks a free port;
--bundle serves a viewer build. See results and the viewer.
results reindex
viewport-evals results reindex [dir] rebuilds the run, case and attempt indexes of a results directory from its run
directories. Safe while other runs write: the runs index is rewritten under its lock.
migrate
viewport-evals migrate [globs...] [--check] upgrades case files and fixtures written for the pre-1.0
@viewportai/evals format in place (for example calls[].name to tool_name, pass_threshold: 4 to
min_passes: 4). A case file that changes is rewritten in block style: key order is kept, comments and flow style
are not, so review the diff. Files with nothing to migrate are left untouched. TypeScript CLI only; the Python CLI
points you to it.
Environment
| Variable | Sets |
|---|---|
VIEWPORT_EVALS_MODE | the mode |
VIEWPORT_EVALS_CONCURRENCY | the case pool size |
VIEWPORT_EVALS_CASES | case globs, comma-separated |
VIEWPORT_EVALS_FIXTURES_DIR | one directory for all case fixtures |
VIEWPORT_EVALS_INSTRUMENT | true, false, or adapter slugs, comma-separated |
VIEWPORT_EVALS_RESULTS_DIR | the results directory |
VIEWPORT_EVALS_MODELS | the model matrix, comma-separated |
CI | when set (and not false or 0), the default mode is replay, missing fixtures fail, and a config mode that calls models is ignored unless ci_override / ciOverride is set |
GITHUB_ACTIONS | when true, the github reporter is added |
NO_COLOR | plain output |
Precedence, highest first: flags, environment, config file, defaults.
Exit codes
0 everything passed, was skipped or xfailed. 1 a case failed, errored or xpassed. 2 a usage, config or spec
error.