Skip to content

Viewport Evals

Record the model calls, fake the world your agent acts on, fast-forward the clock, and assert what it did: the tools it called, the state it left behind, rules over the whole run, its answer and its cost. Offline and deterministic in pytest and vitest, in front of every merge, alongside the observability tool you already use.

On npm and PyPIOn npm and PyPI. Install it today.
npm install @viewportai/evals
npm install @viewportai/evals-viewer
pip install viewport-evals
cases/npx @viewportai/evals run cases/1 failed
  • no-account-deletion2ms
  • order-status-json12ms
  • refund-happy-path13ms
tools.not_called
forbidden tool called: escalate_to_human
args.amount
expected <= 100, got 142.5

lookup_order›issue_refund›escalate_to_human

2 passed, 1 failed, 3 cases in 13ms. Replay, no API keys.

Real output from the Evals CLI, replaying a recorded run.

What it does

Trajectory assertions

Called, not called, in order, only, counts, and argument and result matchers. One vocabulary for tools, approvals, handoffs and skills.

Output checks and judges

Contains, regex, JSON Schema and JSONPath matchers, plus LLM judges whose verdicts are cached in the fixture so replays stay free.

Budgets as assertions

Tokens, cost, latency and model round trips per case. Cost uses the reported price or a maintained price table; an unknown model fails loudly.

Record and replay

The first run records the model traffic at the HTTP boundary. Every run after replays it while your agent code runs for real. No keys in CI, milliseconds per case.

Pass rates and CI gates

Run a case five times and require four passes. Retries absorb crashes, never failed assertions. JUnit, JSON, GitHub and Markdown reports.

Your stack, both languages

pytest and vitest native, plus a CLI in each. Adapters for LangGraph, the Claude Agent SDK, the OpenAI Agents SDK and the AI SDK, or wrap any client.

A real run

refund.case.yaml
id: refund-happy-path
input: "My order A-1001 arrived damaged. I want a refund."
expect:
  tools:
    exactly: [lookup_order, issue_refund]
    not_called: [escalate_to_human]
    calls:
      - name: issue_refund
        args: { order_id: A-1001, amount: { lte: 100 } }
  model_calls: { max: 4 }
  budget: { tokens: 2000, cost_usd: 0.005 }
  output: { contains: "R-1001" }
$ npx @viewportai/evals run cases/
PASS no-account-deletion 2msPASS order-status-json 12msFAIL refund-happy-path 13ms     tools.exactly: expected exactly lookup_order, issue_refund; got lookup_order, issue_refund, escalate_to_human     tools.not_called: forbidden tool called: escalate_to_human     tools.calls[0](issue_refund): args.amount: expected <= 100, got 142.5     tools: lookup_order > issue_refund > escalate_to_human | model calls: 3 | tokens: 525Viewport Evals (replay)  2 passed, 1 failed  3 cases in 13ms
Real output from the TypeScript CLI, replaying a recorded run of the example support agent with a regression added. This case pins the exact order on purpose: the agent must look the order up before it refunds anything.