code: def run(width, height, level_script, frame_count):
      """Spins up an environment and runs the random agent."""
      config = {"width": str(width), "height": str(height)}
      env = deepmind_lab.Lab(
          level_script, ["RGB_INTERLEAVED"], config=config
      )
      env.reset()
  
      reward = 0
      agent = RandomAgent(env.action_spec())
      for _ in six.moves.range(frame_count):
          if not env.is_running():
              print("Environment stopped early")
              env.reset()
              agent.reset()
          action = agent.step()
          reward += env.step(action, num_steps=1)
  
      print(
          "Finished after %i steps. Total reward received is %f"
          % (frame_count, reward)
      )
  
file_path: lab/python/random_agent_simple.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import argparse
  import random
  import numpy
  import six
  import deepmind_lab
label_desc: Use image node_id 1 for calling a global function with example usage: run(width, height, level_script, frame_count) without return types