Python API¶
- class netforge_rl.ActionEffect(success: bool, state_deltas: Dict[str, Any] | List[IStateDeltaCommand], observation_data: Dict[str, Any], eta: int = 0, action: BaseAction | None = None)[source]¶
Bases:
objectResult of executing an action — consumed by the conflict resolver.
- class netforge_rl.BaseAction(agent_id: str, target_ip: str | None = None, source_ip: str | None = None, cost: int = 1, financial_cost: int = 0, compute_cost: int = 0, duration: int = 1, required_prior_state: str | None = None)[source]¶
Bases:
ABC
- class netforge_rl.BaseObservation(agent_id: str)[source]¶
Bases:
objectPer-agent partial view of the network.
- class netforge_rl.GlobalNetworkState[source]¶
Bases:
objectMutable single source of truth for the legacy MARL physics engine.
- apply_delta(delta_key: Any, delta_value: Any = None)[source]¶
Apply a state delta — either a Command object or a string.
- class netforge_rl.NetForgeRLEnv(scenario_config: dict | EnvConfig | None = None)[source]¶
Bases:
BaseNetForgeRLEnv,EpisodeMetricsMixin,ObservationMixinPettingZoo 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).