Viewport Core
The shared runtime under Viewport Evals, HITL and Context. Trajectories, the Matcher, tools, middlewares and the ambient event sink, in Python and TypeScript.
Status: Beta. Version 0.1.0 is on npm (@viewportai/core) and PyPI (viewport-core).
Viewport Core is the small runtime every Viewport package builds on. You use it directly when you write an adapter for an agent stack, a custom assertion, a tool middleware, or tests that need deterministic trajectories. Most users meet it through Evals, HITL and Context, which re-export what they need.
It gives you five things, identical in Python and TypeScript:
- Trajectory: the typed record of one agent run. JSON Schema is the source of truth; pydantic models and TypeScript types are generated from it.
- Matcher: one value-matching language for eval expectations and policy conditions, with tri-state results.
- Tools and middlewares: a stack-neutral
Tooland(tool) => toolmiddlewares that record themselves. - The ambient sink: events emitted inside
trace()are collected into one trajectory, across packages. - Deterministic building blocks: injectable clocks and ids, canonical JSON, RFC 8785 digests, strict YAML with source locations, and errors that say where and what.
from viewportai.core import match
result = match(
{"tool_name": "issue_refund", "args": {"amount": {"lte": 100}}},
{"tool_name": "issue_refund", "args": {"order_id": "A-1001", "amount": 42.5}},
)
print(str(result.passed).lower()) # trueimport { match } from "@viewportai/core";
const result = match(
{ tool_name: "issue_refund", args: { amount: { lte: 100 } } },
{ tool_name: "issue_refund", args: { order_id: "A-1001", amount: 42.5 } },
);
console.log(result.passed); // trueBoth languages pass the same 600+ conformance vectors in spec/conformance, so a matcher, a YAML file or a
digest gives the same answer, the same failure path and the same message in either one.
Next: the quickstart.