Create a scenario
SDK platic.evals.scenarios.create()
Define a test conversation and what the agent should achieve. Send its content in scenario with a unique scenarioId; version 1 is created and active for use in a suite.
Example
curl -X POST "https://api.platic.ai/v1/evals/scenarios" \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"scenario": {
"scenarioId": "greets",
"title": "Greets the customer",
"type": "script",
"user": { "steps": ["Hola"] },
"expect": { "checks": [{ "kind": "message_contains", "text": "Hola", "role": "agent" }] }
}
}' await platic.evals.scenarios.create({
scenario: {
scenarioId: "greets",
title: "Greets the customer",
type: "script",
user: { steps: ["Hola"] },
expect: { checks: [{ kind: "message_contains", text: "Hola", role: "agent" }] },
},
}); Request body
{
"scenario": {
"scenarioId": "no_invented_prices",
"title": "Asks about prices",
"type": "persona",
"user": {
"persona": "Customer comparing options. Writes short and wants concrete numbers.",
"goal": "Find out how much it costs and what it includes.",
"behaviors": ["Asks the price in the first message", "Asks to confirm whether there are extra costs"]
},
"expect": {
"outcome": "Gives only the prices that are in its knowledge and never makes up figures.",
"checks": [{ "kind": "assistance_requested", "expected": false, "severity": "should" }]
},
"run": { "nTrials": 3, "maxTurns": 8 }
}
} | Field | Type | Description | Required |
|---|---|---|---|
scenario | object | The scenario's content. All its fields are in Scenario format. | ✓ |
scenario.scenarioId | string | You choose it: unique in the workspace, up to 200 characters. | ✓ |
scenario.profileId | string | The profile. If you do not send it, general. | — |
Response
201 with the scenario:
{
"status": "success",
"data": {
"scenarioId": "no_invented_prices",
"version": 1,
"scope": "workspace",
"status": "active",
"proposedBy": "user",
"contentHash": "sha256:a41d…",
"scenario": {
"scenarioId": "no_invented_prices",
"title": "Asks about prices",
"profileId": "general",
"type": "persona",
"run": { "nTrials": 3, "maxTurns": 8 }
}
}
} The response includes the complete scenario; the example shows only part of it. Defaults are applied.
Response fields
The same as in List scenarios.
Errors
| Status | details.code | When |
|---|---|---|
400 | INVALID_REQUEST | The content is not valid. details.issues has the path of each problem. It includes a profileId that does not exist, setup with content and the state_equals check (see what is no longer accepted). |
409 | EVAL_CONFLICT | A scenario with that scenarioId already exists. Choose another, or save a new version of the existing one. |
With a profileId that does not exist:
{
"code": 400,
"error": "Bad Request - The request has validation errors",
"details": {
"code": "INVALID_REQUEST",
"message": "Ese perfil no existe. Usa GET /v1/evals/profiles o omite profileId para usar general."
}
} Notes
- It requires permission to edit agents (any).
- Next: create a suite with this scenario.