TextArena
A Collection of Competitive Text-Based Games for Language Model Evaluation and Reinforcement Learning
What it is and what it does
TextArena is a framework for running text-based competitive games between language models and other agents. It provides a Gym-style interface so you can initialize game environments, reset them with a specified number of players, step through turns by passing observations to agents and collecting their actions, and retrieve rewards and game state at the end. The package ships with 100+ games (including TicTacToe, Chess, Settlers of Catan, and others), built-in agents that wrap external LLM APIs, and wrapper utilities for visualization and training integration.
You use TextArena to benchmark how well language models play text games, train them via reinforcement learning on game outcomes, or evaluate their reasoning and strategy in competitive settings. It depends on OpenAI and requests for API calls, rich for terminal rendering, nltk and chess for game logic, websockets for potential real-time play, and python-dotenv for credential management. The framework is designed to be extensible—you can add custom games and agents by implementing a simple interface.
Use it for:
- Benchmark language model reasoning by running them against each other in competitive games like TicTacToe or Chess.
- Train LLMs via self-play reinforcement learning on TextArena games to improve strategy and multi-turn reasoning.
- Evaluate theory-of-mind capabilities by running models on games that require understanding opponent intent and hidden information.
- Integrate game environments into existing RL pipelines via the Gym-style interface for custom training loops.
- Compare different LLM providers (GPT, Claude, etc.) on the same game tasks using the OpenRouter agent wrapper.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
TextArena provides a framework of 100+ text-based games with an OpenAI Gym-style interface for training, evaluating, and benchmarking language models through competitive gameplay.
Yes, if you are actively researching LLM training or evaluation via games. The framework is well-designed, has low install friction, and offers a large game suite with recent updates. However, maintenance is aging (302 days since last release), so expect slower bug fixes and feature additions. Not recommended if you need production-grade support or rapid iteration on the game set.
Install
textarena on PyPI
pip
pip install textarenauv
uv add textarenapoetry
poetry add textarenaInstalling TextArena
Before you install
Low install friction with a pure-Python wheel distribution. Maintenance status is aging—last release was 302 days ago—so expect slower response to issues, though the package remains functional for its current game set.
License in practice
MIT license is permissive; you can use, modify, and distribute TextArena freely in commercial and private projects with minimal restrictions.
Quickstart
pip install textarena
import textarena as ta
env = ta.make(env_id="TicTacToe-v0")
agent = ta.agents.OpenRouterAgent(model_name="GPT-4o-mini")
env.reset(num_players=1)
player_id, observation = env.get_observation()
action = agent(observation)
done, step_info = env.step(action=action)
Requires Python 3.10 or later. External LLM API calls (OpenAI, Anthropic, etc.) require valid API keys set as environment variables.
Verify before relying
- Whether all 100+ games remain actively maintained or if some are deprecated in the current version.
- Performance characteristics when running many concurrent game instances or with large language models.
- Real-world success rate of the included basic agents and whether custom agent development is well-documented.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 7 — openai, rich, nltk, chess, python-dotenv, requests, websockets |
| Maintenance | aging — 302 days since the last release |
| First released | |
| Downloads | 201,866/month — #9,658 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: textarena-0.7.4-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
gem-llmGEM is a reinforcement learning environment…
permissive · top 15,000 on PyPI
rlbotRLBot is a framework for writing Python bots…
permissive · top 15,000 on PyPI
gymnasiumGymnasium provides a standard Python API for…
permissive · top 5,000 on PyPI
trueskillImplements the TrueSkill rating algorithm to…
permissive · top 15,000 on PyPI
kaggle-environmentsKaggle Environments provides a framework for…
unclear · top 15,000 on PyPI
pettingzooPettingZoo provides multi-agent reinforcement…
permissive · top 15,000 on PyPI
openskillOpenskill is a multiplayer rating system that…
permissive · top 15,000 on PyPI
bfcl-evalEvaluates and benchmarks large language models'…
permissive · top 15,000 on PyPI
terminal-benchTerminal-Bench provides a benchmark suite and…
unclear · top 15,000 on PyPI
nemo-gymNeMo Gym provides infrastructure for building,…
permissive · top 5,000 on PyPI