factoriax.engine.envs.registry

factoriax.engine.envs.registry#

The scenario registry, which stands behind factoriax.make("<id>").

A scenario is a factory of the form () -> (env, params). The registry maps a gymnax-style version id to a ScenarioSpec. That spec holds the display name and description of the scenario, and the factory itself.

make() resolves an id and applies the observation settings and the auto-reset wrapper that the caller asked for. list_scenarios() returns the list that the playground walks.

class factoriax.engine.envs.registry.ScenarioSpec(name: str, description: str, build: Callable[[], tuple[Any, EnvParams]], resample: bool = False)#

A registered scenario: its display name, its description, and its factory.

factoriax.engine.envs.registry.list_scenarios() → tuple[tuple[str, ScenarioSpec], ...]#

Return every registered scenario id, with its spec.

factoriax.engine.envs.registry.make(env_id: str, *, obs: str | None = None, obs_radius: int | None = None, auto_reset: bool = True, resample: bool | None = None) → tuple[Any, EnvParams]#

Resolve a scenario id to an (env, params) pair.

Parameters:
  • env_id – Registered scenario id, for example "EasyRocket-v1".

  • obs – Name of an observation variant, which must be a key in OBSERVATIONS. None takes the default of the scenario.

  • obs_radius – Half-width of a local window. None takes the default of the scenario. A _global observation variant ignores this argument.

  • resample – Auto-reset mode. None, the default, takes the resample setting of the scenario. Pass True or False to override it. Pass False for the cheap cached restore, even on a keyed scenario.

  • auto_reset – Whether to wrap the environment in AutoResetWrapper. The default is True, because most callers train inside a lax.scan rollout of fixed length and need an episode to restart on done. Pass False to control the episodes yourself, as a scripted rollout, interactive play, or a training loop with its own reset-on-done code does.

Returns:

The pair (env, params).

Return type:

tuple

Raises:

KeyError – If no scenario carries the id env_id.