---
docId: doc_481e8eafcc9e47d7972aa5469767b478
title: Scenario format
description: What a scenario contains, script or persona, its checks, profiles and versions.
---

<script>
  import { Note, Collapsible } from '$lib/components';
</script>

# Scenario format

Define what the customer will say and what the agent should achieve in a test conversation. Choose `type: "script"` to write the customer’s messages, or `type: "persona"` to let an AI converse as the customer you describe. Send the content in `scenario` when you create or update the test.

## A scenario's content

Use these fields to [create a scenario](/api-reference/evals/scenarios/create) or [save a new version](/api-reference/evals/scenarios/new-version). [List scenarios](/api-reference/evals/scenarios/list) returns the same content with defaults applied.

```json
{
  "scenarioId": "books_tuesday_appointment",
  "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", "argsInclude": { "name": "Ana López" } },
      { "kind": "message_contains", "text": "Tuesday", "severity": "should" },
      { "kind": "assistance_requested", "expected": false }
    ]
  },
  "run": { "nTrials": 3 }
}
```

| Field | Description |
|-------|-------------|
| `scenarioId` | You choose it when you create: unique in the workspace (up to 200 characters). When you add a version it comes from the route. |
| `title` | Display name. |
| `profileId` | Optional when you create: if you do not send it, `general`. Required in a new version. See [profiles](#profiles). |
| `type` | `script` (you write the customer's messages) or `persona` (an AI converses as the customer you describe). |
| `user.steps` | Script: the customer's messages, in order. At least one and no more than `run.maxTurns`. |
| `user.persona` | Persona: who the customer is and how they write. |
| `user.goal` | Persona: what they want to achieve. Required in a persona. |
| `user.behaviors` | Persona: how they behave, one sentence per element. |
| `user.facts` | Persona: details the persona knows and can give, for example `{ "name": "Luis" }`. |
| `expect.outcome` | Expected result, in words. An AI checks it against the complete conversation. |
| `expect.process` | How it must reach the result, in words. An AI checks it against the conversation in order. |
| `expect.checks` | [Exact checks](#checks). |
| `run.nTrials` | How many times it repeats (1–32). If you do not send it, 4; the platform creates scenarios with 3. |
| `run.maxTurns` | Maximum agent turns (1–40). If you do not send it, 12. |

A scenario needs at least one check, an `outcome` or a `process`. A trial passes when all the `must` checks, the `outcome` and the `process` are met (see [Results](/api-reference/evals/results#when-a-trial-passes)).

## Checks

All accept `severity`: `must` (the default; if it fails, the trial does not pass) or `should` (it is reported, but does not make it fail).

| `kind` | Fields | It is met when… |
|--------|--------|-----------------|
| `message_contains` | `text`, `role` (`agent` by default, or `user`), `caseSensitive` (`false`) | Some message of that role includes the text. |
| `tool_called` | `tool`, `argsInclude` (optional) | The agent calls the tool at least once. With `argsInclude`, each key must be equal in the arguments of some call. |
| `tool_not_called` | `tool` | The agent never calls the tool. |
| `tool_called_before` | `first`, `then` | `first` is called before `then`. |
| `tool_call_sequence` | `calls`: `[{ "tool", "argsInclude"? }]` | The calls happen in that order. There can be others before, after or between them. |
| `assistance_requested` | `expected` (`true` or `false`) | `true`: the agent asked a person for help at some point. `false`: it never asked. To not check it, leave it out. |

Tools are named as the agent sees them. They are the agent's real [tools](/api-reference/tools): there are no simulated tools.

If `assistance_requested` has `expected: true`, assistance is disabled for the evaluated version and no request is recorded, the check fails with `La versión probada no tiene activada la asistencia.` See [human assistance in evals](/api-reference/evals#what-you-need-to-know).

## Profiles

`profileId` says what type of agent the scenario targets. Today there are two: `general` (any agent) and `sales` (sales). The full catalog comes from [List profiles](/api-reference/evals/scenarios/profiles). When you create, if you do not send it, it takes `general`; in a new version you have to send it.

## Versions

<Collapsible summary="Pinned versions, history and scenario author">

Every change saves the next version (`version`) with [New version of a scenario](/api-reference/evals/scenarios/new-version). Versions never change:

- Suites that pinned a version (`members[].version`) keep using it; the others take the new one in their next run.
- A run freezes each scenario's version when it starts, and the trial reports it in `scenarioVersion`.
- `contentHash` is the content's fingerprint: two versions with the same content have the same one.
- [Archiving](/api-reference/evals/scenarios/archive) a scenario archives all its versions; past runs keep their conversations.

Whoever writes the scenario is recorded in `proposedBy`: `agent` if the platform's AI agent builder wrote it, `user` otherwise. Both are active immediately.

</Collapsible>

## What is no longer accepted

<Collapsible summary="Compatibility with setup and state_equals">

<Note type="note">

Evals use the agent's real tools, so when you create a scenario or add a version to it:

- `setup` with content answers `400 INVALID_REQUEST` with the message `Las pruebas usan las herramientas reales del agente; setup ya no se admite.` An empty `setup` (`{}` or `{"tools": {}}`) is accepted and discarded.
- A `state_equals` check answers `400 INVALID_REQUEST` with `state_equals ya no se admite: el agente real no reporta estado.`

Each problem has its path in `details.issues`. Versions that already had `setup` or `state_equals` keep running; a stored `state_equals` is skipped and gives no verdict.

</Note>

</Collapsible>

## Scenario scope and metadata

<Collapsible summary="Workspace and platform scenarios, and discarded metadata fields">

There are scenarios of two scopes (`scope`):

- **`workspace`:** the ones in your workspace.
- **`platform`:** the ones Platica shares with everyone. They cannot be archived. Adding a version to one creates a copy in your workspace.

The content has no workspace, agent or author IDs. If you send `workspaceId`, `agentId`, `revisionId`, `createdBy` or `updatedBy` at the first level of `scenario`, they are discarded. Inside the content nothing is touched: for example, an `agentId` in `expect.checks[].argsInclude` is respected.

</Collapsible>
