gitmyhub

gym

Python ★ 37k updated 2mo ago ▣ archived

A toolkit for developing and comparing reinforcement learning algorithms.

A standard toolkit of simulated game and physics environments for teaching AI agents through trial and reward. Now superseded by Gymnasium, use this repo only for legacy projects.

PythonMuJoCosetup: moderatecomplexity 3/5

OpenAI Gym is a Python toolkit that provides a standard set of simulated environments for developing and testing reinforcement learning algorithms. Reinforcement learning is a branch of AI where an agent learns by taking actions in an environment and receiving rewards or penalties — the goal is to learn a strategy that maximizes cumulative rewards over time. The problem Gym solves is that building such environments from scratch for every experiment is time-consuming, and without a common interface, it is hard to compare different algorithms fairly.

Gym defines a simple, consistent API: every environment has a step function (take an action, get back the new state and a reward), a reset function (start fresh), and an observation space and action space describing what the agent can see and do. Researchers or developers implement their learning algorithm once against this interface, then swap in different environments without changing their code. The library shipped with a wide variety of built-in environments — classic control tasks like balancing a pole on a cart, Atari video game simulators, physics-based robotics simulations using the MuJoCo physics engine, and simple grid worlds.

Note from the README: Gym itself is no longer actively maintained. The team that maintained it since 2021 has moved all future development to a successor project called Gymnasium (by the Farama Foundation), which is a drop-in replacement. If you are starting a new project, the README explicitly recommends switching to Gymnasium instead. You would use the original Gym repository to run older code that depends on it, or to understand the history of the reinforcement learning API standard. The tech stack is Python, compatible with versions 3.7 through 3.10 on Linux and macOS.

Where it fits