Skip to content

Environments API

Environment APIs are split into base factories/classes and temporal constraint wrappers. Constraint wrappers attach LTLf objectives through BoolRewardWrapper.

Shared Native Gridworld Adapter

Bases: BaseParallelWrapper

Expose a native substrate's RGB field as a normalized policy tensor.

Bases: BaseParallelWrapper

Flatten compact native object fields into a normalized policy vector.

Native substrates construct categorical grids directly from simulation state when rendering is disabled. This adapter preserves that no-render path while exposing the flat Box observations expected by the temporal monitor and neural learners.

Coins

Build the native two-player Coins substrate.

Bases: NativeRGBObservationWrapper

Coins-specific normalized RGB policy adapter.

Bases: CoinsLabelMixin, BoolRewardWrapper

Collect one's matching coin before ever taking the partner's coin.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Bases: CoinsOwnCoinFirstConstraint

Compatibility name for the selected own-coin-first objective.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Matrix

Bases: ParallelEnv

Repeated 2-player stag hunt with global binary observations.

Observations expose the last joint action and whether the last stage was unmirrored: ch0 = player_0 chose Hare ch1 = player_0 chose Stag ch2 = player_1 chose Hare ch3 = player_1 chose Stag ch4 = last outcome was off-diagonal

Bases: SHLabelMixin, BoolRewardWrapper

Objective wrapper for a hare-then-stag handshake without mismatches.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Bases: SHLabelMixin, BoolRewardWrapper

Objective wrapper for reaching sustained stag play after coordination.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Bases: SHLabelMixin, BoolRewardWrapper

Objective wrapper requiring both hare and stag modes without mismatches.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Pursuit

Bases: ParallelEnv

Pursuit Evasion (Parallel PettingZoo) Also referred to as Guard-Gridworld.

  • Agents: 2 or 3 (0 is the Guard; 1 and 2 are normal).
  • Actions: {Left, Right, Up, Down, Stay}. Moves into walls/bounds are ignored.
  • Collision: any two agents share a cell after the simultaneous move.
  • Goal: true iff agent 0 OR 1 is in the goal region.

Rewards default to 0; optional shaping provided via constructor. Observations (globalised): binary channels shared by all agents: [Wall, Goal, A0, A1, (A2)] with dtype=np.float32. If flatten_observations is True, this is flattened to (HWC,).

state_space property

state_space

Describe the shape/dtype of state().

action_names

action_names(action: int) -> str

Human-friendly name for an action integer ID.

channel_names

channel_names() -> list[str]

Human-friendly names for each observation channel index.

Channels are

0: Wall 1: Goal 2+: Agents (0 = guard, others = normal agents)

get_state

get_state()
Tuple layout

( agents: tuple[str, ...], t: int, collision_ever: bool, goal_last_step: bool, collision_last_step: bool, agent_pos: tuple[Coord, ...] # ordered by possible_agents rng_state: object )

num_cells

num_cells() -> int

Number of spatial cells in the layered observation grid.

state

state()

Global, agent-agnostic state (same content as obs), matches state_space().

Bases: PELabelMixin, BoolRewardWrapper

Classic guard-vs-intruder pursuit objective wrapper.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Bases: PELabelMixin, BoolRewardWrapper

Objective wrapper for guard capture versus intruder stealth.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Bases: PELabelMixin, BoolRewardWrapper

Objective wrapper for coordinated intruder goal reaching.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Bases: PELabelMixin, BoolRewardWrapper

Objective wrapper for reaching the gridworld gap without collisions.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Chemistry

Build a native PettingZoo Chemistry substrate.

Bases: NativeRGBObservationWrapper

Chemistry-specific normalized RGB policy adapter.

Bases: ChemistryLabelMixin, BoolRewardWrapper

Objective wrapper for eventually metabolizing food per agent.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Bases: ChemistryLabelMixin, BoolRewardWrapper

Objective wrapper requiring each agent's food event before shared XY.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Bases: ChemistryLabelMixin, BoolRewardWrapper

Objective wrapper requiring each agent's food event before its XY event.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Bases: ChemistryLabelMixin, BoolRewardWrapper

Objective wrapper for eventually metabolizing XY per agent.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Harvest

Build a native PettingZoo Commons Harvest substrate.

Bases: NativeRGBObservationWrapper

Harvest-specific normalized RGB policy adapter.

Bases: HarvestLabelMixin, BoolRewardWrapper

Objective wrapper for eventually collecting an apple per agent.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Bases: HarvestLabelMixin, BoolRewardWrapper

Objective wrapper for collecting an apple without being zapped per agent.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Territory

Build a native PettingZoo Territory substrate.

Bases: NativeRGBObservationWrapper

Territory-specific RGB adapter preserving side-channel infos for labels.

Bases: TerritoryLabelMixin, BoolRewardWrapper

Objective wrapper for eventually claiming a resource per agent.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Bases: TerritoryLabelMixin, BoolRewardWrapper

Objective wrapper for resource claims while all zappers stay ready.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Bases: TerritoryLabelMixin, BoolRewardWrapper

Two-agent race in which each player tries to make the first sole claim.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Gift Refinements

Build the native PettingZoo Gift Refinements substrate.

Bases: NativeRGBObservationWrapper

Gift Refinements RGB adapter preserving inventory and reward infos.

Bases: GiftRefinementsLabelMixin, BoolRewardWrapper

Objective wrapper for eventually consuming tokens per agent.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.

Bases: GiftRefinementsLabelMixin, BoolRewardWrapper

Objective wrapper for receiving a refined gift before consuming tokens.

export

export(
    to_file: bool = True,
    dir: str = "exports",
    filename: str = "bool_rm.dot",
) -> Dict[AgentID, graphviz.Digraph]

Export one automaton per agent monitor.

  • If filename contains "{agent}", it will be formatted with the agent id. Example: filename="rm_{agent}.dot"
  • Otherwise, we append the agent id before the extension: "bool_rm.dot" -> "bool_rm_player_0.dot"
  • If filename includes subdirectories (e.g. "graphs/rm.dot"), they are created too.