class_docstr: Util to build SampleBatches for each policy in a multi-agent env.
  
  Input data is per-agent, while output data is per-policy. There is an M:N
  mapping between agents and policies. We retain one local batch builder
  per agent. When an agent is done, then its local batch is appended into the
  corresponding policy batch for the agent's policy.
code: def add_init_obs(
      self,
      *,
      episode: Episode,
      agent_id: AgentID,
      env_id: EnvID,
      policy_id: PolicyID,
      init_obs: TensorType,
      init_infos: Optional[Dict[str, TensorType]] = None,
      t: int = -1,
  ) -> None:
      # Make sure our mappings are up to date.
      agent_key = (episode.episode_id, agent_id)
      self.agent_key_to_policy_id[agent_key] = policy_id
      policy = self.policy_map[policy_id]
  
      # Add initial obs to Trajectory.
      assert agent_key not in self.agent_collectors
      # TODO: determine exact shift-before based on the view-req shifts.
  
      # get max_seq_len value (Default is 1)
      try:
          max_seq_len = policy.config["model"]["max_seq_len"]
      except KeyError:
          max_seq_len = 1
  
      self.agent_collectors[agent_key] = AgentCollector(
          policy.view_requirements,
          max_seq_len=max_seq_len,
          disable_action_flattening=policy.config.get(
              "_disable_action_flattening", False
          ),
          intial_states=policy.get_initial_state(),
          is_policy_recurrent=policy.is_recurrent(),
      )
      self.agent_collectors[agent_key].add_init_obs(
          episode_id=episode.episode_id,
          agent_index=episode._agent_index(agent_id),
          env_id=env_id,
          init_obs=init_obs,
          init_infos=init_infos or {},
          t=t,
      )
  
      self.episodes[episode.episode_id] = episode
      if episode.batch_builder is None:
          episode.batch_builder = (
              self.policy_collector_groups.pop()
              if self.policy_collector_groups
              else _PolicyCollectorGroup(self.policy_map)
          )
  
      self._add_to_next_inference_call(agent_key)
  
imports: import collections
  from gymnasium.spaces import Space
  import logging
  import numpy
  import tree
  from typing import Dict, List, Optional, Tuple, TYPE_CHECKING, Union
  from ray.rllib.env.base_env import _DUMMY_AGENT_ID
  from ray.rllib.evaluation.collectors.sample_collector import SampleCollector
  from ray.rllib.evaluation.collectors.agent_collector import AgentCollector
  from ray.rllib.evaluation.episode import Episode
  from ray.rllib.policy.policy import Policy
  from ray.rllib.policy.policy_map import PolicyMap
  from ray.rllib.policy.sample_batch import SampleBatch, MultiAgentBatch, concat_samples
  from ray.rllib.utils.annotations import override, PublicAPI
  from ray.rllib.utils.debug import summarize
  from ray.rllib.utils.framework import try_import_tf, try_import_torch
  from ray.rllib.utils.spaces.space_utils import get_dummy_batch_for_space
  from ray.rllib.utils.typing import AgentID, EpisodeID, EnvID, PolicyID, TensorType, ViewRequirementsDict
  from ray.util.debug import log_once
label_desc: Use image node_id 3 for calling the SimpleListCollector obj's underlying member method code with example usage: obj.add_init_obs() without return types