Skip to content

Legacy step API

LegacyStepAPIWrapper

LegacyStepAPIWrapper(env: Environment)

Expose an environment through the five-value step API of Gymnax 0.x.

step returns (obs, state, reward, done, info) with done = terminated | truncated. The separate flags and the pre-reset observation stay available as info["terminated"], info["truncated"] and info["final_observation"]. Intended as a migration aid; new code should use the six-value API.

Parameters:

reset

reset(key: Array, params: EnvParams | None = None) -> tuple[Any, environment.EnvState]

Reset the wrapped environment; identical to its own reset.

step

step(key: Array, state: EnvState, action: int | float | Array, params: EnvParams | None = None) -> tuple[Any, environment.EnvState, jax.Array, jax.Array, dict[Any, Any]]

Step the wrapped environment and merge both flags into done.