class_docstr: An interface to the kaggle's football environment.
  
  See: https://github.com/Kaggle/kaggle-environments
class_docstr_tok: ["An","interface","to","the","kaggle","'s","football","environment",".","See",":","https",":","\/\/github.com\/Kaggle\/kaggle-environments"]
docstr: Construct the action and observation spaces
  
  Description of actions and observations:
  https://github.com/google-research/football/blob/master/gfootball/doc/
  observation.md
docstr_tok: ["Construct","the","action","and","observation","spaces","Description","of","actions","and","observations",":","https",":","\/\/github.com\/google-research\/football\/blob\/master\/gfootball\/doc\/","observation.md"]
code: def build_agent_spaces(self) -> Tuple[Space, Space]:
      """Construct the action and observation spaces
  
      Description of actions and observations:
      https://github.com/google-research/football/blob/master/gfootball/doc/
      observation.md
      """  # noqa: E501
      action_space = Discrete(19)
      # The football field's corners are [+-1., +-0.42]. However, the players
      # and balls may get out of the field. Thus we multiply those limits by
      # a factor of 2.
      xlim = 1.0 * 2
      ylim = 0.42 * 2
      num_players: int = 11
      xy_space = Box(
          np.array([-xlim, -ylim], dtype=np.float32),
          np.array([xlim, ylim], dtype=np.float32),
      )
      xyz_space = Box(
          np.array([-xlim, -ylim, 0], dtype=np.float32),
          np.array([xlim, ylim, np.inf], dtype=np.float32),
      )
      observation_space = DictSpace(
          {
              "controlled_players": Discrete(2),
              "players_raw": TupleSpace(
                  [
                      DictSpace(
                          {
                              # ball information
                              "ball": xyz_space,
                              "ball_direction": Box(
                                  -np.inf, np.inf, (3,)
                              ),
                              "ball_rotation": Box(
                                  -np.inf, np.inf, (3,)
                              ),
                              "ball_owned_team": Discrete(3),
                              "ball_owned_player": Discrete(
                                  num_players + 1
                              ),
                              # left team
                              "left_team": TupleSpace(
                                  [xy_space] * num_players
                              ),
                              "left_team_direction": TupleSpace(
                                  [xy_space] * num_players
                              ),
                              "left_team_tired_factor": Box(
                                  0.0, 1.0, (num_players,)
                              ),
                              "left_team_yellow_card": MultiBinary(
                                  num_players
                              ),
                              "left_team_active": MultiBinary(
                                  num_players
                              ),
                              "left_team_roles": MultiDiscrete(
                                  [10] * num_players
                              ),
                              # right team
                              "right_team": TupleSpace(
                                  [xy_space] * num_players
                              ),
                              "right_team_direction": TupleSpace(
                                  [xy_space] * num_players
                              ),
                              "right_team_tired_factor": Box(
                                  0.0, 1.0, (num_players,)
                              ),
                              "right_team_yellow_card": MultiBinary(
                                  num_players
                              ),
                              "right_team_active": MultiBinary(
                                  num_players
                              ),
                              "right_team_roles": MultiDiscrete(
                                  [10] * num_players
                              ),
                              # controlled player information
                              "active": Discrete(num_players),
                              "designated": Discrete(num_players),
                              "sticky_actions": MultiBinary(10),
                              # match state
                              "score": Box(-np.inf, np.inf, (2,)),
                              "steps_left": Box(0, np.inf, (1,)),
                              "game_mode": Discrete(7),
                          }
                      )
                  ]
              ),
          }
      )
      return action_space, observation_space
  
file_path: ray/python/ray/rllib/env/wrappers/kaggle_wrapper.py
imports: from copy import deepcopy
  from gymnasium.spaces import Box, Dict, Discrete, MultiBinary, MultiDiscrete, Space, Tuple
  import numpy
  from typing import Any, Dict, Optional, Tuple
  from ray.rllib.env import MultiAgentEnv
  from ray.rllib.utils.typing import MultiAgentDict, AgentID
label_desc: Use image node_id 5 for calling the KaggleFootballMultiAgentEnv obj's underlying member method code with example usage: obj.build_agent_spaces() and returns: action_space,  observation_space