Open source interface to reinforcement learning tasks.

The gym open-source project provides a simple interface to a growing collection of reinforcement learning tasks. You can use it from Python, and soon from other languages.

import gym
env = gym.make("Taxi-v1")
observation = env.reset()
for _ in range(1000):
  env.render()
  action = env.action_space.sample() # your agent here (this takes random actions)
  observation, reward, done, info = env.step(action)

We provide the environment; you provide the algorithm.

You can write your agent using your existing numerical computation library, such as TensorFlow or Theano.

Share and reproduce results.

OpenAI Gym lets you upload your results or review and reproduce others' work. Each task is versioned to ensure results remain comparable in the future.

import gym
env = gym.make("FrozenLake-v0")
env.monitor.start("/tmp/gym-results")
observation = env.reset()
for _ in range(1000):
  env.render()
  action = env.action_space.sample() # your agent here (this takes random actions)
  observation, reward, done, info = env.step(action)
env.monitor.close()
gym.upload("/tmp/gym-results", algorithm_id="random", api_key="YOUR_API_KEY")

Curate novel approaches.

Work with us to curate the best results so that state-of-the-art on each task is always known.

Start training your agents

Read the docs, download the toolkit and start training your agents.

View documentation