Skip to content

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 against scenario.schema.json.
  • SCN-002 A scenario MUST have the top-level fields agentplay, name, world, agents, and MAY have seed (default 0), limits, log, evaluators, description.
  • SCN-003 world MUST have use (a reference) and MAY have config (object passed to the world).
  • SCN-004 agents MUST be a non-empty list; each has a unique id, use (reference) and MAY have config (object, for example model, api_key_env).
  • SCN-005 limits MAY set max_steps, max_seconds, max_cost_usd, max_illegal (SPEC-004), max_message_chars and max_messages_per_turn (SPEC-008), and max_tokens (RUN-019).
  • SCN-006 log MAY set path (default runs/<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_env names an environment variable (SEC-001).

Layout and resolution

  • SCN-009 A scenario MAY be a single file, or split: world: {file: world.yaml} and agents: [{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 use line (for example scripted/random to openai_compat with a base_url and model) MUST be sufficient to swap agents, with no other edits.

Validation

  • SCN-013 The loader MUST NOT import plugin code (SEC-003); check validates structure and reference existence only.
  • SCN-015 An agent MAY have name, a display name for reports (SPEC-013 RPT-002); it is logged in run_start (LOG-023).
  • SCN-016 A scenario MUST have exactly one of agents and tournament (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_sha256 of 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 .jsonl log 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 ox is renamed tic-tac-toe (ADR-0006); no alias.
  • 2026-12-01: Added SCN-015 (agent name) and SCN-016 (tournament), with SPEC-013.