Trajectory
Test Cases

01 Deterministic agent testing

Assert the path.
Not the prose.

Pin down critical tool calls, retries, and ordering in CI—without transcript snapshots or an LLM judge.

npm i -D trajectory-test-cases

Zero runtime dependencies· ESM + CJS · Typed · MIT

Paper tool-event cards connected by a blue dependency cord, with a red retry mark and green pass tab.
Partial order keeps the invariant. Nondeterministic prose stays out.

Required calls

Ordering edges

Forbidden actions

Retry counts

02 Local trace bench

Break a fixture.
Read the evidence.

Edit either JSON panel or load a seeded mutation. The same matcher shipped in the npm package runs here, entirely in your browser.

fixture.json
JSON fixture defining expected and forbidden tool actions.
events.json
JSON array of already scrubbed tool events.

No network. No model. Same input, same verdict.

Inspection trace

FAIL

03 A smaller test primitive

Keep only the invariants that matter.

01

Record scrubbed events

You supply the argument scrubber. Raw secrets and payloads never enter the trace by default.

02

Declare partial order

Name required actions, attach only meaningful “after” edges, and forbid dangerous calls.

03

Fail with evidence

Get stable exit codes, structured JSON, and a line-by-line trace that explains the mismatch.

04 Tiny public surface

One checker.
Four tools.

The library is model-agnostic and dependency-free. Use the recorder, matcher, fault injector, or renderer independently.

Read the full API
agent.test.ts
import {
  checkTrajectory,
  createRecorder,
  injectRetryFault
} from "trajectory-test-cases";

const trace = createRecorder({
  scrubArgs: (tool, args) => redact(args)
});

const result = checkTrajectory(
  fixture,
  trace.events()
);

expect(result.pass).toBe(true);