class_docstr: Runner class to run Tandem RL experiments.
class_docstr_tok: ["Runner","class","to","run","Tandem","RL","experiments","."]
docstr: Executes a full trajectory of the agent interacting with the environment.
  
  Args:
    agent_type: str, the type of agent to run.
  
  Returns:
    The number of steps taken and the total reward.
docstr_tok: ["Executes","a","full","trajectory","of","the","agent","interacting","with","the","environment",".","Args",":","agent_type",":","str",",","the","type","of","agent","to","run",".","Returns",":","The","number","of","steps","taken","and","the","total","reward","."]
code: def _run_one_episode(self, agent_type="active"):
      """Executes a full trajectory of the agent interacting with the environment.
  
      Args:
        agent_type: str, the type of agent to run.
  
      Returns:
        The number of steps taken and the total reward.
      """
      step_number = 0
      total_reward = 0.0
  
      action = self._initialize_episode(agent_type)
      is_terminal = False
  
      # Keep interacting until we reach a terminal state.
      while True:
          observation, reward, is_terminal = self._run_one_step(action)
  
          total_reward += reward
          step_number += 1
  
          # Perform reward clipping.
          reward = np.clip(reward, -1, 1)
  
          if (
              self._environment.game_over
              or step_number == self._max_steps_per_episode
          ):
              # Stop the run loop once we reach the true end of episode.
              break
          elif is_terminal:
              # If we lose a life but the episode is not over, signal an artificial
              # end of episode to the agent.
              if agent_type == "active":
                  self._agent.end_episode(reward)
              action = self._agent.begin_episode(
                  agent_type, observation
              )
          else:
              action = self._agent.step(agent_type, reward, observation)
  
      self._end_episode(reward)
  
      return step_number, total_reward
  
imports: import sys
  from absl import logging
  from dopamine.discrete_domains import atari_lib
  from dopamine.discrete_domains import gym_lib
  from dopamine.discrete_domains import iteration_statistics
  from dopamine.discrete_domains import run_experiment
  from dopamine.labs.environments.minatar import minatar_env
  from dopamine.labs.tandem_dqn import tandem_dqn_agent
  import gin
  import numpy
  import tensorflow
label_desc: Use image node_id 3 for calling the TandemRunner obj's underlying member method code with example usage: obj._run_one_episode(agent_type) and returns: step_number,  total_reward