PufferLib RL Guide
Version-aware guidance for PufferLib RL work — environment adaptation, vectorization, PuffeRL training, and safe checkpoint review across the 3.0.0 release and 4.0 source line.
Dev & CodingAdvanced★ 33,030⑂ 3,248AI score 8/10Last updated: Aug 9, 2026
What it does
- Forces an explicit version profile so you never mix the PyPI-stable
pufferlib==3.0.0API (emulation,pufferlib.vector, Torch PuffeRL) with the redesigned4.0source line (native C Ocean envs, CUDA trainer, INI configs). - Walks through Gymnasium/PettingZoo adaptation via
GymnasiumPufferEnv/PettingZooPufferEnv, plus contract validation of spaces, dtypes, seeding, and theterminatedvstruncateddistinction. - Ships dependency-free CLIs for contract checks, capped vectorization benchmarks, non-executing training-plan generation, plan validation, reproducibility plans, and checkpoint hash inspection.
- Encodes security defaults: pinned commits and archive digests, no credentials in args/configs/logs, resource caps, separate train/eval seeds, and hash-before-load for checkpoints (no
torch.loadin the inspector).
Who it's for
- RL researchers and engineers running PufferLib, or evaluating a 3.0 → 4.0 migration.
- Anyone wiring custom Gym/PettingZoo environments into a high-throughput vectorized pipeline.
- Teams that must vet third-party environments, native builds, or downloaded checkpoints before use.
Example uses
- "Does my Gymnasium env satisfy the contract?" →
python3 scripts/env_contract_validator.py --steps 64 --episodes 8 --seed 42. - "Draft a 10k-step CPU training run" →
scripts/train_template.py --profile pypi-3.0.0 --device cpu --total-timesteps 10000, thenvalidate_plan.pyto reject unbounded resources or coupled seeds. - "Is this downloaded checkpoint.pt safe?" →
scripts/inspect_checkpoint.py checkpoint.pt --expected-sha256 ...to hash and classify without deserializing.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/K-Dense-AI/scientific-agent-skills/HEAD/skills/pufferlib/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on Claude Skill Mart. Copy the skills/pufferlib folder from the GitHub repo K-Dense-AI/scientific-agent-skills into my ~/.claude/skills/pufferlib/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/K-Dense-AI/scientific-agent-skills.git && mkdir -p ~/.claude/skills && cp -r scientific-agent-skills/skills/pufferlib ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal in the folder where you keep tooling checkouts.
- Clone the repo:
git clone https://github.com/K-Dense-AI/scientific-agent-skills.git - Create the skills folder:
mkdir -p ~/.claude/skills - Copy just this skill:
cp -r scientific-agent-skills/skills/pufferlib ~/.claude/skills/ - Confirm Python 3.10+ is available:
python3 --version - Restart Claude Code and ask something like "validate my PufferLib environment contract" to trigger the skill.
- The bundled scripts use only the standard library, so you can smoke-test immediately:
python3 ~/.claude/skills/pufferlib/scripts/env_template.py --help
View source on GitHub ↗License: MIT