Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Provides a unified single-agent reinforcement learning environment API with Classic Control, Box2D, Toy Text, MuJoCo, and Atari families.
Use this skill ↓96% 96%0 ptsof test cases passed
Passed 23 of 24 test cases with the skill, and 23 of 24 without it.
3 of 3 safety checks passed
--|------|---------|
| observation | ndarray / dict | Current state observation |
| reward | float | Immediate reward |
| terminated | bool | Terminal state reached (success/failure) |
| truncated | bool | Episode ended by time limit/external signal |
| info | dict | Auxiliary diagnostic info |
Critical distinction: terminated means the MDP ended naturally. truncated means it hit a time limit. Both should trigger reset(), but your algorithm should handle them differently (no value bootstrap on terminated).
| Family | Examples | Install | Use Case |
|---|---|---|---|
| Classic Control | CartPole, MountainCar, Pendulum, Acrobot | pip install gymnasium | Algorithm debugging, quick tests |
| Box2D | LunarLander, BipedalWalker, CarRacing | pip install "gymnasium[box2d]" | Physics-based toy problems |
| Toy Text | FrozenLake, Taxi, Blackjack | pip install gymnasium | Discrete RL, teaching |
| MuJoCo | HalfCheetah, Hopper, Humanoid, Ant | pip install "gymnasium[mujoco]" | Continuous control benchmarks |
| Atari | Breakout, Pong, SpaceInvaders | pip install "gymnasium[atari]" (ALE) | Pixel-based RL, DQN development |
Install all:
pip install "gymnasium[all]"
import gymnasium as gym
from gymnasium import spaces
env = gym.make("CartPole-v1")
print(env.observation_space) # Box([-4.8 ...], [4.8 ...], (4,), float32)
print(env.action_space) # Discrete(2)
# Check space properties
assert isinstance(env.observation_space, spaces.Box)
print(env.observation_space.shape) # (4,)
print(env.observation_space.dtype) # float32
print(env.observation_space.low) # [-4.8 -inf -0.418 -inf]
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.