Skip to content

Registration

These functions are available directly from the gymnax namespace, for example as gymnax.make.

make

make(env_id: str, **env_kwargs) -> tuple[environment.Environment, environment.EnvParams]

Construct a registered environment and return it with its default parameters.

Parameters:

  • env_id (str) –

    ID of a built-in environment or one added with register. All available IDs are listed in registered_envs.

  • **env_kwargs (Any, default: {} ) –

    Keyword arguments forwarded to the environment constructor.

Returns:

  • tuple[Environment, EnvParams] –

    A tuple (env, params) of the environment and env.default_params.

Raises:

  • ValueError –

    If env_id is not registered.

  • TypeError –

    If the registered factory does not return an environment.

register

register(env_id: str, factory: EnvironmentFactory) -> None

Register a factory used by make to construct an environment.

Parameters:

  • env_id (str) –

    Unique public ID for the environment.

  • factory (EnvironmentFactory) –

    Callable that accepts the keyword arguments passed to make and returns a new environment instance. An Environment subclass works as its own factory.

Raises:

  • TypeError –

    If the ID or factory has an invalid type.

  • ValueError –

    If the ID is empty or already registered.

registered_envs module-attribute

registered_envs = list(_registry)

IDs of all environments that make can construct, updated in place by register.