Understanding the anatomy of Gym environments

Any Gym-compatible environment should subclass the gym.Env class and implement the reset and step methods and the observation_space and action_space properties and attributes. There is also the opportunity to implement other, optional methods that can add additional functionality to our custom environments. The following table lists and describes the other methods available:

Method
Functionality description
observation_space
The shape and type of the observations returned by the environment.
action_space
The shape and type of the actions accepted by the environment.
reset()
Routines to reset the environment at the start or end of an episode.
step(...)
Routines ...

Get Hands-On Intelligent Agents with OpenAI Gym now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.