Skip to main content
TextArena logo

A suite of 80+ Single-/Two-/Multi-Player texted based games for benchmarking and training of LLMs.

Play | Leaderboard | Games | Examples

GitHub Repo stars PyPI Downloads Discord PyPI version

Updates

  • 14/07/2025 Announcing MindGames a NeurIPS2025 competition for training LLMs on various TextArena games that require theory of mind.
  • 01/07/2025 Release of v0.6.9 with 100 games and simplified states, new observation wrappers for training and default wrappers for environments.
  • 01/07/2025 Release of SPIRAL: Self-Play on Zero-Sum Games Incentivizes Reasoning via Multi-Agent Multi-Turn Reinforcement Learning introducing RL via self-play on TextArena games as a potential new training paradigm.
  • 22/06/2025 Release of UnstableBaselines a light weight async online RL library for training LLMs on TextArena games.
  • 16/04/2025 Release of the TextArena paper
  • 14/02/2025 Release of the new, stable version for both pip and the website
  • 31/01/2025 Initial demo release highlighted by Andrej Karpathy (crashing all our servers)

Introduction

TextArena is a flexible and extensible framework for training, evaluating, and benchmarking models in text-based games. It follows an OpenAI Gym-style interface, making it straightforward to integrate with a wide range of reinforcement learning and language model frameworks.

Getting Started

Installation

Install TextArena directly from PyPI:

pip install textarena

Offline Play

The only requirement Agents need to fulfill is having a call function that accepts string observations and returns string action. We have implemented a number of basic agents that you can find [here](TODO link). In this example, we show how you can let GPT-4o-mini play against anthropic/claude-3.5-haiku in a game of TicTacToe.

We will be using the OpenRouterAgent, so first you need to set you OpenRouter API key:

export OPENROUTER_API_KEY="YOUR_OPENROUTER_API_KEY"

Now we can build the models and let them play:

import textarena as ta

# Initialize agents
agents = {
    0: ta.agents.OpenRouterAgent(model_name="GPT-4o-mini"),
    1: ta.agents.OpenRouterAgent(model_name="anthropic/claude-3.5-haiku"),
}

# Initialize the environment
env = ta.make(env_id="TicTacToe-v0")

# wrap it for additional visualizations
env = ta.wrappers.SimpleRenderWrapper(env=env) 

env.reset(num_players=len(agents))

done = False
while not done:
    player_id, observation = env.get_observation()
    action = agents[player_id](observation)
    done, step_info = env.step(action=action)

rewards, game_info = env.close()

Citation arXiv

If you use TextArena in your research, please cite:

@misc{guertler2025textarena,
    title={TextArena}, 
    author={Leon Guertler and Bobby Cheng and Simon Yu and Bo Liu and Leshem Choshen and Cheston Tan},
    year={2025},
    eprint={2504.11442},
    archivePrefix={arXiv},
    primaryClass={cs.CL},
    url={https://arxiv.org/abs/2504.11442}, 
}

How to Contribute:

If you have any questions at all, feel free to reach out on discord. The below issues are great starting points if you want to contribute:

  • Transfer the 'How to Contribute' from here to individual issues
  • Make RushHour board generation algorithmic
  • extend 2048 to arbitrary board sizes (should be very straight forward)
  • extend Fifteenpuzzel to arbitrary sizes
  • Add a nice end-of-game screen to the SimpleRenderWrapper visualizations

Metadata

Release files for TextArena 0.6.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for TextArena 0.6.12
File Size Uploaded Provenance Actions
textarena-0.6.12.tar.gz 858.4 kB Without provenance Details for textarena-0.6.12.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for TextArena 0.6.12
File Interpreter ABI Platform Actions
textarena-0.6.12-py3-none-any.whl Python 3 none any Details for textarena-0.6.12-py3-none-any.whl

Total release size: 1.8 MB

Release files / textarena-0.6.12.tar.gz

Download URL textarena-0.6.12.tar.gz
Size 858.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2f69a6ab63f6ce819fed3f7be3d1925cbd92b72b6f8767c63094d1476a1e40b0
BLAKE2b-256 checksum
How to use checksums
a243123fb28330fbe54defc481339fe56b47a42586ff61d222ad50e93a586e87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Release files / textarena-0.6.12-py3-none-any.whl

Download URL textarena-0.6.12-py3-none-any.whl
Size 955.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ee6d0429d0d17aaeb84634a8ecbc29e440d09862f90a8256c0d4cf4fad42ce5
BLAKE2b-256 checksum
How to use checksums
59928b5e090a7919e149539db8bab9364a56f2395e38c170122fe68e15088d25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Security for TextArena 0.6.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.12 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page