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()Bug-fix release preserving final step info in vector environments and adding render warnings; no breaking changes.
- –Check vector environment code: final obs/info now nested under 'final_observation' and 'final_info' keys in the returned info dict.
- –Expect new warnings if calling render without specifying render_mode during environment initialization.
Bug fix release restoring mujoco-py-only installs and correcting render-mode checks in wrappers.
- –Remove hard mujoco dependency if using mujoco-py alone; PixelObservationWrapper now requires env.render_mode set.
- –Fix CarRacing wheel colors and BipedalWalker backward-movement render array size inconsistencies.
Final major API overhaul enforces step termination/truncation split, reset info, no seed function, and render mode at init; use EnvCompatibility wrapper for old v21/22 envs.
- –Update all step calls to handle 5 return values (obs, reward, termination, truncation, info) and reset to return (obs, info).
- –Pass render_mode during gym.make initialization instead of to render() and remove any Env.seed calls in favor of reset(seed=...).
See how people are using gym
Related Repositories
Discover similar tools and frameworks used by developers
gemini-cli
Access Google's powerful Gemini AI models directly from your terminal with an intuitive command-line interface for text, image, and multimodal interactions.
stablediffusion
Text-to-image diffusion in compressed latent space.
Wan2.1
Diffusion transformer models for text and image-to-video generation.
TTS
PyTorch toolkit for deep learning text-to-speech synthesis.
koboldcpp
Self-contained distribution of llama.cpp with KoboldAI-compatible API server for running large language models locally on consumer hardware.