Google I/O is a wrap! Catch up on TensorFlow sessions View sessions

Module: tf_agents.environments.suite_gym

Suite for loading Gym Environments.

Note we use gym.spec(env_id).make() on gym envs to avoid getting a TimeLimit wrapper on the environment. OpenAI's TimeLimit wrappers terminate episodes without indicating if the failure is due to the time limit, or due to negative agent behaviour. This prevents us from setting the appropriate discount value for the final step of an episode. To prevent that we extract the step limit from the environment specs and utilize our TimeLimit wrapper.


load(...): Loads the selected environment and wraps it with the specified wrappers.

wrap_env(...): Wraps given gym environment with TF Agent's GymWrapper.

Type Aliases


absolute_import Instance of __future__._Feature
division Instance of __future__._Feature
print_function Instance of __future__._Feature