Skip to contentSkip to page list

Docs

Run a test suite

Run every scenario filed in the test suite against the targets sent with the request. The run is filed under a run plan named after the suite and its targets unless a name is sent. A request that names no target answers 422 suite_targets_required.

POST/api/v1/test-suites/{id}/run
Request and response examples
request.py
import osimport requests​origin = "https://app.langwatch.ai"path = "/api/v1/test-suites/<id>/run"api_key = os.environ["LANGWATCH_API_KEY"]headers = {    "X-Auth-Token": api_key,    "Content-Type": "application/json",}payload = {}​response = requests.post(    origin + path,    headers=headers,    json=payload,)print(response.json())

Success

application/json · Generated from schema

{  "scheduled": false,  "batchRunId": "string",  "setId": "string",  "jobCount": 0,  "skippedArchived": {    "scenarios": [      "string"    ],    "targets": [      "string"    ]  },  "items": [    {      "scenarioRunId": "string",      "scenarioId": "string",      "target": {        "type": "prompt",        "referenceId": "string",        "scenarioMappings": {},        "runParameters": {},        "runSecretParameterNames": [          "string"        ]      },      "name": "string"    }  ],  "runPlanId": "string",  "planName": "string",  "created": false,  "platformUrl": "string"}
api-reference/test-suites/run-a-test-suite

Authorization

X-Auth-Tokenstringheaderrequired

Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.

Path parameters

idstringrequired

The test suite id.

At least 1 character

Request body

application/json · Required

targetsobject[]required

The prompts, agents or workflows the suite runs against. A test suite stores none of its own, so a run states them. Every target runs every scenario, so naming more than one compares them in the same run.

typestringrequired
One of"prompt""http""code""workflow""connected""voice"
referenceIdstringrequired
At least 1 character
scenarioMappingsobject
runParametersobject
runSecretParameterNamesstring[]
namestring

The run plan this run joins or creates. Leave it out and the name is derived from the suite name and the targets.

At least 1 characterUp to 200 characters
repeatCountinteger

How many times each scenario and target pairing runs. Between 1 and 5; defaults to 1.

Minimum 1Maximum 5
simulatorModelstring | null

The model that plays the user for every scenario in this run. Leave it out for the scenario or project default.

Option 1string
Option 2null
judgeModelstring | null

The model that judges every scenario in this run. Leave it out for the scenario or project default.

Option 1string
Option 2null
traceQuietPeriodMsinteger | null

Milliseconds (0 to 60000) the agent's trace must stay unchanged before the judge reads it, for every scenario in the run. Overrides each scenario's own setting. Leave it out for the scenario setting or the project's recommendation.

Option 1integer
Option 2null
traceWaitTimeoutMsinteger | null

Milliseconds (1000 to 300000) the judge waits for the agent's trace before a verdict, for every scenario in the run. Overrides each scenario's own setting. Leave it out for the scenario setting or the project's recommendation.

Option 1integer
Option 2null
idempotencyKeystring

Repeat the same key to make a retry join the batch the first call started instead of running everything again. Send the same request with it: the same key over a different configuration starts its own batch. Defaults to a new key per call.

parametersobject

Constant values applied to every scenario in the run, e.g. a fixture id or a tenant. A value supplied here overrides the scenario's own default for that name, and a target that names the same parameter in its runParameters overrides it for that target.

notestring

One short line describing why this batch was run, e.g. a commit hash or what you changed. It is stored on every run of the batch and shown beside the run in the platform. Up to 200 characters.

Up to 200 characters

Responses

200

Success

application/json

scheduledbooleanrequired

True once the runs are queued.

batchRunIdstringrequired

The id of this batch. Every run started here carries it.

setIdstringrequired

The result set the batch is filed under in the platform.

jobCountnumberrequired

How many runs were queued.

skippedArchivedobjectrequired

What the run left out, and why.

scenariosstring[]required

Scenarios left out because they are archived.

targetsstring[]required

Targets left out because they are archived.

itemsobject[]required

Every run this call queued.

scenarioRunIdstringrequired

The id of this single run.

scenarioIdstringrequired

The scenario that was run.

targetobjectrequired

What it was run against.

namestring | nullrequired

The scenario name, when known.

runPlanIdstringrequired

The run plan this run was filed under.

planNamestringrequired

The name that plan answers to.

createdbooleanrequired

True when this run created the plan, false when it joined a plan already there.

platformUrlstring (uri)required

Where to watch this run in the LangWatch platform.

404

Not Found

application/json

errorstringrequired
messagestring
codestringrequired

Documentation