class_docstr: A simple HRL graph manager creates a deep hierarchy with a single composite agent per hierarchy level, and a single
  environment which is interacted with.
class_docstr_tok: ["A","simple","HRL","graph","manager","creates","a","deep","hierarchy","with","a","single","composite","agent","per","hierarchy","level",",","and","a","single","environment","which","is","interacted","with","."]
code: def _create_graph(
      self, task_parameters: TaskParameters
  ) -> Tuple[List[LevelManager], List[Environment]]:
      self.env_params.seed = task_parameters.seed
      env = short_dynamic_import(self.env_params.path)(
          **self.env_params.__dict__,
          visualization_parameters=self.visualization_parameters,
      )
  
      for agent_params in self.agents_params:
          agent_params.task_parameters = task_parameters
  
      # we need to build the hierarchy in reverse order (from the bottom up) in order for the spaces of each level
      # to be known
      level_managers = []
      current_env = env
      # out_action_space = env.action_space
      for level_idx, agent_params in reversed(
          list(enumerate(self.agents_params))
      ):
          # TODO: the code below is specific for HRL on observation scale
          # in action space
          # if level_idx == 0:
          #     # top level agents do not get directives
          #     in_action_space = None
          # else:
          #     pass
  
          # attention_size = (env.state_space['observation'].shape - 1)//4
          # in_action_space = AttentionActionSpace(shape=2, low=0, high=env.state_space['observation'].shape - 1,
          #                             forced_attention_size=attention_size)
          # agent_params.output_filter.action_filters['masking'].set_masking(0, attention_size)
  
          agent_params.name = "agent_{}".format(level_idx)
          agent_params.is_a_highest_level_agent = level_idx == 0
          agent = short_dynamic_import(agent_params.path)(agent_params)
  
          level_manager = LevelManager(
              agents=agent,
              environment=current_env,
              real_environment=env,
              steps_limit=self.consecutive_steps_to_run_each_level[
                  level_idx
              ],
              should_reset_agent_state_after_time_limit_passes=level_idx
              > 0,
              name="level_{}".format(level_idx),
          )
          current_env = level_manager
          level_managers.insert(0, level_manager)
  
          # out_action_space = in_action_space
  
      return level_managers, [env]
  
file_path: coach/rl_coach/graph_managers/hrl_graph_manager.py
imports: from typing import List, Union, Tuple
  from rl_coach.base_parameters import AgentParameters, VisualizationParameters, TaskParameters, PresetValidationParameters
  from rl_coach.core_types import EnvironmentSteps
  from rl_coach.environments.environment import EnvironmentParameters, Environment
  from rl_coach.graph_managers.graph_manager import GraphManager, ScheduleParameters
  from rl_coach.level_manager import LevelManager
  from rl_coach.utils import short_dynamic_import
label_desc: Use image node_id 2 for calling the HRLGraphManager obj's underlying member method code with example usage: obj._create_graph(task_parameters) and returns: level_managers,  list