An API standard for multi-agent reinforcement learning.


PettingZoo is a simple, pythonic interface capable of representing general multi-agent reinforcement learning (MARL) problems. PettingZoo includes a wide variety of reference environments, helpful utilities, and tools for creating your own custom environments.

The AEC API supports sequential turn based environments, while the Parallel API supports environments with simultaneous actions.

Environments can be interacted with using a similar interface to Gymnasium:

  from pettingzoo.butterfly import knights_archers_zombies_v10
  env = knights_archers_zombies_v10.env(render_mode="human")
  for agent in env.agent_iter():
      observation, reward, termination, truncation, info = env.last()
      action = policy(observation, agent)