Skip to main content

Python pre-commit Code style: black

PettingZoo is a Python library for conducting research in multi-agent reinforcement learning, akin to a multi-agent version of Gymnasium.

The documentation website is at pettingzoo.farama.org and we have a public discord server (which we also use to coordinate development work) that you can join here: https://discord.gg/nhvKkYa6qX

Environments

PettingZoo includes the following families of environments:

  • Atari: Multi-player Atari 2600 games (cooperative, competitive and mixed sum)
  • Butterfly: Cooperative graphical games developed by us, requiring a high degree of coordination
  • Classic: Classical games including card games, board games, etc.
  • SISL: 2 cooperative environments, originally from https://github.com/sisl/MADRL

Installation

To install the base PettingZoo library: pip install pettingzoo.

This does not include dependencies for all families of environments (some environments can be problematic to install on certain systems).

To install the dependencies for one family, use pip install 'pettingzoo[atari]', or use pip install 'pettingzoo[all]' to install all dependencies.

We support and maintain PettingZoo for Linux and macOS. We will accept PRs related to Windows, but do not officially support it.

Getting started

For an introduction to PettingZoo, see Basic Usage. To create a new environment, see our Environment Creation Tutorial and Custom Environment Examples. For examples of training RL models using PettingZoo see our tutorials:

API

PettingZoo model environments as Agent Environment Cycle (AEC) games, in order to be able to cleanly support all types of multi-agent RL environments under one API and to minimize the potential for certain classes of common bugs.

Using environments in PettingZoo is very similar to Gymnasium, i.e. you initialize an environment via:

from pettingzoo import make
env = make("aec", "butterfly/pistonball-v6")  # need to specify aec or parallel API

Environments can be interacted with in a manner very similar to Gymnasium:

env.reset()
for agent in env.agent_iter():
    observation, reward, termination, truncation, info = env.last()
    action = None if termination or truncation else env.action_space(agent).sample()  # this is where you would insert your policy
    env.step(action)

For the complete API documentation, please see https://pettingzoo.farama.org/api/aec/

Parallel API

In certain environments, it's a valid to assume that agents take their actions at the same time. For these games, we offer a secondary API to allow for parallel actions, documented at https://pettingzoo.farama.org/api/parallel/

SuperSuit

SuperSuit is a library that includes all commonly used wrappers in RL (frame stacking, observation, normalization, etc.) for PettingZoo and Gymnasium environments with a nice API. We developed it in lieu of wrappers built into PettingZoo. https://github.com/Farama-Foundation/SuperSuit

Environment Versioning

PettingZoo keeps strict versioning for reproducibility reasons. All environments end in a suffix like "_v0". When changes are made to environments that might impact learning results, the number is increased by one to prevent potential confusion.

Citation

To cite this project in publication, please use

@article{terry2021pettingzoo,
  title={Pettingzoo: Gym for multi-agent reinforcement learning},
  author={Terry, J and Black, Benjamin and Grammel, Nathaniel and Jayakumar, Mario and Hari, Ananth and Sullivan, Ryan and Santos, Luis S and Dieffendahl, Clemens and Horsch, Caroline and Perez-Vicente, Rodrigo and others},
  journal={Advances in Neural Information Processing Systems},
  volume={34},
  pages={15032--15043},
  year={2021}
}

Project Maintainers

  • Project Manager: Travis Virgil - travis@farama.org
  • Maintenance for this project is also contributed by the broader Farama team: farama.org/team.

Metadata

Release files for pettingzoo 1.28.0

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

Source distribution (sdist)

Source distribution for pettingzoo 1.28.0
File Size Uploaded Provenance Actions
pettingzoo-1.28.0.tar.gz 503.6 kB Without provenance Details for pettingzoo-1.28.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.2 MB

Release files / pettingzoo-1.28.0.tar.gz

Download URL pettingzoo-1.28.0.tar.gz
Size 503.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5e0b763c7d270c7b72028ffee41501dc7b386bb21c6590a84e501edbae811580
BLAKE2b-256 checksum
How to use checksums
7c6cbcb5da8fd3d6f63a9a75f93ba119378c41ba60275dbfda6b3a388fec055d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pettingzoo-1.28.0-py3-none-any.whl

Download URL pettingzoo-1.28.0-py3-none-any.whl
Size 712.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0fb11a6c708061e50e1f588440e5a3335e437bee3ae9eaf490afa830d50431b0
BLAKE2b-256 checksum
How to use checksums
109af6d6100650fe81c9a657329fccabeaf94e8e1360936cd6aeb2d044104c31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for pettingzoo 1.28.0

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

1.28.0 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