code: def run_episode(env, agents):
      obs_n = env.reset()
      total_reward = 0
      agents_reward = [0 for _ in range(env.n)]
      steps = 0
      while True:
          steps += 1
          action_n = [
              agent.predict(obs) for agent, obs in zip(agents, obs_n)
          ]
          next_obs_n, reward_n, done_n, _ = env.step(action_n)
          done = all(done_n)
          terminal = steps >= args.max_step_per_episode
  
          # store experience
          for i, agent in enumerate(agents):
              agent.add_experience(
                  obs_n[i],
                  action_n[i],
                  reward_n[i],
                  next_obs_n[i],
                  done_n[i],
              )
  
          # compute reward of every agent
          obs_n = next_obs_n
          for i, reward in enumerate(reward_n):
              total_reward += reward
              agents_reward[i] += reward
  
          # check the end of an episode
          if done or terminal:
              break
  
          # show animation
          if args.show:
              time.sleep(0.1)
              env.render()
  
          # show model effect without training
          if args.restore and args.show:
              continue
  
          # learn policy
          for i, agent in enumerate(agents):
              critic_loss = agent.learn(agents)
              summary.add_scalar(
                  "critic_loss_%d" % i,
                  critic_loss,
                  agent.global_train_step,
              )
  
      return total_reward, agents_reward, steps
  
file_path: PARL/benchmark/fluid/MADDPG/train.py
imports: from parl.utils import check_version_for_fluid
  import os
  import time
  import argparse
  import numpy
  from simple_model import MAModel
  from simple_agent import MAAgent
  import parl
  from parl.env.multiagent_simple_env import MAenv
  from parl.utils import logger, summary
label_desc: Use image node_id 1 for calling a global function with example usage: run_episode(env, agents) and returns: total_reward,  agents_reward,  steps