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.
Create a new scenario
Create a new scenario
Try this endpoint
app.langwatch.ai
API key · X-Auth-Token
Kept in this tab. Cleared when you reload.
The parameters this scenario declares by name, each with an optional description and default. A run supplies values for these names, readable from the scenario's own text as params.NAME. A parameter marked secret carries no default: its value is supplied per run, encrypted, delivered to the target as secrets.NAME, and never readable from the scenario's own text.
Model for the simulated user, e.g. openai/gpt-6-luna. Null uses the project default.
Model for the judge, e.g. openai/gpt-6-luna. Null uses the project default.
Milliseconds (0 to 60000) the agent's trace must stay unchanged before the judge reads it. Null uses the project's recommendation.
Milliseconds (1000 to 300000) the judge waits for the agent's trace before a verdict. Null uses the project's recommendation.
Maximum conversation turns for a run of this scenario. Null uses the default.
Minimum conversation turns before the judge may end the run. Null uses the default.
The test suite to file this scenario in. It must name a non-archived test suite of the same project. null files the scenario into the project's Default test suite.
The value for each field the test suite declares, keyed by field identifier: text, a number or a boolean, in the field's own type. A field the suite does not declare answers 422 scenario_field_unknown; a value of the wrong type answers 422 scenario_field_type_invalid. An empty value clears the field.
Absent or "standard" plays a user simulator. "red_team" plays an attacker and requires redTeam; a standard scenario with redTeam answers 422 scenario_red_team_config_mismatch.
Refused: only applying a suite template marks a scenario with its template.
This sends a live request to app.langwatch.ai.
Request and response examples
import osimport requestsorigin = "https://app.langwatch.ai"path = "/api/v1/scenarios"api_key = os.environ["LANGWATCH_API_KEY"]headers = { "X-Auth-Token": api_key, "Content-Type": "application/json",}payload = { "redTeam": { "owaspIds": [], },}response = requests.post( origin + path, headers=headers, json=payload,)print(response.json())const url = "https://app.langwatch.ai/api/v1/scenarios";const response = await fetch(url, { method: "POST", headers: { "X-Auth-Token": process.env.LANGWATCH_API_KEY!, "Content-Type": "application/json", }, body: JSON.stringify({ "redTeam": { "owaspIds": [] } }),});const data = await response.json();curl --request POST \ --url 'https://app.langwatch.ai/api/v1/scenarios' \ --header "X-Auth-Token: $LANGWATCH_API_KEY" \ --header 'Content-Type: application/json' \ --data '{"redTeam":{"owaspIds":[]}}'Call the LangWatch API from this project.Request: POST https://app.langwatch.ai/api/v1/scenariosReference: https://langwatch.ai/docs/api-reference/scenarios/create-scenarios.mdAuthentication: send the X-Auth-Token header, read from the LANGWATCH_API_KEY environment variable. Never hard-code the key.Body (application/json):```json{ "redTeam": { "owaspIds": [] }}```Use the HTTP client this project already uses, handle non-2xx responses, and show me the parsed result.Success
application/json · Generated from schema
{ "id": "string", "name": "string", "situation": "string", "criteria": [ "string" ], "labels": [ "string" ], "parameters": [ { "name": "string", "description": "string", "defaultValue": "string", "secret": false, "type": "string", "options": [ "string" ], "required": false } ], "simulatorModel": "string", "judgeModel": "string", "traceQuietPeriodMs": -9007199254740991, "traceWaitTimeoutMs": -9007199254740991, "maxTurns": -9007199254740991, "minTurns": -9007199254740991, "testSuiteId": "string", "fields": {}, "platformUrl": "string"}Request body
application/json · Required
namestringrequiredsituationstringrequiredcriteriastring[][]labelsstring[][]parametersobject[]The parameters this scenario declares by name, each with an optional description and default. A run supplies values for these names, readable from the scenario's own text as params.NAME. A parameter marked secret carries no default: its value is supplied per run, encrypted, delivered to the target as secrets.NAME, and never readable from the scenario's own text.
simulatorModelstring | nullModel for the simulated user, e.g. openai/gpt-6-luna. Null uses the project default.
judgeModelstring | nullModel for the judge, e.g. openai/gpt-6-luna. Null uses the project default.
traceQuietPeriodMsinteger | nullMilliseconds (0 to 60000) the agent's trace must stay unchanged before the judge reads it. Null uses the project's recommendation.
traceWaitTimeoutMsinteger | nullMilliseconds (1000 to 300000) the judge waits for the agent's trace before a verdict. Null uses the project's recommendation.
maxTurnsinteger | nullMaximum conversation turns for a run of this scenario. Null uses the default.
minTurnsinteger | nullMinimum conversation turns before the judge may end the run. Null uses the default.
testSuiteIdstring | nullThe test suite to file this scenario in. It must name a non-archived test suite of the same project. null files the scenario into the project's Default test suite.
fieldsobjectThe value for each field the test suite declares, keyed by field identifier: text, a number or a boolean, in the field's own type. A field the suite does not declare answers 422 scenario_field_unknown; a value of the wrong type answers 422 scenario_field_type_invalid. An empty value clears the field.
kindstringAbsent or "standard" plays a user simulator. "red_team" plays an attacker and requires redTeam; a standard scenario with redTeam answers 422 scenario_red_team_config_mismatch.
"standard""red_team"redTeamobjectThe attack a red_team scenario plays: goal, OWASP ids, strategy and turn budget.
sourceTemplateIdanyRefused: only applying a suite template marks a scenario with its template.
Responses
201Success
application/json
idstringrequirednamestringrequiredsituationstringrequiredcriteriastring[]requiredlabelsstring[]requiredparametersobject[]requiredsimulatorModelstring | nullThe model that plays the user, or null for the project default. Absent on servers that predate model overrides on this family.
judgeModelstring | nullThe model that judges the run, or null for the project default. Absent on servers that predate model overrides on this family.
traceQuietPeriodMsinteger | nullMilliseconds the agent's trace must stay unchanged before the judge reads it, or null for the project's recommendation. Absent on servers that predate judge trace settings.
traceWaitTimeoutMsinteger | nullMilliseconds the judge waits for the agent's trace before a verdict, or null for the project's recommendation. Absent on servers that predate judge trace settings.
maxTurnsinteger | nullThe most conversation turns a run of this scenario takes, or null for the default. Absent on servers that predate turn limits on this family.
minTurnsinteger | nullThe fewest conversation turns before the judge may end a run, or null for the default. Absent on servers that predate turn limits on this family.
testSuiteIdstring | nullThe test suite this scenario is filed in, or null when unfiled. Absent on servers that predate test suites.
fieldsobjectThe value this scenario carries for each field its test suite declares, keyed by field identifier. A field with no value has no key. Absent on servers that predate suite fields.
platformUrlstring (uri)required