google-deepmind/dm_env
A Python interface for reinforcement learning environments
What it solves
Reinforcement learning (RL) experiments need a common way to connect an agent to an environment — a game, simulation, or task. Without a shared interface, every environment defines its own rules for how actions are sent and observations returned, which makes it hard to reuse agents and algorithms across different environments. dm_env provides a standard Python interface so RL environments can be built, compared, and swapped out consistently.
How it works
The package defines an abstract base class, dm_env.Environment, that every RL environment should implement. On each step, the environment returns a TimeStep container that bundles the observation, reward, and discount for that transition. A specs module describes the expected format of the actions an environment consumes and the observations, rewards, and discounts it produces. Finally, test_utils provides tools to verify that a concrete environment implementation actually conforms to the Environment interface, so mistakes are caught early.
Who it's for
Researchers and developers building reinforcement learning environments in Python, or writing agents and algorithms that should work across many environments that follow this shared interface.
Highlights
- An abstract
Environmentbase class that standardizes how RL environments are defined - A
TimeStepcontainer for the outputs of each environment step (observation, reward, discount) - A
specsmodule for describing the format of actions, observations, rewards, and discounts test_utilstools for checking that a concrete environment correctly implements the interface- Installable from PyPI with
pip install dm-env, with an optional extra for the testing utilities
Related
- Project
- Project
- Project
- Project