Repolode
Farama-Foundation

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. 1

    Install the base library with pip

    pip install gymnasium
  2. 2

    Install extra dependencies for one environment family, such as Atari

    pip install "gymnasium[atari]"
  3. 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