Gym: Reinforcement learning algorithm development toolkit
Standard API for reinforcement learning environment interfaces.
Learn more about Gym
Gym is a Python library that establishes a standard interface between reinforcement learning agents and environments. The library defines a simple API where environments are implemented as Python classes that accept actions and return observations, rewards, and termination signals. Gym includes implementations of classic control tasks, Atari games, and physics simulations, with strict versioning for reproducibility when environment implementations change. The toolkit is designed to facilitate algorithm development and comparison by removing the need for researchers to build custom environment interfaces for each new project.
Standardized Environment Interface
All environments implement a uniform API where agents call step() and reset() methods with consistent return signatures. Eliminates the need to write custom integration code when switching between control tasks, games, or physics simulations.
Strict Environment Versioning
Environments use versioned suffixes (v0, v1, etc.) that increment when implementation changes affect learning outcomes. Ensures reproducibility when comparing algorithm results across papers and prevents silent behavioral changes.
Modular Dependency Installation
Install environment dependencies selectively based on which environments you need. Avoid heavy dependencies like MuJoCo or Atari ROMs if using only classic control environments.
from ray.rllib.algorithms.ppo import PPOConfig
config = PPOConfig().environment("CartPole-v1")
algo = config.build_algo()
for i in range(3):
result = algo.train()
print(f"Iteration {i}: reward={result['env_runners']['episode_return_mean']}")
algo.stop()Minor bug fix release with render mode warnings, Atari wrapper improvements, and documentation fixes.
- –Adds warnings when trying to render without specifying the render_mode
- –Updates Atari Preprocessing such that the wrapper can be pickled
- –Github CI was hardened to such that the CI just has read permissions
- –Clarify and fix typo in GraphInstance
Minor bug fixes for MuJoCo dependencies, pixel observation wrapper, and rendering issues.
- –Fixed mujoco dependency to allow only mujoco-py to be installed and used
- –PixelObservationWrapper raises exception if env.render_mode is not specified
- –Fixed bug in CarRacing where wheel colours were not correct
- –Fixed BipedalWalker where moving backwards caused different sized rendered arrays
- –Fixed truncation typo in readme API example
Major API changes finalizing the core API with new video recording, improved masking, and compatibility wrapper.
- –Added save_video using moviepy to render RGB frames and updated RecordVideo, removes ansi output support
- –RandomNumberGenerator functions have been removed
- –Bump ale-py to 0.8.0 for compatibility with new core API
- –Added EnvAPICompatibility wrapper
- –Added improved Sequence, Graph and Text sample masking
Top in AI & ML
Related Repositories
Discover similar tools and frameworks used by developers
LangChain
Modular framework for chaining LLMs with external data.
whisper.cpp
Lightweight C++ port of OpenAI Whisper for cross-platform speech recognition.
DALL-E
Official PyTorch package implementing the discrete VAE component for image tokenization used in OpenAI's DALL-E system.
ControlNet
Dual-branch architecture for conditional diffusion model control.
Text Generation WebUI
Gradio-based UI for running LLMs locally with multiple model format and extension support.