Write a scenario
A scenario spec is a JSON file. It says who the simulated user is, what they say, and what must be true at the end. This guide builds one from a shipped spec, checks it with robotelos test lint, and runs it. It follows Run your first scenario, so start the stack and read the token as shown there.
The reader of a spec is strict. It rejects unknown fields and any data after the closing brace, and it refuses a spec that breaks the rules below.
The fields of a spec
| Field | Required | Meaning |
|---|---|---|
id | yes | The name of the scenario. Unique among the specs of one run. |
version | yes | A number above 0. |
use_case | yes | One line: what the scenario is about. |
goal | yes | One line: what the user wants to have happened. |
persona | by convention (not validated) | Who the user is: a name, and optionally traits and other descriptive fields. |
persona_ref | no | A path into a personas/ folder beside the spec file, such as personas/hesitant.json. It replaces persona as a whole. See Personas. |
start | yes | The first thing the user does. |
branches | no | Follow-ups that fire once when their condition holds. |
success_criteria | yes | At least one check. |
expected_effects | no | What the provider’s own record must show was done. |
stop_conditions | yes | max_turns and max_seconds, both above 0. quiet_ms is optional. |
user | no | A simulated user in place of branches. |
Other optional fields exist: derived_from, customer, modifiers, fixtures and expected_agent_drafts. They are defined in runtime/internal/evals/spec.go. The field invariants is refused, because none is built.
What the user does
An utterance in start or in a branch’s then does exactly one thing: say (words), type (words typed, also during a call), tap (an option of an open choice, by option or by position from 1), hangup, rejoin, pause_ms, race (two or more steps at once) or noise_ms. Words and races carry an intent, the label a correct classifier finds: work, chat, question, silent, thanks_and_work, answer, cancel, approve, reject, amend, suspend or resume.
Branches
A branch has an id, a when and a then, and may be required. The condition is evaluated after each agent reply. A when holds at least one of:
agent_said_contains: the agent’s words contain this text.agent_raised: the agent raised an obligation,choiceorapproval.after_agent_message: after the Nth agent message.state:keyandat_least, a count of the system’s inspection. This needs--inspect-url.
A required branch that never fires fails the run.
Criteria
Each criterion has a kind, and, depending on the kind, value, key or n. profile (scripted or live) restricts it to one profile; without it the criterion applies to both. A criterion is required unless it says "required": false.
| Kind | Passes when |
|---|---|
agent_said | Some agent message contains value (not case-sensitive). |
agent_never_said | No agent message contains value. |
first_agent_never_said | The first agent message does not contain value. |
agent_messages_at_least / agent_messages_at_most | The agent sent at least or at most n messages. |
agent_language | Every agent message whose language can be told is in value, de or en. |
state_equals | The inspection’s counter named key equals value. |
surface_shown | A surface for a choice was shown, with at least n options. |
obligation_answered | An obligation was answered with the option value, optionally from the source in key: command, ui, voice or text. |
obligation_open | At least n obligations of kind value (approval or choice) are still open at the end. |
answers_recorded | Exactly n obligations were answered. |
no_widget_shown | No widget was sent to the customer. |
judge | Advisory only. A model answers the rubric no_unsupported_success. It is never required and changes no verdict. |
Five kinds can only be judged on a voice call, and are not applicable over text: entities_heard, agent_quiet_within_ms, agent_paused_and_resumed, agent_spoke_at_least_ms and agent_not_paused.
The counters named by state_equals come from the target’s inspection. The shipped specs use, for example, runs, goals, goals_achieved, runs_completed, reminders, waits_approval_open, waits_approval_resolved and operations_<capability>_succeeded.
Effects
expected_effects names a capability and either an exact count or a window with min and max, and optionally the input the provider must have stored. The runner reads the provider’s record with --effects-url. Conversation text cannot satisfy it.
A user block
user replaces branches: a spec has one or the other. Its mode is model or reactive, but only model runs today: a spec with a reactive user is read and then refused as unrunnable. It holds a goal, facts (each with an id and a value; a reactive user also needs say wordings) and approvals (about, answer, optionally say). max_turns is at most 40. A spec with a user block needs --inspect-url, and mode model needs --user-model. See Run against a real agent.
Step 1: Write the spec
The example below is chat-greeting.json with one change: it adds an agent_said check, so a silent agent cannot pass. The mock agent answers You said: followed by your words. Save it as my-specs/echo-hello.json.
PowerShell:
New-Item -ItemType Directory my-specs | Out-Null
@'
{
"id": "echo-hello",
"version": 1,
"use_case": "small talk",
"goal": "the agent answers a greeting",
"persona": {"name": "Robin", "traits": ["brief"]},
"start": {"say": "Hello there", "intent": "chat"},
"success_criteria": [
{"kind": "agent_messages_at_least", "n": 1},
{"kind": "agent_said", "value": "hello there"},
{"kind": "agent_never_said", "value": "run_"}
],
"stop_conditions": {"max_turns": 1, "max_seconds": 90}
}
'@ | Set-Content -Encoding ascii my-specs/echo-hello.json
bash:
mkdir my-specs
cat > my-specs/echo-hello.json <<'EOF'
{
"id": "echo-hello",
"version": 1,
"use_case": "small talk",
"goal": "the agent answers a greeting",
"persona": {"name": "Robin", "traits": ["brief"]},
"start": {"say": "Hello there", "intent": "chat"},
"success_criteria": [
{"kind": "agent_messages_at_least", "n": 1},
{"kind": "agent_said", "value": "hello there"},
{"kind": "agent_never_said", "value": "run_"}
],
"stop_conditions": {"max_turns": 1, "max_seconds": 90}
}
EOF
Step 2: Lint it
robotelos test lint PATH... takes files or folders. It finds specs that a silent agent can pass. It contacts no target and needs no token.
PowerShell:
.\robotelos.exe test lint my-specs
echo $LASTEXITCODE
bash:
./robotelos test lint my-specs
echo $?
| Exit code | Meaning |
|---|---|
| 0 | Clean. The last line is 1 specs, 0 issues. |
| 1 | An issue was found. Each issue is a line with the file, the spec id, the profile, a code and a detail. |
| 2 | No path was given, a path does not exist, or a spec cannot be read or decoded. |
Now lint the shipped greeting spec:
PowerShell:
.\robotelos.exe test lint runtime/internal/e2e/testdata/specs/chat-greeting.json
bash:
./robotelos test lint runtime/internal/e2e/testdata/specs/chat-greeting.json
This exits 1 and reports no_positive_check for the scripted and the live profile, then 1 specs, 2 issues. That is expected: chat-greeting.json is a known weak spec, listed as debt in runtime/internal/e2e/spec_lint_test.go. It says “nothing should happen”, and no required criterion asks the agent for something it must have done. Your echo-hello.json fixes that with agent_said. When you write a spec that expects nothing to happen, expect this finding too.
Step 3: Run it
PowerShell:
.\robotelos.exe test run my-specs --url http://127.0.0.1:8787 --agent mock --inspect-url http://127.0.0.1:8787
echo $LASTEXITCODE
bash:
./robotelos test run my-specs --url http://127.0.0.1:8787 --agent mock --inspect-url http://127.0.0.1:8787
echo $?
Expect a PASS line for echo-hello and exit code 0. To see a failure, change hello there in the agent_said check to a text the mock never says, and run again. The spec’s line shows FAIL, a line under it names the failed criterion, and the exit code is 1.
For a spec that books something, copy runtime/internal/e2e/testdata/specs/reserve-table-en.json. It checks counters and an expected_effects entry, and lints clean. It needs the goal agent: see Run against a real agent.
Run a set from the catalog
The catalog is a manifest of scenarios. Each entry has an id, a mechanism, a status, tiers (smoke or full) and specs, paths relative to runtime/internal. Instead of a folder, name the catalog and a tier:
PowerShell:
.\robotelos.exe test run --catalog runtime/internal/catalog/testdata/catalog.json --tier smoke --url http://127.0.0.1:8787 --agent concierge --profile live --inspect-url http://127.0.0.1:8787
bash:
./robotelos test run --catalog runtime/internal/catalog/testdata/catalog.json --tier smoke --url http://127.0.0.1:8787 --agent concierge --profile live --inspect-url http://127.0.0.1:8787
Give --catalog and --tier together, and do not combine them with a folder. smoke is the quick set and full is everything built. --catalog-root changes the folder the paths are relative to (default runtime/internal). The tier’s specs include goal-agent scenarios such as work-reminder-en, so run it against the goal agent as in Run against a real agent, not the mock.
Next steps
- Run against a real agent with a live model.
- Personas to change who the user is.
- Reference for every flag and report field.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.