code: def test_readme(self):
      self.start_tests(name="readme")
  
      # ====================
  
      from tensorforce import Agent, Environment
  
      # Pre-defined or custom environment
      environment = Environment.create(
          environment="gym", level="CartPole", max_episode_timesteps=500
      )
  
      # Instantiate a Tensorforce agent
      agent = Agent.create(
          agent="tensorforce",
          environment=environment,  # alternatively: states, actions, (max_episode_timesteps)
          memory=1000,
          update=dict(unit="timesteps", batch_size=64),
          optimizer=dict(type="adam", learning_rate=3e-4),
          policy=dict(network="auto"),
          objective="policy_gradient",
          reward_estimation=dict(horizon=20),
      )
  
      # Train for 300 episodes
      for _ in range(1):
          # Initialize episode
          states = environment.reset()
          terminal = False
  
          while not terminal:
              # Episode timestep
              actions = agent.act(states=states)
              states, terminal, reward = environment.execute(
                  actions=actions
              )
              agent.observe(terminal=terminal, reward=reward)
  
      agent.close()
      environment.close()
  
      # ====================
  
      self.finished_test()
  
file_path: tensorforce/test/test_documentation.py
imports: import unittest
  from tensorforce import Agent, Environment, Runner
  from test.unittest_base import UnittestBase
label_desc: Use image node_id 4 for calling the TestDocumentation obj's underlying member method code with example usage: obj.test_readme() without return types