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:
- A file next to the scenario, such as
my_world.pyormy_world.py:Maze. - A local name from
@registeror the nearestagentplaykit.yaml. - An installed plugin (entry points
agentplaykit.envs,agentplaykit.agents,agentplaykit.evaluators). - A built-in: worlds
tic-tac-toe,blank,rps; agentsscripted/random,scripted/minimax,openai_compat,openai,openrouter,groq,deepseek,gemini,mistral,together,ollama,anthropic,command,http,mcp; evaluatorsoutcome,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.