code: def record_custom_act_function(directory):
      # Trivial custom act function
      def fn_act(states):
          return int(states[2] < 0.0)
  
      # Record 20 episodes
      runner = Runner(
          agent=dict(agent=fn_act, recorder=dict(directory=directory)),
          environment="benchmarks/configs/cartpole.json",
      )
      # or: agent = Agent.create(agent=fn_act, recorder=dict(directory=directory))
      runner.run(num_episodes=20)
      runner.close()
  
imports: import os
  import numpy
  from tensorforce import Agent, Environment, Runner
label_desc: Use image node_id 3 for calling a global function with example usage: record_custom_act_function(directory) and returns: int