PyTorch implementations of reinforcement learning algorithms, designed as a reliable, consistent baseline for research and applications.
Farama-Foundation/Gymnasium
A standard Python API for single-agent reinforcement learning environments, plus a set of reference environments, forked from OpenAI's Gym.
- Stars
- 12,704
- Forks
- 1,513
- Open issues
- 117
- Last commit
- 7 days ago
What is it?
Gymnasium provides a common interface between reinforcement learning algorithms and the environments they train in. Each environment exposes reset and step methods along with observation and action spaces, so an agent written against one environment can be run on another without changes to the learning code.
The library ships with a standard set of environments grouped into Classic Control, Box2D, Toy Text, MuJoCo and Atari families, and a `gymnasium.make` function creates them by ID such as "CartPole-v1". Additional families are installed as optional extras, for example `pip install "gymnasium[atari]"`, because some physics and emulator dependencies are difficult to install on every system. Environment IDs carry version suffixes, which are incremented when changes could affect learning results.
Gymnasium is a fork of OpenAI's Gym, maintained by the Farama Foundation after OpenAI handed over maintenance. Third-party environments that follow the same API can be used with it, and the project is used alongside related libraries such as PettingZoo for multi-agent work.
Key features
- 01Standard reset/step API shared by all supported environments
- 02Built-in environment families including Classic Control, Box2D, Toy Text, MuJoCo and Atari
- 03Environments created by ID with `gymnasium.make`
- 04Optional dependency extras to install only the environment families you need
- 05Versioned environment IDs to keep results reproducible
Use cases
- Benchmarking a new reinforcement learning algorithm on standard tasks
- Teaching reinforcement learning with simple environments like CartPole and Toy Text
- Debugging agent implementations with small discrete environments
- Plugging a custom or third-party environment into existing agent code
Quick start
- 1
Install the base library with pip
pip install gymnasium - 2
Install extra dependencies for one environment family, such as Atari
pip install "gymnasium[atari]" - 3
Create an environment and step through it with the example code from the README
Things to know
- Many environment families need extra dependencies, and some are difficult to install on certain systems.
Topics
FAQ
- What is Gymnasium?
- A standard Python API for single-agent reinforcement learning environments, plus a set of reference environments, forked from OpenAI's Gym. Gymnasium provides a common interface between reinforcement learning algorithms and the environments they train in. Each environment exposes reset and step methods along with observation and action spaces, so an agent written against one environment can be run on another without changes to the learning code.
- Is Gymnasium free to use? What license does it have?
- Gymnasium is open source under the MIT license. Check the license terms before using it in commercial products.
- Is Gymnasium still maintained?
- Actively maintained. The last commit to Gymnasium was on Oct 14, 2026.
- What can I use Gymnasium for?
- Benchmarking a new reinforcement learning algorithm on standard tasks Teaching reinforcement learning with simple environments like CartPole and Toy Text Debugging agent implementations with small discrete environments Plugging a custom or third-party environment into existing agent code
- How do I install Gymnasium?
- Install the base library with pip: pip install gymnasium Install extra dependencies for one environment family, such as Atari: pip install "gymnasium[atari]" Create an environment and step through it with the example code from the README
- Where can I get Gymnasium?
- The source code and installation instructions are on GitHub: https://github.com/Farama-Foundation/Gymnasium
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
AI-oriented quantitative investment platform from Microsoft covering data, model training, backtesting and order execution for quant research.
Ray is a unified framework for scaling Python and AI applications from a laptop to a cluster, with a distributed runtime and AI libraries.
A Python framework for building, scaling and deploying AI and ML workflows, from notebook prototypes to production orchestrators.
Self-hosted cloud platform for running a collaborative team of AI agents that can call and interact with each other.
A customizable framework for evaluating LLMs, VLMs and AIGC models on benchmarks, plus inference performance stress testing and result dashboards.