class_docstr: Internal adapter of MultiAgentEnv to BaseEnv.
  
  This also supports vectorization if num_envs > 1.
class_docstr_tok: ["Internal","adapter","of","MultiAgentEnv","to","BaseEnv",".","This","also","supports","vectorization","if","num_envs",">","1","."]
docstr: Wraps MultiAgentEnv(s) into the BaseEnv API.
  
  Args:
      make_env: Factory that produces a new MultiAgentEnv instance taking the
          vector index as only call argument.
          Must be defined, if the number of existing envs is less than num_envs.
      existing_envs: List of already existing multi-agent envs.
      num_envs: Desired num multiagent envs to have at the end in
          total. This will include the given (already created)
          `existing_envs`.
      restart_failed_sub_environments: If True and any sub-environment (within
          this vectorized env) throws any error during env stepping, we will try
          to restart the faulty sub-environment. This is done
          without disturbing the other (still intact) sub-environments.
docstr_tok: ["Wraps","MultiAgentEnv","(","s",")","into","the","BaseEnv","API",".","Args",":","make_env",":","Factory","that","produces","a","new","MultiAgentEnv","instance","taking","the","vector","index","as","only","call","argument",".","Must","be","defined",",","if","the","number","of","existing","envs","is","less","than","num_envs",".","existing_envs",":","List","of","already","existing","multi-agent","envs",".","num_envs",":","Desired","num","multiagent","envs","to","have","at","the","end","in","total",".","This","will","include","the","given","(","already","created",")","`","existing_envs","`",".","restart_failed_sub_environments",":","If","True","and","any","sub-environment","(","within","this","vectorized","env",")","throws","any","error","during","env","stepping",",","we","will","try","to","restart","the","faulty","sub-environment",".","This","is","done","without","disturbing","the","other","(","still","intact",")","sub-environments","."]
code: def __init__(
      self,
      make_env: Callable[[int], EnvType],
      existing_envs: List["MultiAgentEnv"],
      num_envs: int,
      restart_failed_sub_environments: bool = False,
  ):
      """Wraps MultiAgentEnv(s) into the BaseEnv API.
  
      Args:
          make_env: Factory that produces a new MultiAgentEnv instance taking the
              vector index as only call argument.
              Must be defined, if the number of existing envs is less than num_envs.
          existing_envs: List of already existing multi-agent envs.
          num_envs: Desired num multiagent envs to have at the end in
              total. This will include the given (already created)
              `existing_envs`.
          restart_failed_sub_environments: If True and any sub-environment (within
              this vectorized env) throws any error during env stepping, we will try
              to restart the faulty sub-environment. This is done
              without disturbing the other (still intact) sub-environments.
      """
      self.make_env = make_env
      self.envs = existing_envs
      self.num_envs = num_envs
      self.restart_failed_sub_environments = (
          restart_failed_sub_environments
      )
  
      self.terminateds = set()
      self.truncateds = set()
      while len(self.envs) < self.num_envs:
          self.envs.append(self.make_env(len(self.envs)))
      for env in self.envs:
          assert isinstance(env, MultiAgentEnv)
      self._init_env_state(idx=None)
      self._unwrapped_env = self.envs[0].unwrapped
  
imports: import gymnasium
  import logging
  from typing import Callable, Dict, List, Tuple, Optional, Union, Set, Type
  from ray.rllib.env.base_env import BaseEnv
  from ray.rllib.env.env_context import EnvContext
  from ray.rllib.utils.annotations import ExperimentalAPI, override, PublicAPI, DeveloperAPI
  from ray.rllib.utils.typing import AgentID, EnvCreator, EnvID, EnvType, MultiAgentDict, MultiEnvDict
  from ray.util import log_once
label_desc: Use image node_id 1 to create a new MultiAgentEnvWrapper object from inherited base classes: BaseEnv with example: obj = MultiAgentEnvWrapper(make_env, existing_envs, num_envs, restart_failed_sub_environments)