Upgrading to 1.0¶
gymnax 1.0 changed the return value of step to match Gymnasium.
What changed¶
doneis split intoterminated(natural end) andtruncated(time limit).infoalways containsterminated,truncatedandfinal_observation, the observation before the automatic reset.- Custom environments implement
observe(key, state, action, params), andstep_envreturns(obs, state, reward, terminated, info)without handling the time limit.
Migrating learning code¶
Replace done by terminated | truncated for episode bookkeeping. For value targets,
bootstrap from info["final_observation"] and mask only with terminated:
See Concepts for the reasoning.
Keeping the old return value¶
Code that cannot migrate yet can wrap the environment:
from gymnax.wrappers import LegacyStepAPIWrapper
legacy_env = LegacyStepAPIWrapper(env)
obs, state, reward, done, info = legacy_env.step(key, state, action, params)
The separate flags and final_observation remain available in info.
The API RFC records the full contract and the reasoning behind it.