This is a practical guide for developers wanting to develop new environments, or integrate existing third-party environments, within cogment verse.
At the moment, all environment implementations are provided by a single service with multiple endpoints. This is likely to change in the future and the documentation below will need to be updated to reflect any changes in the architecture.
If your environment has any additional dependencies, you will need to update the Dockerfile
(for system dependencies) and pyproject.toml
(for python dependencies) files to reflect this.
Additional details can be found here.
The environment service expects a gym-like API provided by the BaseEnv class. Existing third-party environments can be integrated using a small amount of glue code, see for example
- Gym -> GymEnv
- Minatar -> MinAtarEnv
- PettingZoo -> PettingZooEnv
- Procgen -> ProcGenEnv
Edit the EnvironmentAdapter in the following locations
- Add your environment constructor to the list of
ENVIRONMENT_CONSTRUCTORS
- Add the names of the provided environments to
self._environments
in theEnvironmentAdapter
constructor - Add the names of the environment endpoints to
COGMENT_VERSE_ENVIRONMENT_ENDPOINTS
in (/.env).
The MockEnvironmentSession class allows you to create and interact with your environment using the same API that is exposed to other services. For examples of how to test environments, see test_atari and test_procgen. The tests can be run via the command
cogment run test_environment
Edit run_params
to create a run configuration using one of the
new environment endpoints that you have registered. The environment endpoint is
determined by the environment_implementation
field of the run configuration.
Todo!