Environment API

class netforge_rl.environment.parallel_env.NetForgeRLEnv(scenario_config: dict | EnvConfig | None = None)[source]

Bases: BaseNetForgeRLEnv, EpisodeMetricsMixin, ObservationMixin

PettingZoo parallel env.

reset(seed=None, options=None) → tuple[dict, dict][source]

Resets the environment.

And returns a dictionary of observations (keyed by the agent name)

observation_space(agent)[source]

Takes in agent and returns the observation space for that agent.

MUST return the same value for the same agent name

Default implementation is to return the observation_spaces dict

action_space(agent)[source]

Takes in agent and returns the action space for that agent.

MUST return the same value for the same agent name

Default implementation is to return the action_spaces dict

step(agent_actions: dict)[source]

Receives a dictionary of actions keyed by the agent name.

Returns the observation dictionary, reward dictionary, terminated dictionary, truncated dictionary and info dictionary, where each dictionary is keyed by the agent.

render(mode: str = 'rgb_array')[source]

Displays a rendered frame from the environment, if supported.

Alternate render modes in the default environments are ‘rgb_array’ which returns a numpy array and is supported by all environments outside of classic, and ‘ansi’ which returns the strings printed (specific to classic environments).

Gymnasium and PettingZoo registration — gym.make / pettingzoo.make.