A minimal suite for docsgpt-cli bench. Copy this directory to ./bench in
your project (the default suite location), point bench.yaml at one of your
agents, and run:
docsgpt-cli bench # runs ./bench
docsgpt-cli bench examples/bench # or point at any suite directoryUseful variants:
docsgpt-cli bench -k json # filter cases by name/description
docsgpt-cli bench --tags smoke # filter by tags
docsgpt-cli bench --repeat 3 # re-run each case, tolerate flakes with min_pass
docsgpt-cli bench --json > run.json # machine-readable output
docsgpt-cli bench --junit report.xml # JUnit XML for CI
docsgpt-cli bench --vs other-agent # A/B compare two agents
docsgpt-cli bench --model gpt-5.6-terra # pin one model for every case
docsgpt-cli bench --matrix m1,m2,m3 # run once per model, print the comparison table
docsgpt-cli bench --run-tag nightly # tag requests for server-side telemetry
docsgpt-cli bench --target stream --agent-id <id> # run an agent by id with your personal access token
docsgpt-cli bench --baseline last # diff against the previous saved run
docsgpt-cli bench record # snapshot answers into golden.json files
docsgpt-cli bench init my-suite # scaffold a fresh suiteSecrets stay out of YAML: any value can reference environment variables as
${VAR} (resolved from your shell, the suite's .env, or ./.env — real env
wins; $$ escapes a literal dollar; unset variables fail the load). So commit
agent: ${DOCSGPT_BENCH_KEY} and keep the key in .env (gitignored) or CI
secrets. The webhook token can also be passed with --webhook-url.
Agent by id (personal access token): instead of an agent API key, the
stream and answer targets can address an agent by id — set agent_id: in
bench.yaml or a case.yaml (mutually exclusive with agent:), or pass
--agent-id. The request then carries agent_id plus
Authorization: Bearer <token> (scope chat:run), with the token taken from
--token, DOCSGPT_TOKEN or docsgpt-cli login. See 09-agent-id.
Each case is a directory with a case.yaml (a question or a list of
turns + expect assertions) and optional attachment files. Targets: v1
(OpenAI-compatible endpoint, reports token usage; stream: true for SSE),
stream (native SSE endpoint; records time-to-first-token and frame types),
answer (native /api/answer JSON endpoint), webhook (async agent webhook +
task polling; no attachments, no turns). Run history is stored under
~/.docsgpt/bench/<suite-name>/.
Case features worth knowing:
model:(suite/case) or--modelsends a model id with every request (model_idon stream/answer,modelon v1); the effective model is stamped into every result.--matrix a,b,cruns the suite once per model and prints pass rate, mean judge score, p50/p95 latency, TTFT, tokens/case, cost/case.turns:runs a multi-turn conversation (conversation_idcarried on stream/answer, messages replayed on v1); per-turnexpectis optional, the case-levelexpectgrades the last answer.expect.error:makes a server error the expected outcome (negative cases); a successful answer then fails the case.expect.stream:asserts SSE integrity (end_frame,error_frame,thought: present|absent,frames_contain) on the stream target;expect.limits.max_first_token_secondsbudgets time to first output.attachments_mode: inline(v1 only) sends files as base64 content parts instead of uploading them first.- Cost:
usage × priceper run when the server's/api/modelsexposes pricing or the suite'spricing:map does; the report shows$per case and totals.
Cases in this suite: 01-basic-answer, 02-json-output, 03-attachment,
04-webhook, 05-multi-turn, 06-negative-error, 07-stream-integrity,
08-answer-endpoint, 09-agent-id.
Exit codes: 0 all passed, 1 failures, 2 configuration error — so
docsgpt-cli bench drops straight into CI.