class_docstr: Wraps a MultiAgentEnv environment with agents grouped as specified.
  
  See multi_agent_env.py for the specification of groups.
  
  This API is experimental.
class_docstr_tok: ["Wraps","a","MultiAgentEnv","environment","with","agents","grouped","as","specified",".","See","multi_agent_env.py","for","the","specification","of","groups",".","This","API","is","experimental","."]
code: def step(self, action_dict):
      # Ungroup and send actions.
      action_dict = self._ungroup_items(action_dict)
      obs, rewards, terminateds, truncateds, infos = self.env.step(
          action_dict
      )
  
      # Apply grouping transforms to the env outputs
      obs = self._group_items(obs)
      rewards = self._group_items(
          rewards, agg_fn=lambda gvals: list(gvals.values())
      )
      # Only if all of the agents are terminated, the group is terminated as well.
      terminateds = self._group_items(
          terminateds, agg_fn=lambda gvals: all(gvals.values())
      )
      # If all of the agents are truncated, the group is truncated as well.
      truncateds = self._group_items(
          truncateds,
          agg_fn=lambda gvals: all(gvals.values()),
      )
      infos = self._group_items(
          infos, agg_fn=lambda gvals: {GROUP_INFO: list(gvals.values())}
      )
  
      # Aggregate rewards, but preserve the original values in infos.
      for agent_id, rew in rewards.items():
          if isinstance(rew, list):
              rewards[agent_id] = sum(rew)
              if agent_id not in infos:
                  infos[agent_id] = {}
              infos[agent_id][GROUP_REWARDS] = rew
  
      return obs, rewards, terminateds, truncateds, infos
  
file_path: ray/rllib/env/wrappers/group_agents_wrapper.py
imports: from collections import OrderedDict
  import gymnasium
  from typing import Dict, List, Optional
  from ray.rllib.env.multi_agent_env import MultiAgentEnv
  from ray.rllib.utils.annotations import DeveloperAPI
  from ray.rllib.utils.typing import AgentID
label_desc: Use image node_id 3 for calling the GroupAgentsWrapper obj's underlying member method code with example usage: obj.step(action_dict) and returns: obs,  rewards,  terminateds,  truncateds,  infos