[Core] Gymnasium WorldInterface — Engine-Agnostic Agent Adapter Pattern #871

Closed
opened 2026-03-21 23:40:05 +00:00 by perplexity · 0 comments
Collaborator

Why This Is High Leverage

Every roadmap document (feasibility guide, V2 roadmap, Morrowind phases) recommends the same thing: build a substrate-agnostic interface following Gymnasium's reset()/step() API. This single abstraction unlocks TES3MP, Luanti, Godot, and eventually ROS 2 robotics — without rewriting Timmy's brain for each one. It's the architectural decision that makes everything downstream cheaper.

Scope

Define and implement a WorldInterface base class with three methods:

  • observe() → PerceptionOutput — structured world state
  • act(command: CommandInput) → ActionResult — execute an action, return outcome
  • speak(message: str, target: Optional[str]) → None — communicate

Plus a WorldAdapter registration system so engine-specific adapters plug in cleanly.

Requirements

  • src/infrastructure/world/interface.py — Abstract WorldInterface with type-hinted methods
  • src/infrastructure/world/registry.py — Adapter registry (register by name, instantiate by config)
  • src/infrastructure/world/adapters/mock.py — Mock adapter for testing (returns canned perception, logs commands)
  • src/infrastructure/world/adapters/tes3mp.py — Stub TES3MP adapter (imports from morrowind/schemas.py)
  • Tests for interface contract and mock adapter
  • The PerceptionOutput and CommandInput from PR #864's schemas.py should be the canonical types

Acceptance Criteria

  • MockWorldAdapter passes full observe/act/speak cycle in tests
  • TES3MP adapter stub imports cleanly and raises NotImplementedError for unimplemented methods
  • Any future engine (Luanti, Godot) can be added by implementing 3 methods

Prior Art

  • Gymnasium reset()/step() (18M+ installations)
  • Embodied Agent Interface (NeurIPS 2024): perceive → plan → act → reflect
  • Godot RL Agents (AAAI 2022): Gymnasium-compatible game engine integration

Assignee: Kimi

## Why This Is High Leverage Every roadmap document (feasibility guide, V2 roadmap, Morrowind phases) recommends the same thing: build a substrate-agnostic interface following Gymnasium's `reset()/step()` API. This single abstraction unlocks TES3MP, Luanti, Godot, and eventually ROS 2 robotics — without rewriting Timmy's brain for each one. It's the architectural decision that makes everything downstream cheaper. ## Scope Define and implement a `WorldInterface` base class with three methods: - `observe() → PerceptionOutput` — structured world state - `act(command: CommandInput) → ActionResult` — execute an action, return outcome - `speak(message: str, target: Optional[str]) → None` — communicate Plus a `WorldAdapter` registration system so engine-specific adapters plug in cleanly. ## Requirements - [ ] `src/infrastructure/world/interface.py` — Abstract `WorldInterface` with type-hinted methods - [ ] `src/infrastructure/world/registry.py` — Adapter registry (register by name, instantiate by config) - [ ] `src/infrastructure/world/adapters/mock.py` — Mock adapter for testing (returns canned perception, logs commands) - [ ] `src/infrastructure/world/adapters/tes3mp.py` — Stub TES3MP adapter (imports from morrowind/schemas.py) - [ ] Tests for interface contract and mock adapter - [ ] The PerceptionOutput and CommandInput from PR #864's schemas.py should be the canonical types ## Acceptance Criteria - `MockWorldAdapter` passes full observe/act/speak cycle in tests - TES3MP adapter stub imports cleanly and raises NotImplementedError for unimplemented methods - Any future engine (Luanti, Godot) can be added by implementing 3 methods ## Prior Art - Gymnasium `reset()/step()` (18M+ installations) - Embodied Agent Interface (NeurIPS 2024): perceive → plan → act → reflect - Godot RL Agents (AAAI 2022): Gymnasium-compatible game engine integration ## Assignee: Kimi
gemini was assigned by Rockachopa 2026-03-22 23:33:35 +00:00
claude added the harnessmorrowindp1-important labels 2026-03-23 13:53:31 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#871