Skip to main content

Python PyPI version pre-commit Code style: black License

GIF for MPE2 simple_tag environment

Multi Particle Environments 2 (MPE2) are a set of communication-oriented environments where particle agents can (sometimes) move, communicate, see each other, push each other around, and interact with fixed landmarks.

These environments are originally from OpenAI’s MPE codebase, with several minor fixes, mostly related to making the action space discrete by default, making the rewards consistent and cleaning up the observation space of certain environments. MPE2 additionally includes 3 new environments.

Installation

The unique dependencies for this set of environments can be installed via:

pip install mpe2

Usage

Basic Example

To launch a Simple Push environment with random agents:

from mpe2 import simple_push_v3

env = simple_push_v3.env(render_mode="human")
env.reset(seed=42)

for agent in env.agent_iter():
    observation, reward, termination, truncation, info = env.last()

    if termination or truncation:
        action = None
    else:
        # this is where you would insert your policy
        action = env.action_space(agent).sample()

    env.step(action)

env.close()

With PettingZoo 1.27 or later, import mpe2 to register its environments, then choose the AEC or Parallel API when calling make.

import mpe2
from pettingzoo import make

env = make("aec", "mpe/simple_push-v3", max_cycles=50)
parallel_env = make("parallel", "mpe/simple_push-v3", max_cycles=50)

Types of Environments

The Simple Adversary, Simple Crypto, Simple Push, Simple Tag, and Simple World Comm environments are adversarial (a "good" agent being rewarded means an "adversary" agent is punished and vice versa, though not always in a perfectly zero-sum manner). In most of these environments, there are "good" agents rendered in green and an "adversary" team rendered in red.

Collect Treasure, Simple Formation, Simple Line, Simple Reference, Simple Speaker Listener, and Simple Spread are cooperative environments. Agents must work together to achieve their goals and receive a mixture of rewards based on their own success and the success of the other agents.

Key Concepts

  • Landmarks: Landmarks are static circular features of the environment that cannot be controlled. In some environments, like Simple, they are destinations that affect the rewards of the agents depending on how close the agents are to them. In other environments, they can be obstacles that block the motion of the agents. These are described in more detail in the documentation for each environment.

  • Visibility determines which other agents and landmarks an agent can observe. Simple World Comm has forests that hide agents. The environments listed under Partial Observability also support distance-based filtering.

  • Communication: Some agents in some environments can broadcast a message as a part of its action (see action space for more details) which will be transmitted to each agent that is allowed to see that message. In Simple Crypto, this message is used to signal that Bob and Eve have reconstructed the message.

  • Color helps identify agents and landmarks in the rendered environment. Some observations also encode color, such as the goal and landmark colors seen by the good agent in Simple Push.

  • Distances: The landmarks and agents typically start out uniformly randomly placed from -1 to 1 on the map. This means they are typically around 1-2 units apart. This is important to keep in mind when reasoning about the scale of the rewards (which often depend on distance) and the observation space, which contains relative and absolute positions.

Termination

The game terminates after the number of cycles specified by the max_cycles environment argument is executed. The default for all environments is 25 cycles, as in the original OpenAI source code.

Observation Space

The observation space of an agent is a vector generally composed of the agent's position and velocity, other agents' relative positions and velocities, landmarks' relative positions, landmarks' and agents' types, and communications received from other agents. The exact form of this is detailed in the environments' documentation.

Observation sizes can differ by role. For example, adversaries in Simple World Comm receive the leader's communication as an additional part of their observation.

Partial Observability

Collect Treasure, Simple Adversary, Simple Push, Simple Spread, Simple Tag, and Simple World Comm support optional observation filters. Set radius to a positive finite distance to include entities at or within that Euclidean distance. Then num_agent_neighbors and num_landmark_neighbors can each limit the visible count to a positive integer. All three default to None.

For example, simple_spread_v4.env(radius=0.75, num_agent_neighbors=2, knn_mode="masked") shows each agent up to two other agents within 0.75 units and every landmark in that radius.

  • "compact" (default) packs each filtered group nearest-first and zero-pads unused slots. Its capacity is the configured neighbor cap, or the full group size for a radius alone.
  • "masked" gives each entity a fixed slot and zeros hidden entries. Each agent keeps its full observation size as neighbors move in and out of view.

Action Space

Note: OpenAI's MPE uses continuous action spaces by default.

Discrete action space (Default):

The action space is a discrete action space representing the combinations of movements and communications an agent can perform. Agents that can move can choose between the 4 cardinal directions or do nothing. Agents that can communicate choose between 2 and 10 environment-dependent communication options, which broadcast a message to all agents that can hear it.

Continuous action space (Set by continuous_actions=True):

The action space is a continuous action space representing the movements and communication an agent can perform. Agents that can move can input a velocity between 0.0 and 1.0 in each of the four cardinal directions, where opposing velocities e.g. left and right are summed together. Agents that can communicate can output a continuous value over each communication channel in the environment which they have access to.

Rendering

Rendering displays the scene in a window that automatically grows if agents wander beyond its border. Communication is rendered at the bottom of the scene. The render() method also returns the pixel map of the rendered area.

Citation

The MPE environments were originally described in the following work:

@article{mordatch2017emergence,
  title={Emergence of Grounded Compositional Language in Multi-Agent Populations},
  author={Mordatch, Igor and Abbeel, Pieter},
  journal={arXiv preprint arXiv:1703.04908},
  year={2017}
}

But were first released as a part of this work:

@article{lowe2017multi,
  title={Multi-Agent Actor-Critic for Mixed Cooperative-Competitive Environments},
  author={Lowe, Ryan and Wu, Yi and Tamar, Aviv and Harb, Jean and Abbeel, Pieter and Mordatch, Igor},
  journal={Neural Information Processing Systems (NIPS)},
  year={2017}
}

Please cite one or both of these if you use these environments in your research.

Metadata

Release files for mpe2 1.2.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 mpe2 1.2.0
File Size Uploaded Provenance Actions
mpe2-1.2.0.tar.gz 49.8 kB With provenance Details for mpe2-1.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 118.5 kB

Release files / mpe2-1.2.0.tar.gz

Download URL mpe2-1.2.0.tar.gz
Size 49.8 kB
Tags Source
SHA-256 checksum
How to use checksums
673b0069ac920eceb18aaea898e2f25d304bcb5d21cffc95a86af0c4869d2fe7
BLAKE2b-256 checksum
How to use checksums
beb561c2b664bcd3d7c0f3c2cfc984b626f499da30fddbb0eae96720f073d05e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / mpe2-1.2.0-py3-none-any.whl

Download URL mpe2-1.2.0-py3-none-any.whl
Size 68.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5609549501ac9d8530a663311c742b91d5770c7167e6bc6d83ce9a0e136a2a04
BLAKE2b-256 checksum
How to use checksums
990dd4aec5124acb1acb437030ce94391159ac86c17ede925fb288b5c3ab0c2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for mpe2 1.2.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mpe2-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

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.

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