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.
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.
Try this endpoint
app.langwatch.ai
API key · X-Auth-Token
Kept in this tab. Cleared when you reload.
The test suite id.
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.
The run plan this run joins or creates. Leave it out and the name is derived from the suite name and the targets.
How many times each scenario and target pairing runs. Between 1 and 5; defaults to 1.
The model that plays the user for every scenario in this run. Leave it out for the scenario or project default.
The model that judges every scenario in this run. Leave it out for the scenario or project default.
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.
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.
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.
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.
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.
This sends a live request to app.langwatch.ai.
Request and response examples
import osimport requestsorigin = "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())const url = "https://app.langwatch.ai/api/v1/test-suites/<id>/run";const response = await fetch(url, { method: "POST", headers: { "X-Auth-Token": process.env.LANGWATCH_API_KEY!, "Content-Type": "application/json", }, body: JSON.stringify({}),});const data = await response.json();curl --request POST \ --url 'https://app.langwatch.ai/api/v1/test-suites/<id>/run' \ --header "X-Auth-Token: $LANGWATCH_API_KEY" \ --header 'Content-Type: application/json' \ --data '{}'Call the LangWatch API from this project: Run a test suite.Request: POST https://app.langwatch.ai/api/v1/test-suites/<id>/runReference: https://langwatch.ai/docs/api-reference/test-suites/run-a-test-suite.mdAuthentication: send the X-Auth-Token header, read from the LANGWATCH_API_KEY environment variable. Never hard-code the key.Body (application/json):```json{}```Use the HTTP client this project already uses, handle non-2xx responses, and show me the parsed result.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"}Not Found
application/json · Generated from schema
{ "error": "string", "message": "string", "code": "string"}Path parameters
idstringrequiredThe test suite id.
Request body
application/json · Required
targetsobject[]requiredThe 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.
namestringThe run plan this run joins or creates. Leave it out and the name is derived from the suite name and the targets.
repeatCountintegerHow many times each scenario and target pairing runs. Between 1 and 5; defaults to 1.
simulatorModelstring | nullThe model that plays the user for every scenario in this run. Leave it out for the scenario or project default.
judgeModelstring | nullThe model that judges every scenario in this run. Leave it out for the scenario or project default.
traceQuietPeriodMsinteger | nullMilliseconds (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.
traceWaitTimeoutMsinteger | nullMilliseconds (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.
idempotencyKeystringRepeat 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.
parametersobjectConstant 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.
notestringOne 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.
Responses
200Success
application/json
scheduledbooleanrequiredTrue once the runs are queued.
batchRunIdstringrequiredThe id of this batch. Every run started here carries it.
setIdstringrequiredThe result set the batch is filed under in the platform.
jobCountnumberrequiredHow many runs were queued.
skippedArchivedobjectrequiredWhat the run left out, and why.
itemsobject[]requiredEvery run this call queued.
runPlanIdstringrequiredThe run plan this run was filed under.
planNamestringrequiredThe name that plan answers to.
createdbooleanrequiredTrue when this run created the plan, false when it joined a plan already there.
platformUrlstring (uri)requiredWhere to watch this run in the LangWatch platform.
404Not Found
application/json
errorstringrequiredmessagestringcodestringrequired