New version of a scenario

SDK platic.evals.scenarios.addVersion()

Edit a scenario by saving a new version. Send the complete content in scenario, including profileId, and specify scenarioId in the URL. Previous versions are preserved.

Suites with a pinned version keep using it; other suites use the new version in their next run. Editing a platform scenario creates a copy in your workspace.

Example

await platic.evals.scenarios.addVersion("greets", {
  scenario: {
    scenarioId: "greets",
    profileId: "general",
    title: "Greets the customer by name",
    type: "script",
    user: { steps: ["Hola, soy Ana"] },
    expect: { checks: [{ kind: "message_contains", text: "Ana", role: "agent" }] },
  },
});

Path parameters

ParameterTypeDescriptionRequired
scenarioIdstringThe scenario you add the version to✓

Request body

{
  "scenario": {
    "title": "Books an appointment",
    "profileId": "general",
    "type": "script",
    "user": { "steps": ["Hi, I want to book an appointment", "Tuesday afternoon", "Under the name Ana López"] },
    "expect": {
      "outcome": "The agent asks only for the missing details and confirms the day and time.",
      "checks": [{ "kind": "tool_called", "tool": "book_appointment" }]
    },
    "run": { "nTrials": 3 }
  }
}
FieldTypeDescriptionRequired
scenarioobjectThe complete content of the new version, with the fields of Scenario format. scenarioId comes from the route.✓
scenario.profileIdstringHere it does not default to general: send it, normally the same as the previous version.✓

Response

201 with the new version:

{
  "status": "success",
  "data": {
    "scenarioId": "books_tuesday_appointment",
    "version": 3,
    "scope": "workspace",
    "status": "active",
    "proposedBy": "user",
    "contentHash": "sha256:0c7e…",
    "scenario": {
      "scenarioId": "books_tuesday_appointment",
      "title": "Books an appointment",
      "profileId": "general",
      "type": "script",
      "run": { "nTrials": 3, "maxTurns": 12 }
    }
  }
}

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

Statusdetails.codeWhen
400INVALID_REQUESTThe content is not valid. details.issues has the path of each problem. It includes setup with content and the state_equals check (see what is no longer accepted).
404EVAL_NOT_FOUNDThe scenario does not exist in your workspace.

Notes

  • Past runs do not change: each trial reports the version it tested in scenarioVersion.
  • It requires permission to edit agents (any).