Skip to content

Scenarios

A scenario is one YAML file that names a world, its agents and limits (SPEC-005).

agentplay: 1                 # schema version, required
name: my-game                # lowercase, used for log names
description: optional text
seed: 7                      # default 0
world: {use: tic-tac-toe, config: {}}
agents:
  - {id: x, use: scripted/minimax}
  - {id: o, use: openrouter, config: {model: "..."}}
limits:
  max_steps: 200             # defaults shown; null turns a limit off
  max_seconds: 600
  max_cost_usd: 1.0
  max_illegal: 3             # illegal moves in a row before a forfeit
  max_message_chars: 500
  max_messages_per_turn: 3
  max_tokens: 200000         # applies when an agent's cost is unknown
log: {path: runs/my-game.jsonl}   # must end in .jsonl
evaluators:
  - {use: outcome, config: {agent: x}}

How use is resolved

In this order; the first match wins:

  1. A file next to the scenario, such as my_world.py or my_world.py:Maze.
  2. A local name from @register or the nearest agentplaykit.yaml.
  3. An installed plugin (entry points agentplaykit.envs, agentplaykit.agents, agentplaykit.evaluators).
  4. A built-in: worlds tic-tac-toe, blank, rps; agents scripted/random, scripted/minimax, openai_compat, openai, openrouter, groq, deepseek, gemini, mistral, together, ollama, anthropic, command, http, mcp; evaluators outcome, judge.

agentplaykit env list shows the worlds available from the current folder.

A project file

Give local plugins short names in agentplaykit.yaml at your project root:

envs:
  maze: "worlds/maze.py:Maze"
agents:
  greedy: "agents/greedy.py"

Split layout

Large scenarios can keep parts in their own files:

world: {file: parts/world.yaml}
agents:
  - {file: parts/x.yaml}

Never put keys in a scenario

agentplaykit check rejects fields such as api_key or token. Name an environment variable instead: api_key_env: OPENROUTER_API_KEY.