Implementing Custom Wrappers - Gymnasium Documentation
In this tutorial we will describe how to implement your own custom wrappers. Wrappers are a great way to add functionality to your environments in a modular way. This will save you a lot of boilerplate code. We will show how to create a wrapper by Inheriting from gymnasium.ObservationWrapper Inheriting from gymnasium.ActionWrapper Inheriting from gymnasium.RewardWrapper Inheriting from gymnasium.Wrapper Before following this tutorial, make sure to check out the docs of the gymnasium.wrappers module. Observation wrappers are useful if you want to apply some function to the observations that are returned by an environment. If you implement an observation wrapper, you only need to define this transformation by implementing the gymnasium.ObservationWrapper.observation() method. Moreover, you should remember to update the observation space, if the transformation changes the shape of observations (e.g. by transforming dictionaries into numpy arrays, as in the following example). Imagine you
Note This tutorial is compatible with Gymnasium version 1.3.0. Implementing Custom Wrappers ¶ In this tutorial we will describe how to implement your own custom wrappers. Wrappers are a great way to add functionality to your environments in a modular way. This will save you a lot of boilerplate code. We will show how to create a wrapper by Inheriting from gymnasium.ObservationWrapper Inheriting from gymnasium.ActionWrapper Inheriting from gymnasium.RewardWrapper Inheriting from gymnasium.Wrapper Before following this tutorial, make sure to check out the docs of the gymnasium.wrappers module. I
Explore this link on the map →related reading
- The 37 Implementation Details of Proximal Policy Optimization · The ICLR Blog Trackiclr-blog-track.github.io
- Reward Hacking in Reinforcement Learning | Lil'Loglilianweng.github.io
- Introducing OpenReward | General Reasoninggr.inc
- Specification gaming: the flip side of AI ingenuity — Google DeepMinddeepmind.google
- A Taxonomy of RL Environments for LLM Agentsleehanchung.github.io
- GitHub - ccli3896/RLWorms: Setting up C elegans as an RL environment. · GitHubgithub.com
- Reward Is Not Enough — LessWronglesswrong.com
- A Toy Environment For Exploring Reasoning About Reward — LessWronglesswrong.com
- Game & Third-Party Tool Integration | exo docsexoharness.ai
- Specification gaming: the flip side of AI ingenuity — Google DeepMinddeepmind.google
- [2604.25850] Agentic Harness Engineering: Observability-Driven Automatic Evolution of Coding-Agent Harnessesarxiv.org
- [1606.05312] Successor Features for Transfer in Reinforcement Learningarxiv.org