class_docstr: This is the multi-agent version of ExternalEnv.
class_docstr_tok: ["This","is","the","multi-agent","version","of","ExternalEnv","."]
docstr: Record returns from the environment.
  
  The reward will be attributed to the previous action taken by the
  episode. Rewards accumulate until the next action. If no reward is
  logged before the next action, a reward of 0.0 is assumed.
  
  Args:
      episode_id: Episode id returned from start_episode().
      reward_dict: Reward from the environment agents.
      info_dict: Optional info dict.
      multiagent_done_dict: Optional done dict for agents.
docstr_tok: ["Record","returns","from","the","environment",".","The","reward","will","be","attributed","to","the","previous","action","taken","by","the","episode",".","Rewards","accumulate","until","the","next","action",".","If","no","reward","is","logged","before","the","next","action",",","a","reward","of","0.0","is","assumed",".","Args",":","episode_id",":","Episode","id","returned","from","start_episode","(",")",".","reward_dict",":","Reward","from","the","environment","agents",".","info_dict",":","Optional","info","dict",".","multiagent_done_dict",":","Optional","done","dict","for","agents","."]
code: def log_returns(
      self,
      episode_id: str,
      reward_dict: MultiAgentDict,
      info_dict: MultiAgentDict = None,
      multiagent_done_dict: MultiAgentDict = None,
  ) -> None:
      """Record returns from the environment.
  
      The reward will be attributed to the previous action taken by the
      episode. Rewards accumulate until the next action. If no reward is
      logged before the next action, a reward of 0.0 is assumed.
  
      Args:
          episode_id: Episode id returned from start_episode().
          reward_dict: Reward from the environment agents.
          info_dict: Optional info dict.
          multiagent_done_dict: Optional done dict for agents.
      """
  
      episode = self._get(episode_id)
  
      # Accumulate reward by agent.
      # For existing agents, we want to add the reward up.
      for agent, rew in reward_dict.items():
          if agent in episode.cur_reward_dict:
              episode.cur_reward_dict[agent] += rew
          else:
              episode.cur_reward_dict[agent] = rew
  
      if multiagent_done_dict:
          for agent, done in multiagent_done_dict.items():
              episode.cur_done_dict[agent] = done
  
      if info_dict:
          episode.cur_info_dict = info_dict or {}
  
file_path: ray/rllib/env/external_multi_agent_env.py
imports: import uuid
  import gymnasium
  from typing import Optional
  from ray.rllib.utils.annotations import override, PublicAPI
  from ray.rllib.env.external_env import ExternalEnv, _ExternalEnvEpisode
  from ray.rllib.utils.typing import MultiAgentDict
label_desc: Use image node_id 6 for calling the ExternalMultiAgentEnv obj's underlying member method code with example usage: obj.log_returns(episode_id, reward_dict, info_dict, multiagent_done_dict) without return types