An API standard for multi-agent reinforcement learning.

_images/environments-demo.gif

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.

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")
  env.reset(seed=42)
  for agent in env.agent_iter():
      observation, reward, termination, truncation, info = env.last()
      action = policy(observation, agent)
      env.step(action)