OpenAI Gym

How to integrate W&B with OpenAI Gym.

If you’re using OpenAI Gym, Weights & Biases automatically logs videos of your environment generated by gym.wrappers.Monitor. Just set the monitor_gym keyword argument to wandb.init to True or call wandb.gym.monitor().

Our gym integration is very light. We simply look at the name of the video file being logged from gym and name it after that or fall back to "videos" if we don’t find a match. If you want more control, you can always just manually log a video.

The OpenRL Benchmark by CleanRL uses this integration for its OpenAI Gym examples. You can find source code (including the specific code used for specific runs) that demonstrates how to use gym with

Learn more here: http://wandb.me/openrl-benchmark-report

Last modified February 13, 2025: a09c831