Tests API overview
Create test suites, run them against an agent, and read back transcripts and verdicts — the same Tests you use in the Canvas.
A test suite is a set of test cases for an agent. When you run a suite, the platform plays a simulated user against a committed version of your agent, one conversation per test case, and an AI judge reads each finished transcript and grades it against the behaviors you expect. This API does everything the dashboard’s Tests tab does — build suites, run them, and read the results.
For the dashboard walkthrough of the same concepts, see Tests under Build.
What makes up a test suite
Base URL
Suites are workspace-scoped. A suite created without an app_id is reusable across every agent in the workspace; a suite created with one is bound to that app, and each app can have at most one bound suite.
Requests are authenticated with your API key, as everywhere else in the Voice Agents API — see Introduction.
Rate limits
The per-organization run limits are shared across every key and every user in the org. Exceeding any limit returns 429 with a Retry-After header giving the window in seconds:
Honour Retry-After rather than retrying immediately. If your workload needs more headroom, higher per-key limits can be provisioned per organization — contact Sarvam support.
How the pieces fit together
Create a suite
Create a test suite with a name, shared variables, global_guardrails, and optionally up to 200 test cases inline.
Add and refine test cases
Add a test case with a user_scenario and expected_behaviors; update or duplicate cases as the suite evolves.
Map suite variables onto the app
Create a variable mapping so the suite’s variables reach the agent’s own variables. Without a mapping, runs execute with the agent’s defaults.
Run
Run a test suite against an app_id and committed app_version. The call returns 202 with a run_id immediately; execution happens in the background.
Poll
Get a run until status is completed or failed. completed_executions against total_executions is your progress bar. The response also shows, for each test case, how many of its executions have passed so far.
Read the results
Get test case results returns one entry per execution, each with the full conversation transcript and a verdict for every expected behavior.
Errors
Most errors carry a detail field with a message string:
The exception is 402 — returned by the run endpoints when the workspace has no remaining credits — which carries details (plural) instead:
What this API does not do
These are deliberate, not gaps to work around:
- No deletion. Suites and test cases are created and edited through the API but removed only in the dashboard.
- No run cancellation. A queued run executes to completion; poll it rather than trying to stop it.
- No AI suite generation. Generating test cases from a description is a dashboard feature.
- No export. Read results as JSON from the results endpoint.