Evals

Conformance

How one case spec gives byte-identical verdicts in Python and TypeScript, and how the shared vectors prove it.

Viewport Evals has two native implementations, not a binding: the Python engine does not shell out to Node, and the TypeScript engine does not call Python. A team can write cases once and run them from pytest in one service and vitest in another. That only works if both give the same answer, so the answer is specified as data.

What is identical

For any case and any trajectory, both languages produce the same normalized verdict JSON: the same status, the same pass counts, the same assertion names in the same order, and the same messages, byte for byte. Normalization drops only what cannot be identical: durations, timestamps and absolute paths.

Messages are part of the contract. Both languages render them from one versioned catalog, spec/messages/v1.yaml, with numbers printed the ECMAScript way. Changing a message's wording is a catalog version bump, never a silent edit. That is why a failure reads the same in pytest and in pnpm exec viewport-evals run.

The rest of the shared surface:

  • Schemas in spec/schemas/evals/ (case, fixture, verdict, report) are hand-written JSON Schema; the TypeScript types and the Python models are generated from them.
  • Fixtures are canonical JSON, so the trajectory part is byte-identical whichever language wrote it.
  • Prices come from one dated table, spec/pricing/v1.json, so cost budgets agree.
  • Reports from --reporter json follow evals/report/v1 in both CLIs.

Recorded HTTP exchanges are tagged with the recording language. Replaying one language's exchanges from the other is best effort, because provider SDKs send different defaults; trajectories, and therefore rescore, are fully portable.

The vectors

spec/conformance/ holds the vectors both test suites load:

DirectoryWhat a vector pins
verdicts/evaluation: a case plus stored trajectories gives this verdict
runner/modes, thresholds, retries, early stop, staleness, skip and xfail, judges, with a scripted agent
fixtures/reading then writing a fixture gives the same bytes
load/valid/a case file loads into these normalized cases (defaults merged)
load/invalid/a case file fails with these issues: code, path, line and column

Each language's test suite diffs its output against each vector's expected. On top of that, node scripts/conformance.mjs (run by make conformance and in CI) runs both implementations in emit mode and diffs them against each other, so a wrong expected cannot hide a divergence. A coverage test fails the build when an expectation key, runner error code or catalog message has no vector.

What this means for you

  • Pick the language per service. A case file means the same thing everywhere.
  • A plugin must exist in each language that runs a case that uses it; an unregistered name fails the use: assertion and names it.
  • Scripted model fakes follow one specification (spec/testing/usage.md), including the deterministic token estimate, so a budget asserted against a fake is stable across languages.

Next: the guides, starting with LangGraph.

On this page