class_docstr: Helper for running environements
  
  Parameters
  ----------
  env: gym.Env or MultiAgentEnv
      a possibly multi agent environment
  num_repetations: int
      number of repetitions to play the environment (smoothes the output)
  max_step: int
      maximum number of steps to play the environemnet before breaking
class_docstr_tok: ["Helper","for","running","environements","Parameters","--","--","--","--","--","env",":","gym.Env","or","MultiAgentEnv","a","possibly","multi","agent","environment","num_repetations",":","int","number","of","repetitions","to","play","the","environment","(","smoothes","the","output",")","max_step",":","int","maximum","number","of","steps","to","play","the","environemnet","before","breaking"]
docstr: Run one agent or multiple named agents
  
  Parameters
  ----------
  *agent: Agent (optional)
      the agent to play a single-agent environment
  **agents: Agent
      the named agents to play a multi-agent environment
  
  Returns
  -------
  float:
      the mean reward (possibly for each agent)
docstr_tok: ["Run","one","agent","or","multiple","named","agents","Parameters","--","--","--","--","--","*","agent",":","Agent","(","optional",")","the","agent","to","play","a","single-agent","environment","*","*","agents",":","Agent","the","named","agents","to","play","a","multi-agent","environment","Returns","--","--","--","-","float",":","the","mean","reward","(","possibly","for","each","agent",")"]
code: def run(
      self, *agent: Agent, **agents: Agent
  ) -> tp.Union[float, tp.Dict[str, float]]:
      """Run one agent or multiple named agents
  
      Parameters
      ----------
      *agent: Agent (optional)
          the agent to play a single-agent environment
      **agents: Agent
          the named agents to play a multi-agent environment
  
      Returns
      -------
      float:
          the mean reward (possibly for each agent)
      """
      san = "single_agent_name"
      sum_rewards: tp.Dict[str, float] = (
          {name: 0.0 for name in agents} if agents else {san: 0.0}
      )
      for _ in range(self.num_repetitions):
          rewards = self._run_once(*agent, **agents)
          for name, value in rewards.items():
              sum_rewards[name] += value
      mean_rewards = {
          name: float(value) / self.num_repetitions
          for name, value in sum_rewards.items()
      }
      if isinstance(self.env, gym.Env):
          return mean_rewards[san]
      return mean_rewards
  
imports: import typing
  from collections import defaultdict
  import gym
label_desc: Use image node_id 2 for calling the EnvironmentRunner obj's underlying member method code with example usage: obj.run() and returns: mean_rewards, mean_rewards