Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Farama Foundation Gymnasium Observation Action Space Design

From Leeroopedia
Knowledge Sources
Domains Reinforcement_Learning, Space_Definition
Last Updated 2026-02-15 03:00 GMT

Overview

The practice of formally defining the mathematical structure and constraints of observations and actions in an RL environment using typed space objects.

Description

Observation and Action Space Design is the process of choosing appropriate mathematical representations for what an agent perceives (observations) and what it can do (actions). Gymnasium provides a hierarchy of Space types:

  • Box: Continuous n-dimensional arrays with per-element bounds. Used for physical quantities (positions, velocities, pixel images).
  • Discrete: Finite set of integers. Used for categorical choices (move directions, card actions).
  • Dict: Named dictionary of sub-spaces. Used for structured observations with heterogeneous components.
  • MultiBinary / MultiDiscrete: Binary vectors and multi-dimensional discrete spaces.
  • Tuple / Sequence / Graph: Composite spaces for complex structures.

Space design determines:

  • What inputs the agent network must accept
  • What outputs the agent must produce
  • How random exploration (sampling) works
  • How environment validation (env_checker) verifies correctness

Usage

Use space design when implementing custom environments. The observation_space and action_space must be set in __init__ as Space objects. Choose Box for continuous values, Discrete for finite choices, and Dict for structured multi-component observations.

Theoretical Basis

In the MDP formulation:

  • State/observation space 𝒮 defines all possible states
  • Action space 𝒜 defines all possible actions

Gymnasium spaces provide:

  • Sampling: aUniform(𝒜) for exploration
  • Containment: o𝒮 for validation
  • Flattening: f:𝒮n for neural network input

Related Pages

Implemented By

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment