← all repositories
microsoft/TextWorld

Microsoft's gym for agents that read, not see

A generator and sandbox for training RL agents on text adventures, because pixels are overrated.

1.4k stars Jupyter Notebook AgentsDomain Apps
TextWorld
Velocity · 7d
+0.5
★ / day
Trend
steady
star history

What it does TextWorld generates text-based games and exposes them through a Gym-like API, so you can train reinforcement learning agents to navigate rooms, pick up objects, and solve quests by typing commands. It outputs standard Z-machine game files (*.z8) and provides both terminal and browser-based play modes.

The interesting bit The environment is fully parametric: you control world size, object count, and quest length via CLI flags, which makes it useful for curriculum learning or controlled benchmarking. It also ships with browser visualization tools that track game state in real time—handy for debugging why your agent keeps trying to “eat the mailbox.”

Key highlights

  • Gym-compatible API: register_game, make, reset, step—the usual suspects
  • tw-make script generates custom games with tunable difficulty
  • Supports Z-machine games only (*.z1 through *.z8)
  • Browser-based viewer via --viewer flag; optional screenshot and graph rendering
  • Docker image available for Windows users and quick Jupyter setup
  • VS Code extension for .twl and .twg file syntax highlighting

Caveats

  • Linux and macOS only for native install; Windows requires Docker
  • Visualization needs extra setup: pip install textworld[vis] plus Chrome or Firefox webdriver
  • Python support capped at 3.9–3.12

Verdict Worth a look if you’re doing RL research on language understanding or procedural text generation. Skip it if your agents need visuals, or if you just want to play actual interactive fiction—this is a training harness, not a game engine for humans.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.