PettingZoo is a Python library providing a standardized API for multi-agent reinforcement learning (MARL) environments, analogous to Gymnasium for single-agent RL. It offers a wide variety of reference environments and utilities, supporting both sequential (AEC) and simultaneous (Parallel) action paradigms. Currently at version 1.25.0, the library is actively maintained with frequent updates to ensure compatibility with recent Python and Gymnasium versions.
pip install pettingzooVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to initialize and interact with a PettingZoo environment using the Agent-Environment Cycle (AEC) API, which is suitable for turn-based or sequentially acting multi-agent systems. It uses the `pistonball_v6` environment, renders it to a human-readable window, resets it with a fixed seed for reproducibility, and then steps through agents until the episode terminates or truncates.
Upgrade Python to a supported version (3.9, 3.10, 3.11, or 3.12).
Update your imports to `mpe2` (e.g., `from mpe2 import simple_spread_v3`) once the `MPE2` package is stable and available.
Replace calls to `env.seed(seed)` with `env.reset(seed=seed)`.
Remove `return_info=True` or `return_info=False` from `env.reset()` calls. Access info directly from the returned tuple: `observation, info = env.reset(seed=42)`.
Update imports and references to `AgentSelector` if you are directly using this utility class.
Prefer Linux or macOS for development. If on Windows, be prepared to troubleshoot environment-specific dependencies (e.g., `cmake`, `swig`).
Upgrade PettingZoo to a later stable version (e.g., `pip install pettingzoo>=1.23.0`).