Skip to main content

Agent Testing API

Test cases and test runs that check an agent against expected behavior.

📄️Import evals from bundle onto existing agent

Imports the evals from an exported agent bundle onto an existing agent, leaving the agent itself untouched. Accepts the same file as `importAgents` — `application/json` or `multipart/form-data` with a `file` field — and reads its `agent.evals` plus the `agent.evalMockBaseline` those evals rely on. Evals are matched by name, so re-importing the same file updates the test cases rather than duplicating them. Nothing is executed: use `POST /api/v1/agents/{agentId}/test-cases/{testCaseId}/run/` to run one. Fails with 422 when an imported eval references an evaluation criterion the target agent does not have.

📄️Run test case

Queues the evaluation and returns immediately with a stable `runId`. The queued run is visible immediately; the worker atomically claims it before evaluation. The evaluation replays the eval spec steps against the agent and records per-step results. Poll `GET /api/v1/agents/{agentId}/test-runs/{runId}/` to track progress and use `POST /api/v1/agents/{agentId}/test-runs/{runId}/stop/` to cancel. The test case must be enabled and associated with an application. Accepts an optional JSON body `{ repeats?, minPassRate?, target? }` to override the eval spec's own values for this run only and/or evaluate a specific branch instead of the current main draft.

📄️Get test run

Returns the run with the parent test case id and name and an `overallScore` averaged from the smart assertion scores. `responseShape=summary` replaces the heavy `stepResults` with one-line step verdicts — the right shape for polling; the default `full` response embeds the complete `stepResults`. While `status` is `RUNNING`, `passed` and `finishedAt` are null, so poll this endpoint until the run finishes. The `applicationId` query parameter is optional: when omitted, it is derived from the run itself.