SPEC-005: Scenario¶
- Status: Implemented
- Milestone: M2
- Owners: lead maintainer
1. Purpose¶
A scenario is one YAML file that names a world, its agents and limits, so a run is reproducible and the agent can be swapped by changing one line. Machine-readable form: specs/schemas/scenario.schema.json.
2. Terms¶
- Reference: a string naming a world or agent: a file path, a local name, a global name or a built-in name.
3. Requirements¶
Schema¶
- SCN-001 A scenario MUST start with
agentplay: 1(schema version, an integer) and validate againstscenario.schema.json. - SCN-002 A scenario MUST have the top-level fields
agentplay,name,world,agents, and MAY haveseed(default 0),limits,log,evaluators,description. - SCN-003
worldMUST haveuse(a reference) and MAY haveconfig(object passed to the world). - SCN-004
agentsMUST be a non-empty list; each has a uniqueid,use(reference) and MAY haveconfig(object, for examplemodel,api_key_env). - SCN-005
limitsMAY setmax_steps,max_seconds,max_cost_usd,max_illegal(SPEC-004),max_message_charsandmax_messages_per_turn(SPEC-008), andmax_tokens(RUN-019). - SCN-006
logMAY setpath(defaultruns/<name>-<seed>.jsonl); the path MUST end in.jsonl(SEC-011). - SCN-007 Unknown fields MUST be rejected with an error naming the field and the closest valid field.
- SCN-008 Secrets MUST NOT appear in scenarios;
api_key_envnames an environment variable (SEC-001).
Layout and resolution¶
- SCN-009 A scenario MAY be a single file, or split:
world: {file: world.yaml}andagents: [{file: agents/x.yaml}]with paths relative to the scenario file. - SCN-010 A reference MUST resolve in this order: (1) an existing file path relative to the scenario, (2) a local name registered in the project, (3) a globally installed name, (4) a built-in name. The first match wins; a shadowed match SHOULD log a note.
- SCN-011 An unresolved reference MUST fail with the list of names tried and the nearest matches.
- SCN-012 Changing only an agent's
useline (for examplescripted/randomtoopenai_compatwith abase_urlandmodel) MUST be sufficient to swap agents, with no other edits.
Validation¶
- SCN-013 The loader MUST NOT import plugin code (SEC-003);
checkvalidates structure and reference existence only. - SCN-015 An agent MAY have
name, a display name for reports (SPEC-013 RPT-002); it is logged inrun_start(LOG-023). - SCN-016 A scenario MUST have exactly one of
agentsandtournament(SPEC-013 RPT-003). A tournament's entrant names MUST be unique and it MUST have at least as many entrants as roles. - SCN-014 Loading MUST compute
scenario_sha256of the resolved content for the log.
4. Acceptance criteria¶
| Requirement | Test ID | Notes |
|---|---|---|
| SCN-001..008 | SCN-001..SCN-008 |
good and bad scenario fixtures |
| SCN-009..012 | SCN-009..SCN-012 |
resolution order tests |
| SCN-013..014 | SCN-013, SCN-014 |
|
| SCN-015..016 | SCN-015, SCN-016 |
agent names; tournament fixtures |
5. Examples¶
agentplay: 1
name: tic-tac-toe-chat
seed: 7
world: {use: tic-tac-toe}
agents:
- {id: x, use: scripted/minimax}
- {id: o, use: scripted/random}
limits: {max_steps: 50}
6. Open questions¶
- Env var interpolation (
${VAR}) inside scenarios? Draft: no.
7. Change log¶
- 2026-11-30: Initial draft.
- 2026-11-30: Accepted by the lead maintainer.
- 2026-11-30: SCN-005 gains the two message limits.
- 2026-11-30: SCN-005 gains
max_tokens. - 2026-11-30: SCN-006 requires a
.jsonllog path (SEC-011). - 2026-11-30: Implemented in v0.1.0; every requirement has a test (PRO-004, PRO-011).
- 2026-11-30: The reference world
oxis renamedtic-tac-toe(ADR-0006); no alias. - 2026-12-01: Added SCN-015 (agent
name) and SCN-016 (tournament), with SPEC-013.