Introducing DEgym: A framework for developing Reinforcement Learning Environments for Dynamical Systems

Introducing DEgym: A framework for developing Reinforcement Learning Environments for Dynamical Systems

Published

Categories

Reinforcement learning (RL) is increasingly being applied to complex processes across science and engineering, with promising results in manufacturing, biology, and energy systems. By learning through trial and error, RL agents can optimise behaviour without explicit supervision1

Many of these processes are governed by differential-algebraic equations (DAEs). These combine time-dependent dynamics with algebraic constraints, making them well suited for modelling complex engineered or natural systems.

Building reinforcement learning environments for such systems is often challenging and time-consuming. InstaDeep’s DEgym simplifies this process by letting developers provide the domain-specific elements, including system dynamics, equations, actions and constraints, while the framework supplies the RL-ready scaffolding.

What is DEgym?

DEgym is a streamlined, modular framework designed for developers, compatible with AI agents. It enables users without deep RL expertise to focus on domain logic rather than RL-specific details, guiding them from a use-case description to a fully functional RL environment.

DEgym achieves this by separating environment logic into two parts:

  • RL-related components, such as data flow, interfaces, and step functions, which are implemented once and shared across use cases.

  • Use-case-specific components, such as system dynamics, actions, states, and constraints, which the user defines.

This clear division makes it easier for both developers and AI agents to create new environments systematically, while ensuring consistency and reusability across applications.

Figure 1 Visualisation of how a user might utilise DEgym’s framework.. The diagram does not include the data class that passes between components, nor does it indicate where information is stored.
Figure 1: Visualisation of how a user might utilise DEgym’s framework.. The diagram does not include the data class that passes between components, nor does it indicate where information is stored.

Getting Started

After cloning the repository and syncing dependencies, users can define their system’s dynamics, subclass the base environment, and run it with their RL agent through DEgym’s interface. Tutorials and documentation are available to support more advanced setups and customisation.

DEgym’s architecture and API design also make it straightforward to use AI assistants to extract descriptions of dynamical systems, such as equations in a paper or preprint, and automatically build them into a DEgym environment.

Importantly, the framework is designed to be community driven. As an open-source project, we encourage researchers and developers to contribute by creating new environments, improving existing features, or adapting it to different domains.

👉 Explore DEgym on GitHub 🚀

📕 Read the documentation here.

1  Farooq, A. and Iqbal, K., 2025. A survey of reinforcement learning for optimization in automation. Available at: https://bit.ly/45UkmTA  [Accessed 21 Aug. 2025].