code: def main():
      # Train agent
      environment = Environment.create(
          environment="benchmarks/configs/cartpole.json"
      )
      runner = Runner(
          agent="benchmarks/configs/ppo.json", environment=environment
      )
      runner.run(num_episodes=100)
  
      # Save agent SavedModel
      runner.agent.save(directory="saved-model", format="saved-model")
      runner.close()
  
      # Model serving, potentially using different programming language etc
      # (For regular model saving and loading within Python, see save_load_agent.py example)
  
      # Load agent SavedModel
      agent = tf.saved_model.load(export_dir="saved-model")
  
      # Evaluate for 100 episodes
      sum_rewards = 0.0
      for _ in range(100):
          states = environment.reset()
  
          # Required in case of internal states:
          # internals = agent.initial_internals()
          # internals = recursive_map(batch, internals)
  
          terminal = False
          while not terminal:
              states = batch(states)
              # Required in case of nested states:
              # states = recursive_map(batch, states)
  
              auxiliaries = dict(mask=np.ones(shape=(1, 2), dtype=bool))
              deterministic = True
  
              actions = agent.act(states, auxiliaries, deterministic)
              # Required in case of internal states:
              # actions_internals = agent.act(states, internals, auxiliaries, deterministic)
              # actions, internals = actions_internals['actions'], actions_internals['internals']
  
              actions = unbatch(actions)
              # Required in case of nested actions:
              # actions = recursive_map(unbatch, actions)
  
              states, terminal, reward = environment.execute(
                  actions=actions
              )
              sum_rewards += reward
  
      print("Mean evaluation return:", sum_rewards / 100.0)
      environment.close()
  
imports: import numpy
  import tensorflow
  from tensorforce import Environment, Runner
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types