DOCS / TRAJECTORY SDK
Write agent tests like unit tests.
First-class TypeScript and Python SDKs with native GitHub Actions merge checks and JUnit output.
Quickstart assertion
Replay a versioned Stripe and order-service cassette across 5 trials and verify causal tool ordering.
import { defineEval, expectTrajectory } from "@evalbench/sdk";
export default defineEval({
name: "refund-eligibility-check",
cassette: "./fixtures/stripe-order-912.cassette.json",
trials: 5,
async run(agent) {
const trace = await agent.invoke("Refund order #912, arrived damaged.");
expectTrajectory(trace)
.calledTool("orders.lookup", { orderId: "912" })
.thenCalled("refunds.create", { reason: "damaged" })
.completedWithinTurns(4)
.hasNoHallucinatedIds();
},
}); Core trajectory matchers
| Matcher | Layer | Guarantee |
|---|---|---|
| calledTool(name, args) | Deterministic | Verifies exact tool invocation and partial or strict JSON argument equality. |
| thenCalled(name) | Deterministic | Asserts causal DAG ordering between consecutive or downstream tool calls. |
| completedWithinTurns(n) | Deterministic | Fails infinite retry loops or bloated reasoning trajectories exceeding turn budgets. |
| passesRubric(id, minScore) | Calibrated Judge | Grades final answer against a pinned, versioned rubric using pairwise calibration. |
| passAtK(k, threshold) | Statistical | Executes k independent trials and enforces minimum all-pass consistency rate. |