gitmyhub

Gymnasium

Python ★ 12k updated 12d ago

An API standard for single-agent reinforcement learning environments, with popular reference environments and related utilities (formerly Gym)

A standard Python toolkit for reinforcement learning that provides a shared API and a large collection of environments, from pole-balancing puzzles to Atari games, so any learning algorithm can plug into any environment with the same ten lines of code.

PythonMuJoCoBox2Dsetup: easycomplexity 3/5

Gymnasium is an open-source Python library that gives researchers and developers a standard way to build and test reinforcement learning experiments. Reinforcement learning is a branch of AI where a software agent learns to make decisions by interacting with an environment and receiving feedback on whether its actions were good or bad. Gymnasium provides the shared language that lets a learning algorithm talk to any compatible environment without needing custom glue code for each combination.

The project started as a fork of OpenAI's Gym library, which OpenAI handed off to an outside team. That outside team, the Farama Foundation, now maintains it here as Gymnasium, where all future development happens.

Out of the box, Gymnasium ships several families of test environments. Classic Control covers physics problems like balancing a pole on a cart. Box2D includes toy games built around 2D physics. Toy Text environments are deliberately tiny and simple, useful for checking that a learning algorithm works at all before scaling up. MuJoCo environments simulate complex multi-joint bodies, like robotic limbs, and are more demanding. Atari environments replay hundreds of classic video games so agents can try to learn to play them. A growing collection of third-party environments built by the broader community also works with the same API.

The programming interface is straightforward. You pick an environment by name, call a reset to start a new session, and then repeatedly call step to send an action and get back what the agent observes next, a reward signal, and a flag indicating whether the episode ended. A short code sample in the README shows this loop running in about ten lines of Python.

Installation is done through pip. The base package is small; optional extras install the heavier dependencies for specific environment families like Atari or MuJoCo, or you can install everything at once. Python 3.10 through 3.13 on Linux and macOS are officially supported.

Gymnasium is widely used in academic research and as a starting point for anyone learning about reinforcement learning. Related libraries from the same foundation, such as PettingZoo for multi-agent setups, extend the same API conventions into other scenarios.

Where it fits