class_docstr: This connector does 2 things:
  1. It filters data columns based on view_requirements for training and inference.
  2. It buffers the right amount of history for computing the sample batch for
     action computation.
  The output of this connector is AgentConnectorsOut, which basically is
  a tuple of 2 things:
  {
      "raw_dict": {"obs": ...}
      "sample_batch": SampleBatch
  }
  raw_dict, which contains raw data for the latest time slice,
  can be used to construct a complete episode by Sampler for training purpose.
  The "for_action" SampleBatch can be used to directly call the policy.
class_docstr_tok: ["This","connector","does","2","things",":","1",".","It","filters","data","columns","based","on","view_requirements","for","training","and","inference",".","2",".","It","buffers","the","right","amount","of","history","for","computing","the","sample","batch","for","action","computation",".","The","output","of","this","connector","is","AgentConnectorsOut",",","which","basically","is","a","tuple","of","2","things",":","{","``","raw_dict","''",":","{","``","obs","''",":","...","}","``","sample_batch","''",":","SampleBatch","}","raw_dict",",","which","contains","raw","data","for","the","latest","time","slice",",","can","be","used","to","construct","a","complete","episode","by","Sampler","for","training","purpose",".","The","``","for_action","''","SampleBatch","can","be","used","to","directly","call","the","policy","."]
code: def __init__(self, ctx: ConnectorContext):
      super().__init__(ctx)
  
      self._view_requirements = ctx.view_requirements
      _enable_new_api_stack = ctx.config.get(
          "_enable_new_api_stack", False
      )
  
      # a dict of env_id to a dict of agent_id to a list of agent_collector objects
      self.agent_collectors = defaultdict(
          lambda: defaultdict(
              lambda: AgentCollector(
                  self._view_requirements,
                  max_seq_len=ctx.config["model"]["max_seq_len"],
                  intial_states=ctx.initial_states,
                  disable_action_flattening=ctx.config.get(
                      "_disable_action_flattening", False
                  ),
                  is_policy_recurrent=ctx.is_policy_recurrent,
                  # Note(jungong): We only leverage AgentCollector for building sample
                  # batches for computing actions.
                  # So regardless of whether this ViewRequirement connector is in
                  # training or inference mode, we should tell these AgentCollectors
                  # to behave in inference mode, so they don't accumulate episode data
                  # that is not useful for inference.
                  is_training=False,
                  _enable_new_api_stack=_enable_new_api_stack,
              )
          )
      )
  
file_path: ray/python/ray/rllib/connectors/agent/view_requirement.py
imports: from collections import defaultdict
  from typing import Any
  from ray.rllib.connectors.connector import AgentConnector, ConnectorContext
  from ray.rllib.connectors.registry import register_connector
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.utils.typing import AgentConnectorDataType, AgentConnectorsOutput
  from ray.util.annotations import PublicAPI
  from ray.rllib.evaluation.collectors.agent_collector import AgentCollector
label_desc: Use image node_id 1 to create a new ViewRequirementAgentConnector object from inherited base classes: AgentConnector with example: obj = ViewRequirementAgentConnector(ctx)