Custom Open AI gym agent

Syntax and standards to code

  1. mkdir custom_agent & mkdir custom_agent/env
  2. echo from custom_agent.envs.custom_env import CustomEnv > custom_agent/__init__.py

3. Now cd custom_agent/env/

4. touch custom_env.py

custom_env.py must be of below structure

Place the files in gym package

  1. Open python gym module in the site-packages directory. For me, it is located here /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gym/envs
  2. Format __init__.py is

4. Place out dircustom_agent here

5. We need to register Custom environments here by editing __init__.py . Add the below lines to the file.

5. In custom_agent the folder add the file custom_env.py

Consultant