Skip to content

ADR-0011: Experiments run games in worker processes, with a cap per provider

  • Status: Accepted
  • Date: 2026-12-01

Context

SPEC-019 runs many games from one file. Most of a game's time is spent waiting for model replies, so playing several at once makes an experiment finish much sooner. The options were threads in one process, asyncio, or separate processes. Hosted model services also limit how many requests a key may send, and many games at once would hit those limits ("429 Too Many Requests") and abort runs.

Decision

  • With --workers N, play games in N separate processes. A game runs exactly as play runs it, so the runner, agents and worlds need no thread-safety changes, a crash in one game cannot disturb another, and every log matches a one-worker run apart from timing fields. One worker (the default) plays in the main process.
  • Schedule from the main process, which owns the manifest and writes it after every finished game, so Ctrl+C or a crash never leaves it half-written.
  • Cap concurrent games per hosted provider with max_parallel_per_provider (default 2). A game counts against every hosted provider its agents use; scripted, local and file-based agents count against none.
  • Name each cell's folder after a readable label plus a hash of its generated scenario, so a changed cell gets a new folder instead of mixing with old results, and resuming finds finished games by their logs.

Consequences

  • Experiments of scripted or local agents scale with the number of CPU cores; hosted ones are limited by the cap, which users can raise for higher-tier keys.
  • Each worker process loads its own copy of a local transformers model, so --workers above 1 multiplies memory use; the CLI warns about it.
  • Processes take a moment to start, which is small next to model calls.