MCP and API workflows are available in production and development. The SDK
platform clients ship in the 0.2.3 packages alongside tracing, real app tests and
simulations. See installing platform clients.
What headless means
Your coding agent can manage every Bench workflow: setup, GitHub repositories, prompts and systems, context, files and datasets, tests and criteria, evaluations, quality results, history, real app testing, production feedback, workspaces and billing. MCP and the SDK call the same API as the dashboard. Your plan and credential permissions apply to every request. Sign-in, GitHub repository grants and payment confirmation still happen with their identity or payment provider. The agent starts those flows and resumes after approval. It cannot grant itself repository access or silently buy a plan. You do not need to complete Bench’s browser onboarding wizard.Start from your agent
Configure a remote HTTP MCP server using your coding agent’s MCP settings:https://mcp.staging.usebench.ai/mcp with a development account.
Complete the connector’s OAuth sign-in. A first-time user receives a normal Free
Bench account. Reconnecting never replenishes spent evaluations.
Paste this into the coding agent:
Copy a setup prompt from Bench
Onboarding and Getting started lead with Set up using a coding agent: one prompt for Claude Code or Codex. It embeds the Bench MCP connect command with a server-only key, so the agent connects the MCP itself, then installs the SDK, sends one request so the system is recognized, registers every prompt, records understanding (purpose asbusiness_intent, policies as rules_constraints,
examples as examples_feedback, architecture plus models, expected volume and
typical request sizes as system_structure), runs Bench’s quick scan, prepares
real app tests, and starts the first bench if you approved the spend. Progress in
the app comes from real receipts (MCP traffic, SDK events, systems, prompts), not
from the agent’s own report. Manual setup (SDK, GitHub, MCP) is a stepper under
Manual setup.
Repository setup, Real app testing, Production, Understanding and the test library
also show a short, scrollable prompt preview with a green Copy prompt button.
Copy the full prompt into your agent. The copied scope contains identifiers for the selected
system and components; it does not copy saved prompts or credentials.
Choose Open in coding agent beside Copy prompt to open the Codex app,
Cursor or Claude Code in your terminal. Each option shows its agent’s icon.
The prompt is also copied so you can paste it if the installed app does not open.
Choose Copy for another agent or terminal to use a different coding agent.
The same menu is available in Fixes.
In the test library, Cases and Criteria remain visible above the compact agent
card. Ask the agent to read the existing library before adding cases or criteria.
In Real app testing, the prompt explicitly covers SDK installation, a safe app
adapter, execution and report publication. Installing the SDK alone does not
prove that an application test ran.
Discover the system from your coding agent
Connecting GitHub is optional for discovery. A coding agent working inside the repository can establish the whole system on its own:- Instrument and run once. Install the Bench SDK (TypeScript
@benchai/sdk, Pythontrybench-sdk, Gogithub.com/trybench/bench-sdk/go, Rusttrybench-sdk) and attach it to what the application already emits: the OpenTelemetry bridge (BenchSpanExporterin TypeScript,bench_sdk.otel.attach(bench)in Python) for frameworks that emit GenAI spans (Pydantic AI, Strands, Mastra, LangChain, OpenAI Agents SDK, Vercel AI SDK and similar),record_external_spanfor frameworks with their own tracing events, or nestedAGENT,LLMandTOOLspans in custom code. One real request creates the system with the runtime, agents, model calls per agent, tools per agent and hand-offs that actually ran, classified by the OpenTelemetry GenAI attributes. Bench makes no model call for this. - Register the model calls. Traces never carry the editable template, so the
agent reads the repository, finds every prompt the system sends (system
prompts, instructions, templates in code, YAML, Markdown or JSON, prompts
assembled across files), groups them by the model call that sends them and calls
bench_register_callson the system with one entry per call: a code-derived key, its messages as fragments holding the resolved text it got by running the code that builds them, the model configuration, the conditions that decide which pieces are sent, and how well it verified the text. A tool may also list anoutput_schema, a JSON Schema for what it returns; Bench checks the replies it simulates for that tool against it, and a schema Bench cannot use is ignored with a warning on that call. Bench stores each call as an evaluable component under the real repository and branch, shown as Call #id, and returns component ids. Registering again with the same keys keeps the same calls; calls missing from a later registration are kept and labelled not seen. - Link runtime evidence. The agent puts each component id on the spans of
the model call that sends that prompt (
bench.component_id), so production evidence and evaluations refer to the same prompt. - Write down what the system is for. From the README, docs, prompts and
code, the agent saves understanding with
bench_put_context_source, each as its own source with the files it came from: a short purpose (business_intent: who the system serves, what it does, what a good result looks like), policies and constraints (rules_constraints), examples (examples_feedback) and system structure (system_structure: architecture plus the models each prompt runs on, expected request volume and typical request sizes). Bench judges results against these, and a bench needs at least a purpose and rules or it stops withbenchmark_needs_context. You can edit or add to them at any time on the system’s Understanding page. - Read the quick scan. As soon as the system exists, its Results tab, Feed, Findings and the AI systems list show quality findings (prompts whose quality is not measured yet, tools and hand-offs not tested yet) and cost findings (each model’s estimated cost per 1,000 typical requests next to a lower-priced model in the same family). No bench is needed for this. See quick scan.
- Prepare real app tests and bench. Check
bench_evaluation_allowance, ask for approval, then start the first bench withbench_start_system_evaluation.
model is accepted
only for accounts with model selection. Connect GitHub later when you want pull
requests with proposed prompt changes or background rescans on new commits.
Connect GitHub
- Read
bench_get_processing_notice. After the user authorizes the notice, callbench_acknowledge_processingwithbodycontaining its exactversion,source: "github"andaccepted: true. - Call
bench_connect_github. Open the returned GitHub URL for the user. Retain the returnedstate; it expires after ten minutes. - The user selects the repositories on GitHub. The callback says to return to the coding agent; it does not create a Bench browser session.
- Call
bench_finish_github_connectionwithbody: { "state": "..." }. If the result ispending, wait the returnedpoll_intervalbefore polling. Only the account that initiated the flow can complete it. - Use
bench_connection_status,bench_activate_installation,bench_list_reposandbench_list_branchesto select the repository and branch. Runbench_scan_repo, then readbench_get_scanandbench_list_systems.
Prompts, systems and understanding
Usebench_upload_prompts for prompt files or pasted text. Authorize the upload
source first. It returns an upload repository and branch that other tools can use.
Repository prompts are updated by editing source and rescanning, or by creating an
approved prompt PR. A saved recommendation does not change deployed code.
Use bench_create_system, bench_update_system, bench_add_system_component
and the system-connection tools to organize prompts, tools and harnesses. Obtain
component and call-site IDs from real scan results.
Read the current context with bench_get_system_context before saving a correction
with bench_save_system_context. Context writes use expected_version; a
context_changed error means re-read and reconcile instead of overwriting.
bench_upload_context_document accepts text, Markdown, JSON and JSONL up to 60 KB.
Use bench_seed_system_context and bench_summarize_system_context to refresh the
saved understanding. Record the models each prompt runs on, the expected request
volume and typical input and output sizes as system_structure context: Bench
uses them to estimate cost and propose cheaper models to bench, and replaces the
estimate with measured usage once the SDK reports production events. Bench never
reports a cost as unknown; unlisted models are priced by family or at a typical
mid-tier rate and labelled as estimates. Provider connections can import selected Langfuse or LangSmith
evidence with explicit content consent.
Cases, criteria and files
bench_save_test_caseandbench_save_criterionadd, update or pause entries for a selected prompt component. Preserve expected values and their JSON types.bench_preview_datasetpreviews CSV, XLSX, JSON or JSONL up to 4 MB.bench_upload_datasetsaves the approved mapping and content. Usebench_remap_datasetto create a corrected version.bench_import_dataset_casesadds a specific dataset version to a prompt’s test library. Uploading a dataset alone does not create an evaluation suite.bench_compare_datasetcompares recorded outputs; it does not run a model or replay the live app. Results remain available throughbench_list_dataset_reports.
content or binary
content_base64. The SDK clients accept text or bytes directly.
Run, inspect and improve
Checkbench_evaluation_allowance, then get approval before starting
bench_start_system_evaluation. Poll bench_get_evaluation. Read exact saved
criteria, cases, scores and recommendations with bench_get_evaluation_artifacts.
Use bench_list_evaluations and bench_list_system_runs for history; cancellation,
reruns, archival and restoration are available through the corresponding tools.
A rerun evaluates current inputs; it does not rewrite historical scores.
Use bench_get_fix_brief to prepare a source change. Run independent checks before
publishing it. bench_open_prompt_pr creates a PR after approval and requires a
paid plan. It does not merge or deploy the change.
Set up real app testing
First install the runtime SDK for the project’s language, unless a compatible version is already installed:
Use the language-specific SDK docs for the installed version. Existing provider
SDKs, Vercel AI SDK and custom provider abstractions can stay in place; instrument
the actual application entry point and model/tool calls.
The coding agent can obtain an SDK key through OAuth using
bench_create_api_key
or bench_get_setup_key, store it in your environment and instrument the app’s
actual entry point. A scoped key can publish traces and reports without account
management authority. Set an explicit application environment such as staging.
Use the SDK’s evaluateSystem / evaluate_system / EvaluateSystem to execute
real app cases, or its simulation API for scripted conversations. Instrument model,
agent and tool calls, check the final result and tool effects, and publish the report
explicitly. See Real app testing for adapters and examples.
Use bench_sdk_status, bench_list_runtime_evaluations and
bench_get_production_health to verify received evidence. Creating a key or writing
an adapter does not prove that a request ran. Uploaded reports are labeled as
client-reported evidence.
Hosted execution can be configured through bench_get_runtime_settings and
bench_set_runtime_settings when it is enabled in that environment. A missing
hosted runner does not prevent local SDK real app tests. Production feedback,
automatic checks and runtime-fix publication have explicit tools and retain their
existing limits and approval requirements.
Plans and credentials
bench_capabilities, bench_evaluation_allowance and bench_list_plans return
pricing_url and upgrade_url for the current environment. Plan-limit errors
also return these links directly, so the agent can immediately show where to
upgrade. Dev links open https://stg.usebench.ai/plans; production links open the
production platform. A key-specific cap points to manage_key_url instead.
Use bench_list_plans, bench_create_checkout or bench_get_billing_portal to
prepare approved subscription changes. Return the Stripe URL for coupon entry and
payment confirmation. Never ask the developer to paste card details into the agent.
Read the operation reference for every input contract and
SDK platform clients to automate the same workflows in code.
