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.

View as Markdown

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

PartWhat it is
Test caseOne simulated conversation to grade: a user scenario plus the expected behaviors
User scenarioA brief for the simulated user — who they are, what they want, and how they behave
Expected behaviorsThe checks the judge grades for that test case, each Pass or Fail
CategoryA label that groups related test cases
Global guardrailsOne-line rules graded on every test case in the suite, such as “never gives medical advice”
VariablesCommon values that can be reused across test cases
Variable overridesA test case’s own value for a suite variable, used for that case only
Variable mappingConnects suite variables to the agent’s own variables for one app version
Max turnsThe longest a simulated conversation can run before it is cut off
RunOne execution of the suite (or one test case) against a committed app version
FrequencyHow many times each test case executes within a run

Base URL

https://apps.sarvam.ai/api/evals/v1/{org_id}/{workspace_id}/test-suites

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

LimitScopeApplies to
60 requests / minutePer API key, within an org and workspaceEvery Tests endpoint
10 runs / 5 minutesPer organizationRun a test suite
20 runs / minutePer organizationRun a single test case

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:

HTTP/1.1 429 Too Many Requests
Retry-After: 60

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

1

Create a suite

Create a test suite with a name, shared variables, global_guardrails, and optionally up to 200 test cases inline.

2

Add and refine test cases

Add a test case with a user_scenario and expected_behaviors; update or duplicate cases as the suite evolves.

3

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.

4

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.

5

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.

6

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:

{ "detail": "Test suite already exists for app_id: clinic-front-desk" }

The exception is 402 — returned by the run endpoints when the workspace has no remaining credits — which carries details (plural) instead:

{ "details": "Insufficient credits. Please top up your wallet to continue." }
StatusWhen
400The app did not answer the pre-run ping — check the app_id and app_version
401Missing or invalid X-API-Key
402No remaining credits; top up to resume runs
403The key is not valid for this org or workspace
404No such suite, test case, run, or mapping in this workspace
409Creating an app-bound suite for an app that already has one
429Rate limit exceeded — honour Retry-After

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.

Next