Skip to content

SPEC-006: Registry

  • Status: Implemented
  • Milestone: M2
  • Owners: lead maintainer

1. Purpose

Let worlds, agents and evaluators be found by name, from this repo, from the user's project, or from third-party packages, with no framework changes.

2. Terms

  • Kind: env, agent or evaluator. Local: defined in the user's project directory. Global: installed Python package exposing entry points. Built-in: shipped with the framework.

3. Requirements

  • REG-001 @register(kind, name) MUST register a class or factory under a kind and name; names are lowercase [a-z0-9_-], with / allowed for namespaces (scripted/random).
  • REG-002 Third-party packages MUST be discoverable through entry-point groups agentplaykit.envs, agentplaykit.agents, agentplaykit.evaluators.
  • REG-003 Lookup order MUST be local, global, built-in (matches SCN-010 steps 2 to 4).
  • REG-004 A name registered twice at the same level MUST raise an error naming both sources. A name at different levels is shadowing: the more local one wins and the registry records the shadow.
  • REG-005 Discovery MUST be lazy: listing names (env list) reads entry-point metadata without importing plugin modules; the module is imported only when the plugin is first used.
  • REG-006 The first load of a non-built-in plugin SHOULD print a trust notice naming the package (SEC-004).
  • REG-007 list(kind) MUST return names, source level and short description, sorted by name.
  • REG-008 Built-ins MUST include worlds tic-tac-toe and blank, and agents scripted/random and scripted/minimax (M1 and M2).
  • REG-009 Registration MUST NOT require editing framework files.
  • REG-010 Local names MUST come from two places: classes registered with @register in the running process, and a project file agentplaykit.yaml, found by searching from the scenario's directory upward (stopping at a directory containing .git). The file maps names to targets per kind, for example envs: {maze: "worlds/maze.py:Maze"}; a target is path.py:Attr (relative to the file) or module:Attr. Reading this file MUST NOT import code.
  • REG-011 A reference that is a path to a .py file MAY omit :Attr when the file defines exactly one public subclass of the matching base class (Environment, Agent, Evaluator).

4. Acceptance criteria

Requirement Test ID Notes
REG-001..004 REG-001..REG-004
REG-005..006 REG-005, REG-006 import-spy test
REG-007..009 REG-007..REG-009 fake entry point fixture
REG-010..011 REG-010, REG-011 project file and bare .py path

5. Open questions

  • Version constraints on plugins (requires: agentplaykit>=0.1)? Deferred.

6. Change log

  • 2026-11-30: Initial draft.
  • 2026-11-30: Accepted by the lead maintainer.
  • 2026-11-30: Added REG-010 (how local names are declared) and REG-011 (bare .py references); found while implementing M2.
  • 2026-11-30: REG-011 covers evaluators (Evaluator base class, SPEC-010 EVL-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.