WannaDo Series: AI-Native Clean-Style Deep Reinforcement Learning Platform — wannado-drl
Part of the WannaDo human–AI collaborative scientific research platform · Release
v1.1.1
"Wanna do a deep reinforcement learning?"
“Install the library and just say 'I wanna do a deep reinforcement learning for...' to your AI agent”
“Built-in verification gates catch future-leakage bugs, unfrozen SB3 normalization, fake convergence, and unsafe policies before shipping”
wannado-drl is an AI-focused Deep Reinforcement Learning platform built around four pillars:
- Stage 0 Problem-to-MDP Joint Modeling & Active Future-Leakage Probes (
Problem → MDP): Unlike generic RL libraries that jump straight intoPPO()orSAC(),wannado-drlstarts by diagnosing whether your problem actually needs RL, formalizes the control cycle,terminatedvstruncated,reward_terms,task_metrics, andcostbudgets insidedrl_lab/mdp_spec.json, and runs active pure-NumPy Future-Leakage & Conditioning Probes (run_mdp_probes) to blockt+1lookahead bugs before wasting GPU/CPU time. - Clean-style Single-File Algorithms Across 8 Authoritative Families (
30Algorithms): From pedagogical tabular classics (Monte Carlo,SARSA,Q-Learning), deep value methods (DQN,Double DQN,Dueling DQN,C51), policy gradients (REINFORCE,A2C,TRPO,PPO,PPO-GRU), continuous/HIL off-policy control (DDPG,TD3,SAC,HIL-SERL), Safe & Risk-Constrained RL (PPO-Lagrangian,SAC-Lagrangian (PID),CVaR-PPO), offline RL (CQL,IQL), and multi-agent CTDE (VDN,QMIX,MAPPO,MADDPG) to frontier sequence/discovered RL (GRPO,DAPO,GSPO,ARPO,DiscoRL). Runwannado-drl eject <algo_id>to copy only that single readable.pyfile into./drl_lab/algos/. - Non-Intrusive External
drl_lab/Plug-In, Vectorized & Multimodal Engine: Never scatter RL loops across your simulator or codebase. Wire your project through./drl_lab/interface.py(EnvInterface)—or pass"CartPole-v1"IDs directly—adapting Gymnasium, legacy OpenAIgym,dm_control, PettingZoo MARL, custom Python simulators, offline datasets, and verifiable sequence tasks. Built-in trueVectorEnvbatching (SyncVectorEnv/AsyncVectorEnv), multimodal encoders (NatureCNN,IMPALA ResNet,SetAttention, andDictCombinedExtractorwith nativeuint8storage +DictRunningMeanStd+RewardNormalizer), and atomicCheckpointManager+PolicyBundle/load_policy(). - External SB3/PyTorch Policy Auditing, rliable Bootstrap Statistics & Zero-Hallucination Gate (
wannado-drl verify): Directly ingest external Stable-Baselines3 (.predict()+VecNormalize), PyTorchnn.Module, or callable policies intoaudit_external_policy()andevaluate_drl_suite(..., external_policies=...). Enforces Stage 1 leakage/mask probes, Stage 3audit_drl_rigor()(catching single-seed luck, Reward Hacking KPI divergence, unfrozen evalVecNormalize/obs_rms, entropy collapse, action saturation, and safety constraint breaches), and Stage 4 rliable exports (IQMwith 95% Bootstrap CIs, pairwise $P(A > B)$, Performance Profiles,paper_summary.md,paper_table.tex, and verbatimreferences.bib).
Installation & Ecosystem Coexistence
pip install wannado-drl
# Coexists cleanly with wannado-adv under PEP 420 `wannado.*`:
pip install wannado-adv wannado-drl
Core dependencies remain strictly numpy>=1.24, torch>=2.0, and gymnasium>=1.0.
Optional Two-Stage Ecosystem Workflow (
wannado-drl+wannado-adv): Both packages remain 100% independent—you do not needwannado-advto usewannado-drl, and vice versa. If you install both together (e.g., train an RL policy in./drl_lab/first and then stress-test its perturbation robustness in./adv_eval/), their namespaces (wannado.drl/wannado.adv), agent skills (.agents/skills/wannado-drl/vs.agents/skills/wannado-adv/), and marked rule blocks (<!-- wannado-drl:start/end -->vs<!-- wannado-adv:start/end -->) remain isolated with explicit intent boundaries so their AI Co-Pilot prompts never overwrite or conflict with each other.
Development setup (editable install from source)
git clone https://github.com/JietaoZhao/wannado-drl.git
cd wannado-drl
pip install -e ".[dev]" --no-build-isolation
Universal AI IDE Co-Pilot (init-agent)
Built on the open AGENTS.md + .agents/skills/ standard (compatible across Cursor, Antigravity, VS Code Codex, Claude Code, Windsurf, Aider):
# 1. Bind portable 5-stage Co-Pilot rules into your project root
wannado-drl init-agent --dir .
# 2. Prompt your AI IDE agent in any language:
# "Help me formulate an MDP and train a DRL baseline for this project using wannado-drl..."
The 5-Stage Human–AI Workflow
| Stage | Purpose | Outputs / Guardrails |
|---|---|---|
| Stage 0 | wannado-drl inspect . & Problem → MDP Intake |
RL suitability check (diagnose_rl_suitability), anti-leakage & terminated/truncated checklist → drl_lab/mdp_spec.json |
| Stage 1 | Non-intrusive drl_lab/ Scaffold + Preflight & Baselines |
drl_lab/interface.py, measured ms/step, Random & Heuristic baseline floors before RL training |
| Stage 2 | Plain-Language Algo Match & Hardware ETA | Plain analogies (on-policy vs off-policy, gamma, ent_coef, num_seeds) + calibrated multi-seed ETA |
| Stage 3 | CleanRL Single-File Training + Anti-Fake-Convergence Audit | Multi-seed IQM, catches single-seed luck, Reward Hacking KPI drop, unfrozen eval RunningMeanStd, entropy collapse |
| Stage 4 | Plain Verdict & Paper Deliverables | Plain-language takeaway first + drl_report.json, paper_summary.md, paper_table.tex, learning_curves.csv, references.bib |
8-Family Algorithm Taxonomy & Verified Lineage (30 Algorithms)
Every algorithm carries embedded META, [AI-Prompt Hook] research extension points, and verified BibTeX/IEEE/APA provenance (wannado-drl cite <ids>):
| Family | Algorithms (id) & Evolution Lineage |
Paradigm & Key Role |
|---|---|---|
1. tabular_classic |
monte_carlo (Sutton & Barto 2018) → sarsa (Rummery & Niranjan 1994) → q_learning (Watkins & Dayan 1992) |
Pedagogical foundations & exact tabular baselines (auto-bins continuous obs if desired) |
2. value_based |
q_learning → dqn (Mnih et al., Nature 2015) → double_dqn (van Hasselt et al., AAAI 2016) → dueling_dqn (Wang et al., ICML 2016) / c51 (Bellemare et al., ICML 2017) |
Discrete deep Q-learning with replay, target decoupling, V+A dueling, & return distributions |
3. policy_gradient |
reinforce (Williams 1992) → a2c (Mnih et al., ICML 2016) / trpo (Schulman et al., ICML 2015) → ppo (Schulman et al. 2017) → ppo_gru |
On-policy actor-critic with GAE, action masking, & GRU memory for POMDPs |
4. actor_critic_off |
dqn → ddpg (Lillicrap et al., ICLR 2016) → td3 (Fujimoto et al., ICML 2018) → sac (Haarnoja et al., ICML 2018) → hil_serl (Luo et al., Science Robotics 2025) |
Sample-efficient continuous control + RLPD LayerNorm critics & 50/50 human-in-the-loop demo replay |
5. safe_constrained |
ppo → cvar_ppo (Chow et al., JMLR 2018) / ppo_lagrangian (Ray et al. 2019); sac → sac_lagrangian (Stooke et al., ICML 2020) |
Constrained CMDPs (E[cost] <= limit) with PID dual control & percentile tail-risk CVaR optimization |
6. offline_rl |
sac → cql (Kumar et al., NeurIPS 2020) → iql_offline (Kostrikov et al., ICLR 2022) |
Safe policy extraction from static logged datasets with zero online exploration |
7. multi_agent |
vdn (Sunehag et al., AAMAS 2018) → qmix (Rashid et al., ICML 2018); ppo → mappo (Yu et al., NeurIPS 2022); ddpg → maddpg (Lowe et al., NeurIPS 2017) |
CTDE cooperative/mixed multi-agent RL (PettingZoo & dict-stepped sims) |
8. llm_and_discovered |
ppo → grpo (Shao et al., DeepSeekMath 2024) → dapo (Yu et al., NeurIPS 2025) / gspo (Zheng et al. 2025) / arpo (Dong et al. 2025); a2c → discorl (Oh et al., Nature 2025) |
Critic-free group-relative sequence/tool-agent RL & meta-discovered latent-prediction update rules |
Quick Usage (CLI & Python)
# Stage 0: Scan repo, check integration mode & generate MDP Spec
wannado-drl inspect .
wannado-drl intake --archetype wireless_scheduling --out ./drl_lab/mdp_spec.json
# Scaffold non-intrusive external plug-in workspace & eject ONE file for custom paper edits
wannado-drl scaffold --dir ./drl_lab --archetype wireless_scheduling --mode custom_sim
wannado-drl eject ppo_lagrangian --dest ./drl_lab/algos
# Hard Verification Gate (Future-Leakage Probes + Multi-Seed/External Policy Audit + Report)
wannado-drl verify --interface ./drl_lab/interface.py --algos ppo double_dqn --seeds 0 1 2
wannado-drl cite ppo sac ppo_lagrangian sac_lagrangian cvar_ppo hil_serl --include-audit-refs
import gymnasium as gym
from wannado.drl import PPOConfig, evaluate_drl_suite
report = evaluate_drl_suite(
lambda: gym.make("CartPole-v1"),
algos=["double_dqn", "ppo"],
seeds=[0, 1, 2],
algo_configs={"ppo": PPOConfig(total_timesteps=16_000)},
task_name="CartPole-v1",
)
report.save("./drl_lab/outputs") # drl_report.json, paper_summary.md, paper_table.tex, learning_curves.csv, references.bib
Benchmarks & End-to-End Validation
End-to-end validation scripts live under benchmarks/ (decoupled from core pyproject.toml dependencies). All numbers below are measured across 3 random seeds ([0, 1, 2]) with deterministic frozen evaluation:
1. Gymnasium Classic Control (CartPole-v1 & Pendulum-v1)
- Discrete (
CartPole-v1, 20k steps): Random floor26.33 ± 18.98→pporeaches Eval IQM449.02(407.23 ± 124.74),a2c272.55,dueling_dqn181.15,double_dqn117.62(where Stage 3 Auditor transparently flaggedtrain_eval_collapse_mismatch). - Continuous (
Pendulum-v1, 12k steps): Random floor-1401.88 ± 258.79→ off-policysac(IQM-121.18,-121.52 ± 9.64) andtd3(IQM-124.02,-123.98 ± 10.62) solve the task cleanly while sample-hungry on-policypporemains at-1132.40(empirically validating Stage 2 sample-efficiency guidance).
2. Non-Gym Wireless Downlink Scheduler (Stage 0→4) & Fake-Convergence Audit
- Integrated a pure-Python 4-user wireless downlink simulator from scratch through Stage 0
MDPSpec+action_mask+ sub-reward/KPI instrumentation: Random (12.02 ± 6.67), myopicMax-CQIgreedy heuristic (2.97 ± 8.51due to queue starvation) →double_dqn(IQM=44.99,45.07 ± 4.02) andppo(IQM=46.50,46.55 ± 2.76) pass all8/8Stage 3 Rigor Audit checks. - Adversarial Audit Verification:
audit_drl_rigor()caught4/4planted fake-convergence traps (suspected_reward_hacking_kpi_divergence,obs_rms_unfrozen_on_eval,single_seed_survivorship_risk,policy_entropy_collapse).
3. Frontier Sequence Reasoning (GRPO / DAPO / GSPO / ARPO) & Cooperative MARL (VDN / QMIX / MAPPO)
- Verifiable Sequence Reasoning (3 seeds): Random baseline
0.075→grpo,dapo,gspo, andarpoall reach Eval IQM1.000(100%exact match). - Cooperative Multi-Agent Relay (3 seeds): Random floor
-1.56→vdn,qmix, andmappoall reach Eval IQM12.00(100%optimal team coordination).
4. VectorEnv Throughput Scaling & Fair Cross-Calibration vs Stable-Baselines3 (2.9.2)
Using identical CPU budgets, network architectures, and deterministic 20-episode evaluation (bench_vec_scaling.py, bench_vs_sb3.py):
- True VectorEnv Scaling (
num_envs = 1 -> 8): OnCartPole-v1 (MLP), throughput scales6,494.8→20,293.8 steps/s(3.12xspeedup vs SB322,532.2 steps/s). OnPixelNav 84x84x3 uint8 (NatureCNN)with nativeuint8buffer storage, throughput reaches271.0–299.4 steps/s(matching/slightly ahead of SB3CnnPolicyat242.8–297.6 steps/s). - Classic, Acrobot, Box2D Physics & Continuous Control (CPU):
CartPole-v1 (PPO, 4-env, 25k, 5 seeds):wannado-drlIQM488.08(451.23 ± 80.12,3.38s) vsSB3IQM482.52(424.21 ± 120.63,2.47s).Acrobot-v1 (PPO, 4-env, 40k, 5 seeds):wannado-drlIQM-99.50(-106.24 ± 25.95,4.87s) vsSB3IQM-155.26(-213.72 ± 170.79,4.65s).CartPole-v1 (Value-Based, 25k, 5 seeds):wannado-drl DoubleDQNIQM257.16vsSB3 DQNIQM143.06(wannado-drl DQN117.24).LunarLander-v3 (PPO, 4-env, 160k, 3 seeds):SB3IQM141.15(25.17s),wannado-drl PPO+RewNormIQM92.95(30.53s), matchedwannado-drl PPOIQM36.95(24.44s, and73.66IQM vsSB3108.81IQM across 6 matched seeds; reaches199.00 ± 85.36on seed 0 withnormalize_reward=Trueat150k).Pendulum-v1 (15k, 5 seeds):wannado-drl SACIQM-140.20(22.18s) vsSB3 SAC-120.73(25.76s);wannado-drl TD3IQM-137.65(13.11s) vsSB3 TD3-124.09(15.28s).
- Adaptive Spatial Grids & Multimodal Sets (Native Capabilities):
MinAtar-Breakout (10x10x4, 40k, 3 seeds): Random0.30→PPO-CNNIQM5.64(26.76s) andDoubleDQN-CNNIQM10.22out of the box (without requiring custom kernels for sub-36×36 spatial grids).FleetDispatch-Dict (16x16x2 CNN + Vec + Variable-Mask SetAttention + Action Mask, 3 seeds): Random (Masked)12.97→PPO-Dict+MaskIQM35.15(34.10 ± 3.07), passing all Stage 3 Rigor Audit checks.
5. Safe & Risk-Constrained RL, Active Future-Leakage Probes & Live SB3 Cross-Audit
Measured across 3 seeds ([0, 1, 2]) with bench_safe_and_audit.py:
- Constrained CMDP Satisfaction:
WirelessPowerCMDP (cost budget 2.0): unconstrainedPPOincurs12.00episode cost (6xover budget; return36.00) →PPO-Lagrangiansatisfies budget at0.00cost (return15.00).TorqueSafetyCMDP (continuous, cost budget 1.2): unconstrainedSACincurs11.36cost (9.5xover budget; return18.33) → PIDSAC-Lagrangiansatisfies budget at0.46IQM cost ([0.00, 1.24]) (return7.41).
- Heavy-Tail Crash Suppression (
HeavyTailPortfolio, 25%-CVaR): Risk-neutralPPOsuffers tail crashes (25%-CVaR-11.40despite+4.70mean return), whereasCVaR-PPO (alpha=0.25)eliminates crashes cleanly (25%-CVaR = +5.00, mean+5.00). - Stage 1 Active Future-Leakage Probe: 0/5 False Positives across
CartPole-v1,Pendulum-v1,Acrobot-v1,FrameStack(CartPole), and causalCausalWireless, while catching 3/3 (100%) planted lookahead bugs (shifted_lookahead_clonecorr=1.0000,non_markov_future_reward_leakdelta_R2=1.075, perm_p=0.032,exogenous_future_innovation_in_obsR^2=1.000). - Live SB3 External Policy Audit (
audit_external_policy+evaluate_drl_suite): Automatically caught unfrozen SB3VecNormalize(training=True)(obs_rms_unfrozen_on_eval), and audited frozen 3-seed SB3PPO(IQM374.33 [325.00, 500.00]) side-by-side againstwannado-drl PPO(IQM446.75 [180.50, 500.00]) with rliable Bootstrap 95% CIs.
Running Tests & Rebuilding the Catalog
python3 -m unittest discover -s tests -v
python3 -m wannado.drl.catalog --build
Feedback & Suggestions
Found a bug, want a new DRL paper implemented, or have ideas to improve the Stage 0 MDP & AI IDE Co-Pilot experience? Send feedback or suggestions without leaving GitHub:
- Open Feedback Portal: https://jietaozhao.github.io/wannado-drl/
- Or scan the QR code below from your phone:
Metadata
Release files for wannado-drl 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wannado_drl-1.1.1.tar.gz | 295.7 kB | Without provenance | Details for wannado_drl-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wannado_drl-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for wannado_drl-1.1.1-py3-none-any.whl |
Total release size: 629.0 kB
Release files / wannado_drl-1.1.1.tar.gz
| Download URL | wannado_drl-1.1.1.tar.gz |
|---|---|
| Size | 295.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
289e4f274e8706f842eac38295d39b8761630ebe819661b96ffa633b25af8378
|
|
BLAKE2b-256 checksum How to use checksums |
9869783b37d3c8fa96d7fda89f7b7b969dc6e481c9aff8dc28d095d526f6efda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Release files / wannado_drl-1.1.1-py3-none-any.whl
| Download URL | wannado_drl-1.1.1-py3-none-any.whl |
|---|---|
| Size | 333.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42f0cbef7a2d6959e1827f5992a649eadbe536d7cb5325cffce0f02c342ddfdc
|
|
BLAKE2b-256 checksum How to use checksums |
ff3165cde2a69cf096b64c8ee160a14601195076f0d28ff716e0035f266f9ead
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Security for wannado-drl 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.