🤖 RL workbench for training game agents 🎮
GradLab is a Python CLI and reproducible reinforcement-learning workbench for researchers who train, evaluate, compare, inspect, and publish game agents. It turns versioned goal contracts and recipes into traceable local or queued runs, with portable policies and evidence-backed results.
Try the bundled ROM-free smoke recipe without cloning, credentials, or a ROM:
uvx gradlab@0.1.2 train gradlab__bandit/ppo
The run writes a directly playable policy below ~/.config/gradlab/runs/.
Install
Install uv, then run:
git clone https://github.com/tsilva/gradlab.git
cd gradlab
./install.sh
gradlab validate
Run gradlab --help to open the command reference, or train and play the
bundled smoke recipe:
gradlab train gradlab__bandit/ppo
gradlab play --recipe gradlab__bandit/ppo
gradlab play starts the local web player and prints its loopback URL.
Gymnasium discrete environments
GradLab includes strict Turbo-vector goals for ten Gymnasium discrete-action environments:
gradlab train CartPole-v1/ppo
gradlab train MountainCar-v0/ppo
gradlab train Acrobot-v1/ppo
gradlab train LunarLander-v3/ppo
gradlab train FrozenLake-v1/ppo
gradlab train FrozenLake8x8-v1/ppo
gradlab train CliffWalking-v1/ppo
gradlab train CliffWalkingSlippery-v1/ppo
gradlab train Taxi-v3/ppo
gradlab train Blackjack-v1/ppo
Use gymnasium:<environment-id> for the qualified environment ID. These goals
use isolated spawned lanes, explicit masked resets, native rewards, and RGB
rendering through the same training, evaluation, publication, and playback
workflows as other GradLab providers. Native categorical observations remain
categorical; Blackjack uses the fixed MultiDiscrete([32, 11, 2]) encoding
(player sum, dealer card, usable ace).
Commands
gradlab train <goal>/<recipe> # train a checked-in recipe locally
gradlab play [artifact] # browse or inspect local and remote policies
gradlab validate # validate goals, recipes, benchmarks, and ops config
gradlab env list # list available environment providers
gradlab rom status --json # inspect registered ROM assets
gradlab benchmark list # list reproducible benchmark profiles
gradlab experiment status --run ID # inspect an orchestrated run
uv run pytest # run Python tests
uv run ruff check . # lint Python code
pnpm test:web # run web-player tests
Use gradlab <command> --help for full arguments. Gameplay datasets, leader
queries, W&B reports, and workspace management are also available through the
dataset, leaders, reports, and workspaces commands.
Research results
Start with Featured Research on Hugging Face or its YouTube playlist.
Environment indexes:
Evaluation evidence and representative replay are distinct: immutable model tags contain the accepted evaluation record, while videos show one separately labeled episode.
Queued runs
Queued training uses dstack for placement, a single supervisor-controlled training container, Modal for separately scheduled checkpoint evaluation, R2 for run authority and artifacts, and W&B for metrics.
Copy the portable operator template into private user configuration and run the read-only preflight before launching:
mkdir -p ~/.config/gradlab
install -m 600 ops/operator.example.toml ~/.config/gradlab/operator.toml
gradlab experiment operator-preflight --json
Then launch a checked-in goal and recipe with a finite duration and a specific description:
gradlab experiment launch \
--goal-file experiments/goals/SuperMarioBros-Nes-v0/Level1-1/_goal.yaml \
--recipe-file experiments/goals/SuperMarioBros-Nes-v0/Level1-1/recipes/ppo.yaml \
--seed 123 \
--run-description "Mario Level1-1 PPO seed 123" \
--compute local \
--max-duration 48h \
--json
Local compute requires an enrolled fleet in
~/.config/gradlab/instances.md. Paid cloud compute is always bounded and
explicitly authorized. See COMPUTE.md and the
dstack runbook before operating queued runs.
Notes
- GradLab requires Python 3.14 and uses
uvwith a committed lockfile and a seven-day dependency age gate. Supported binary targets are macOS arm64 and Linux x86_64. - Local
gradlab trainruns disable W&B and checkpoint evaluation by default. They are training-only and cannot establish goal acceptance or checkpoint promotion. gradlab.ppois the opt-in tensor-native PPO backend. It accepts thesb3.ppoconfiguration surface plusprecision(fp32,amp-fp16, oramp-bf16) and anexecution_profile.sb3-paritypreserves SB3's eager, unfused, environment-major minibatch path;compiled-parityandcompiled-fused-parityisolate the CUDA optimizations;max-throughputadditionally uses GPU-native permutation and is the default. The backend keeps PPO artifacts mutually resumable with SB3 and uses eager execution on CPU or MPS. Checked-in training recipes remain onsb3.ppountil the dedicated RTX 4090 throughput gate passes.- NES recipes require a lawfully obtained ROM supplied with
--rom-pathor registered withgradlab rom sync. ROMs and credentials must remain outside source control. - Generated runs default to
~/.config/gradlab/runs/; other generated logs and models belong in ignoredlogs/andmodels/directories. - dstack task success is not scientific success. A queued run succeeds only when its terminal receipt proves checkpoint publication, evaluation drain, promotion state, and metric delivery.
- SPECS.md defines product requirements, METRICS.md defines metric semantics, and experiments/README.md explains the checked-in research contracts.
Architecture
License
GradLab is licensed under the MIT License. Third-party attributions are listed in THIRD_PARTY_NOTICES.md.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gradlab-0.1.2.tar.gz.
File metadata
- Download URL: gradlab-0.1.2.tar.gz
- Upload date:
- Size: 1.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e02992be808a6f7cb3f0895a6c7a7ead8726d26d41f590a2fdd0aa353174436
|
|
| MD5 |
f9c4469bfb454fcbaab9764c7d68e72c
|
|
| BLAKE2b-256 |
5423d61eca63c2c540f16f582582092f8e925c06dc54ff735a19ccae76135fd0
|
Provenance
The following attestation bundles were made for gradlab-0.1.2.tar.gz:
Publisher:
release.yml on tsilva/gradlab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gradlab-0.1.2.tar.gz -
Subject digest:
2e02992be808a6f7cb3f0895a6c7a7ead8726d26d41f590a2fdd0aa353174436 - Sigstore transparency entry: 2469351776
- Sigstore integration time:
-
Permalink:
tsilva/gradlab@2314077546e60ff6663380658bd609865c00416f -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/tsilva
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2314077546e60ff6663380658bd609865c00416f -
Trigger Event:
push
-
Statement type:
File details
Details for the file gradlab-0.1.2-py3-none-any.whl.
File metadata
- Download URL: gradlab-0.1.2-py3-none-any.whl
- Upload date:
- Size: 2.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d26aad55133a30bbd53163ee189099fe7b6ddd790d6eb8f175b00f53def43a3b
|
|
| MD5 |
6147eaec9814dc5a1e068265abeb77b6
|
|
| BLAKE2b-256 |
2e3899b5c97ba82abd1d1436a0c6fe8fa3cd8e2837cb29e8b2a469fc26d5d6cc
|
Provenance
The following attestation bundles were made for gradlab-0.1.2-py3-none-any.whl:
Publisher:
release.yml on tsilva/gradlab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gradlab-0.1.2-py3-none-any.whl -
Subject digest:
d26aad55133a30bbd53163ee189099fe7b6ddd790d6eb8f175b00f53def43a3b - Sigstore transparency entry: 2469351802
- Sigstore integration time:
-
Permalink:
tsilva/gradlab@2314077546e60ff6663380658bd609865c00416f -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/tsilva
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2314077546e60ff6663380658bd609865c00416f -
Trigger Event:
push
-
Statement type: