项目已于 2025 年 8 月 11 日停止维护,不再更新或提供支持;默认安装只含核心依赖,用其他后端或 pettingzoo 环境需另装 all_backends/all_envs 等可选依赖;用 GPT 系列作智能体需先设置 OPENAI_API_KEY 环境变量

ChatArena
Farama-FoundationApache-2.0长期未更新给大语言模型搭建多智能体语言博弈环境,让 AI 在对话游戏里练习沟通与协作能力,方便研究和评测多智能体交互。
ChatArena (or Chat Arena) is a Multi-Agent Language Game Environments for LLMs. The goal is to develop communication and collaboration capabilities of AIs.
pip install chatarena
pip install chatarena[gradio] && git clone https://github.com/chatarena/chatarena.git && cd chatarena && gradio app.pyREADME 未说明显存或 GPU 要求;默认通过 API 调用 GPT-3.5-turbo/GPT-4 等模型,也支持 anthropic、cohere、huggingface 等后端
为 LLM 提供多智能体语言游戏环境的库,用于研究和评测 AI 的交流协作能力
给大语言模型搭建多智能体语言博弈环境,让 AI 在对话游戏里练习沟通与协作能力,方便研究和评测多智能体交互。
核心能力
- 基于马尔可夫决策过程抽象玩家、环境与交互
- 内置 Chameleon、NLP Classroom、井字棋等语言游戏环境
- 提供 Web UI 与 CLI 两种交互界面
- 支持通过配置文件加载 Arena 并运行游戏循环
- 可继承 Environment 类自定义新游戏环境
容易踩的坑
- v0.1.18最新正式版2023-12-21 · 2023-12-21 00:41 UTC
ChatArena 0.1.18
This is a hotfix release, fixing a minor issue with a kwarg in the Umshini environments, which caused issues in certain use cases. Apologies for the small and frequent releases, unfortunately there's no way around it currently.
Bug Fixes
- Umshini: fix minor typo with player_names kwarg by @elliottower in https://github.com/Farama-Foundation/chatarena/pull/117
Full Changelog: https://github.com/Farama-Foundation/chatarena/compare/v0.1.17...v0.1.18
- v0.1.172023-12-20 · 2023-12-20 00:12 UTC
查看更新说明
ChatArena 0.1.17
This is a minor release, including a minor enhancement to the Umshini environments, and adding registration functionality for all environments and intelligence backends--allowing the use of
Arena.from_configwith custom environments.New Features and Improvements
- Umshini: add classification of vulnerability category (e.g., prompt injection) for successful attacks by @elliottower in https://github.com/Farama-Foundation/chatarena/pull/114
- Add registration functions for envs and intelligence backends by @edmundmills in https://github.com/Farama-Foundation/chatarena/pull/115
New Contributors
- @edmundmills made their first contribution in https://github.com/Farama-Foundation/chatarena/pull/115
Full Changelog: https://github.com/Farama-Foundation/chatarena/compare/v0.1.16...v0.1.17
- v0.1.162023-12-05 · 2023-12-05 20:46 UTC
查看更新说明
ChatArena 0.1.16
This is a very minor release fixing some issues and adding slight enhancements to the Umshini environments.
Bug Fixes
- Umshini: Fix bug where explanation is not initialized by @andrewtanJS in https://github.com/Farama-Foundation/chatarena/pull/111
- Umshini: add asymmetric (fixed role) versions of deception and content moderation envs by @elliottower in https://github.com/Farama-Foundation/chatarena/pull/112
Full Changelog: https://github.com/Farama-Foundation/chatarena/compare/v0.1.15...v0.1.16
- v0.1.152023-11-28 · 2023-11-28 17:37 UTC
查看更新说明
ChatArena 0.1.15
This is a minor release fixing some testing issues, updating the README, fixing compatibility issues with
langchainandopenaiversions, and updating the umshini environments.Bug Fixes
- Update README: HF demo space badge, discord badge, update python to 3.9 (https://github.com/Farama-Foundation/chatarena/pull/103, https://github.com/Farama-Foundation/chatarena/pull/104, https://github.com/Farama-Foundation/chatarena/pull/105
- Add @pytest.xfail to capture PettingZoo ValueError from invalid actions (https://github.com/Farama-Foundation/chatarena/pull/107, https://github.com/Farama-Foundation/chatarena/pull/109)
- Update judging in umshini envs, update langchain requirement to be compatible with openai>=1.0.0 (https://github.com/Farama-Foundation/chatarena/pull/108)
Full Changelog: https://github.com/Farama-Foundation/chatarena/compare/v0.1.14...v0.1.15
- v0.1.142023-11-22 · 2023-11-22 22:21 UTC
查看更新说明
ChatArena 0.1.14
This is a minor release fixing some issues with the OpenAI backend, and adding CI testing to verify that the OpenAI backend works as intended.
New Features and Improvements
- Add CI testing using API keys on merges to master/dev by @elliottower in https://github.com/Farama-Foundation/chatarena/pull/100
Bug Fixes
- Openai backend fix by @yuxiang-wu in https://github.com/Farama-Foundation/chatarena/pull/97
Full Changelog: https://github.com/Farama-Foundation/chatarena/compare/v0.1.13.4...v0.1.14
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Aug 11, 2025: This project has been deprecated due to a lack of wide spread community use, and is no longer planned to receive any additional updates or support.
ChatArena is a library that provides multi-agent language game environments and facilitates research about autonomous LLM agents and their social interactions. It provides the following features:
- Abstraction: it provides a flexible framework to define multiple players, environments and the interactions between them, based on Markov Decision Process.
- Language Game Environments: it provides a set of environments that can help understanding, benchmarking or training agent LLMs.
- User-friendly Interfaces: it provides both Web UI and CLI to develop/prompt engineer your LLM agents to act in environments.

Getting Started
Installation
Requirements:
- Python >= 3. 7
- OpenAI API key (optional, for using GPT-3.5-turbo or GPT-4 as an LLM agent)
Install with pip:
pip install chatarena
or install from source:
pip install git+https://github.com/chatarena/chatarena
To use GPT-3 as an LLM agent, set your OpenAI API key:
export OPENAI_API_KEY="your_api_key_here"
Optional Dependencies
By default pip install chatarena will only install dependencies necessary for ChatArena's core functionalities.
You can install optional dependencies with the following commands:
pip install chatarena[all_backends] # install dependencies for all supported backends: anthropic, cohere, huggingface, etc.
pip install chatarena[all_envs] # install dependencies for all environments, such as pettingzoo
pip install chatarena[all] # install all optional dependencies for full functionality
Launch the Demo Locally
The quickest way to see ChatArena in action is via the demo Web UI.
To launch the demo on your local machine, you first pip install chatarena with extra gradio dependency, then git clone
this repository to your local folder, and finally call the app.py in the root directory of the repository:
pip install chatarena[gradio]
git clone https://github.com/chatarena/chatarena.git
cd chatarena
gradio app.py
This will launch a demo server for ChatArena, and you can access it from your browser (port 8080).
Check out this video to learn how to use Web UI:
For Developers
For an introduction to the ChatArena framework, please refer to this document.
For a walkthrough of building a new environment, check
Here we provide a compact guide on minimal setup to run the game and some general advice on customization.
Key Concepts
- Arena: Arena encapsulates an environment and a collection of players. It drives the main loop of the game and provides HCI utilities like webUI, CLI, configuration loading and data storage.
- Environment: The environment stores the game state and executes game logics to make transitions between game
states. It also renders observations for players, the observations are natural languages.
- The game state is not directly visible to the players. Players can only see the observations.
- Language Backend: Language backends are the source of language intelligence. It takes text (or collection of text) as input and returns text in response.
- Player: The player is an agent that plays the game. In RL terminology, it’s a policy, a stateless function mapping from observations to actions.
Run the Game with Python API
Load Arena from a config file -- here we use examples/nlp-classroom-3players.json in this repository as an example:
arena = Arena.from_config("examples/nlp-classroom-3players.json")
arena.run(num_steps=10)
Run the game in an interactive CLI interface:
arena.launch_cli()
Check out this video to learn how to use
CLI:
A more detailed guide about how to run the main interaction loop with finer-grained control can be
found here
General Customization Advice
- Arena: Overriding Arena basically means one is going to write their own main loop. This can allow different interaction interfaces or drive games in a more automated manner, for example, running an online RL training loop
- Environment: A new environment corresponds to a new game, one can define the game dynamics here with hard-coded rules or a mixture of rules and language backend.
- Backend: If one needs to change the way of formatting observations (in terms of messages) into queries for the language model, the backend should be overridden.
- Player: By default, when a new observation is fed, players will query the language backend and return the response as actions. But one can also customize the way that players are interacting with the language backend.
Creating your Custom Environment
You can define your own environment by extending the Environment class. Here are the general steps:
- Define the class by inheriting from a base class and setting
type_name, then add the class toALL_ENVIRONMENTS - Initialize the class by defining
__init__method (its arguments will define the corresponding config) and initializing class attributes - Implement game mechanics in methods
step - Handle game states and rewards by implementing methods such as
reset,get_observation,is_terminal, andget_rewards - Develop role description prompts (and a global prompt if necessary) for players using CLI or Web UI and save them to a config file.
We provide a detailed tutorial to demonstrate how to define a custom
environment,
using the Chameleon environment as example.
If you want to port an existing library's environment to ChatArena, check
out PettingzooChess environment as an example.
List of Environments
Conversation
A multi-player language game environment that simulates a conversation.
- NLP Classroom: a 3-player language game environment that simulates a classroom setting. The game is played in turns, and each turn a player can either ask a question or answer a question. The game ends when all players have asked and answered all questions.
Moderator Conversation
Based on conversation, but with a moderator that controls the game dynamics.
- Rock-paper-scissors: a 2-player language game environment that simulates a rock-paper-scissors game with moderator conversation. Both player will act in parallel, and the game ends when one player wins 2 rounds.
- Tic-tac-toe: a 2-player language game environment that simulates a tic-tac-toe game with moderator conversation. The game is played in turns, and each turn a player can either ask for a move or make a move. The game ends when one player wins or the board is full.
Chameleon
A multi-player social deduction game. There are two roles in the game, chameleon and non-chameleon. The topic of the secret word will be first revealed to all the players. Then the secret word will be revealed to non-chameleons. The chameleon does not know the secret word. The objective in the game depends on the role of the player:
- If you are not a chameleon, your goal is to reveal the chameleon without exposing the secret word.
- If you are a chameleon, your aim is to blend in with other players, avoid being caught, and figure out the secret word. There are three stages in the game:
- The giving clues stage: each player will describe the clues about the secret word.
- The accusation stage: In this stage, each player will vote for another player who is most likely the chameleon. The chameleon should vote for other players.
- The guess stage: If the accusation is correct, the chameleon should guess the secret word given the clues revealed by other players.
PettingZooChess
A two-player chess game environment that uses the PettingZoo Chess environment.
PettingZoo TicTacToe
A two-player tic-tac-toe game environment that uses the PettingZoo TicTacToe environment. Differing from the
Moderator Conversation environment, this environment is driven by hard-coded rules rather than a LLM moderator.
Contributing
We welcome contributions to improve and extend ChatArena. Please follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes to the new branch.
- Create a pull request describing your changes.
- We will review your pull request and provide feedback or merge your changes.
Please ensure your code follows the existing style and structure.
Citation
If you find ChatArena useful for your research, please cite our repository (our arxiv paper is coming soon):
@software{ChatArena,
author = {Yuxiang Wu, Zhengyao Jiang, Akbir Khan, Yao Fu, Laura Ruis, Edward Grefenstette, and Tim Rocktäschel},
title = {ChatArena: Multi-Agent Language Game Environments for Large Language Models},
year = {2023},
publisher = {GitHub},
journal = {GitHub repository},
version = {0.1},
howpublished = {\url{https://github.com/chatarena/chatarena}},
}
Contact
If you have any questions or suggestions, feel free to open an issue or submit a pull request. You can also contact us on the Farama discord server- https://discord.gg/Vrtdmu9Y8Q
Happy chatting!
Sponsors
We would like to thank our sponsors for supporting this project: