Skip to content

Gym skill

The AEA gym skill demonstrates how a custom Reinforcement Learning agent, that uses OpenAI's gym library, may be embedded into an Autonomous Economic Agent.

Demo instructions

Follow the Preliminaries and Installation instructions here.

Install the gym library.

pip install gym

Then, download the examples and packages directory.

svn export https://github.com/fetchai/agents-aea.git/trunk/examples
svn export https://github.com/fetchai/agents-aea.git/trunk/packages

Create the agent

In the root directory, create the gym agent.

aea create my_gym_agent

Add the gym skill

cd my_gym_agent
aea add skill gym 

Copy the gym environment to the agent directory

mkdir gyms
cp -a ../examples/gym_ex/gyms/. gyms/

Add a gym connection

aea add connection gym

Update the connection config

nano connections/gym/connection.yaml
env: gyms.env.BanditNArmedRandom

Run the agent with the gym connection

aea run --connection gym

You will see the gym training logs.

AEA gym training logs

Delete the agent

When you're done, you can go up a level and delete the agent.

aea delete my_gym_agent