Skip to main content
TextArena logo

A suite of 100+ {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

  • 31/07/2025 We added SettlersOfCatan to TextArena!
  • 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. 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 Fifteenpuzzel to arbitrary sizes
  • Add a nice end-of-game screen to the SimpleRenderWrapper visualizations

Metadata

Release files for TextArena 0.7.4

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.7.4
File Size Uploaded
textarena-0.7.4.tar.gz 955.0 kB Details

Built distribution (wheel)

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

Total release size: 2.0 MB

Release files / textarena-0.7.4.tar.gz

Download URL textarena-0.7.4.tar.gz
Size 955.0 kB
Tags Source
SHA-256 checksum
How to use checksums
28bb9170d7718f2ae05e4515bea82262422731e563fc7318a9e7983de0cadd4f
BLAKE2b-256 checksum
How to use checksums
ba044a3ca42093d0be2a9c377ae3335a6c6baac1d278ae932562ec69f339d172
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

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

Download URL textarena-0.7.4-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
684784e78278e518066f67557ee93b47c238d16cbbd15d3abdaa3147562d3024
BLAKE2b-256 checksum
How to use checksums
26b49a9ba65154aff853c75b3d7324319d168ad9c69c6097f4aa3c16da7d9ef3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.7.4 This release

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.0

2 release files

0.6.17

2 release files

0.6.10

1 release file

0.6.9

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.0

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.6

1 release file

0.3.5

2 release files

0.3.4

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.7

2 release files

0.2.5

2 release files

0.2.0

1 release file

0.1.6

2 release files

0.1.5

2 release files

0.1.3

2 release files

0.1.2

1 release file

0.1.1

2 release files

0.1.0

2 release files

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