code: def agent():
    
    agent_module, agent_name = FLAGS.agent.rsplit(".", 1)
    agent_cls = getattr(importlib.import_module(agent_module), agent_name)
  
    logging.info("Starting agent:")
    with remote_sc2_env.RemoteSC2Env(
        map_name=FLAGS.map,
        host=FLAGS.host,
        host_port=FLAGS.host_port,
        lan_port=FLAGS.lan_port,
        name=FLAGS.agent_name or agent_name,
        race=sc2_env.Race[FLAGS.agent_race],
        step_mul=FLAGS.step_mul,
        agent_interface_format=sc2_env.parse_agent_interface_format(
            feature_screen=FLAGS.feature_screen_size,
            feature_minimap=FLAGS.feature_minimap_size,
            rgb_screen=FLAGS.rgb_screen_size,
            rgb_minimap=FLAGS.rgb_minimap_size,
            action_space=FLAGS.action_space,
            use_feature_units=FLAGS.use_feature_units),
        visualize=FLAGS.render) as env:
      agents = [agent_cls()]
      logging.info("Connected, starting run_loop.")
      try:
        run_loop.run_loop(agents, env)
      except remote_sc2_env.RestartException:
        pass
    logging.info("Done.")
docs: Run the agent, connecting to a (remote) host started independently.