Applications, Environments & Sim-to-Real

OpenAI Gym / Gymnasium

Gym, now maintained by the community as Gymnasium, is the universal plug of reinforcement learning — a tiny, agreed-upon Python interface so that any agent can connect to any environment without rewriting glue code. Its design has become the de-facto standard the whole field builds on.

The core is two methods. reset() returns an initial observation and starts an episode; step(action) returns the next observation, a reward, a terminated flag, a truncated flag, and an info dictionary. Space objects describe what is valid: Box for continuous quantities, Discrete for a finite set of actions. Environments register under string ids, so you write make("CartPole-v1") and get a ready-to-use task.

obs, info = env.reset(seed=0)
obs, reward, terminated, truncated, info = env.step(action)

The whole Gymnasium loop fits in two calls.

OpenAI's original Gym was deprecated; Gymnasium is the maintained successor. It split the old single done flag into terminated (the task genuinely ended) versus truncated (a time limit cut it short) — a subtle distinction that matters when you bootstrap a value estimate at the final step.

Also called
Gym APIGymnasium