Reinforcement learning environments for .NET

Gym.NET

Farama Gymnasium's API and behavior in C#. Given the same seed and actions, every environment returns the same observations, rewards, flags and infos as Gymnasium's, bit for bit, and renders the same frames, pixel for pixel (MuJoCo's within one level). A test suite that runs Gymnasium itself inside the test process checks it, call by call.

dotnet add package Gym.NET.Environments
using Gym;
using Gym.Envs;
using NumSharp;
// make builds the registered env inside Gymnasium's wrappers, as gymnasium.make does
using Env<NDArray, NDArray> env = Gymnasium.Make<NDArray, NDArray>("LunarLander-v3");
NDArray observation = env.Reset(seed: 42).Observation;
using NDArray action = env.ActionSpace.Sample();
var (next, reward, terminated, truncated, info) = env.Step(action);

Start hereGetting started

Making envs, the reset/step loop, seeding, spaces, render modes, wrappers, vector envs.

BuildCustom environments

Writing an Env<TObs, TAct>, registering it for Gymnasium.Make, checking it.

UpgradeMigrating from 0.2

What changed in each 0.2 call, and Gym.Legacy for code that cannot move yet.

DesignArchitecture

The packages, the env contract, array ownership, and how parity with Gymnasium is proven.

Release1.0.0 notes

What 1.0 contains and leaves out, and every known difference from Gymnasium.

ContributeDevelopment and testing

Building, the unit suite, and the live parity suite against Gymnasium.