Copy this into your coding agent
Paste into Cursor, Codex, Claude Code, or another coding agent in your project.
The examples below use TypeScript. Each language guide includes its native API and a runnable simulation.
Run a small suite
Complete SDK setup, then run this on a test server, never a live customer request path. Use synthetic inputs and safe tool dependencies. The SDK does not sandbox your application or prevent its external side effects.runYourActualApplication is your application’s entry point, not a prompt assembled
by Bench. Instrument its nested model, agent and tool calls with bench.trace.
Await every call, including completion of streams, before returning the final result.
Return the business outcome you want to check, such as a fixture database’s refund
state. A model saying “refunded” is not evidence that a refund actually happened.
Cases, criteria and coverage
An expected output is an exact typed comparison. Required tools must have a successful recorded call. Forbidden tools must have no recorded call. Tool/model call budgets catch unexpected loops. These are deterministic checks, not semantic judgments. Use suite partitions deliberately:
The SDK accepts 1 to 100 cases. Each case has at most 90 tool assertions and 100
captured spans. Missing assertions, missing root evidence, capture limits, timeout,
or unfinished child work produce an incomplete result. Timeouts are cooperative;
untrusted or non-cooperative code needs an isolated process or sandbox. The suite
stops after a timeout or unfinished work rather than overlapping the next case.
Reports pin source revision, context revision, suite hash and planned case count.
They retain redacted inputs, expected outcomes, checks and observed trajectories.
Redaction can remove detail needed for a repair; inspect it before sharing a brief.
Only explicitly instrumented behavior is covered. Unrecorded calls are unknown.
View results
Open AI systems → your system → Real app testing. Browse cases and their tool, harness or quality findings. Review shows checks and recorded execution. Copy fix prompt includes the case and pinned revisions for your approved coding agent. Saved SDK reports are labeled SDK test report. They are not a server certification, a prompt-benchmark score, or proof that a production issue was fixed. Reports are limited to 500 KB, deduplicated, and retained for 30 days. Bench accepts up to 100 reports per system during that window; keep additional reports locally. A repository-scoped key may access only its permitted systems. MCP exposes these reports throughbench_get_runtime_evaluations, without an
evaluation charge. It does not execute the customer’s application itself.
Next: run tests in CI, SDK setup and production checks.
Simulate a customer conversation
UsesimulateSystem to replay up to 20 scripted customer turns through a fresh
application session for each case. The session keeps your application’s routing,
prompts, tool wrappers and retries. Give its external services test fixtures, then
read those fixtures to check what actually happened.
For example, a repeated request must not refund the same order twice:
createPaymentFixture and createSupportAgent are your application’s test adapters,
not SDK exports. The observer should read the fixture ledger or test database;
it must not reconstruct state from the final answer. Missing state evidence makes
the result incomplete. An answer saying “refunded 240 fails the outcome check.
The turns are scripted and repeatable. Bench does not generate an adaptive customer
inside this API or automatically clone your external services. Call your real
application entry point from turn; replacing its retry wrapper with a mock would
hide retry bugs. Fixture state is reset by creating a new session for every case.
Keep capability, incident and regression cases together
Freeze the same cases, expected state and context revision before comparing changes.
A fix that stops all retries may fix duplication but break recovery. A fix using
one shared idempotency key may break the second legitimate order. Inspect both
failures and previously passing cases before accepting a recommendation.
The SDK records client-provided test evidence. It does not authorize a pull request
or deploy a change. Your application’s provider calls may incur provider charges;
producing a local SDK report does not consume Bench evaluations.

