stable-baselines3

Train and evaluate reinforcement learning agents with Stable Baselines3.

2|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/Clay-HHK/claude-config --skill stable-baselines3-clay-hhk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stable-baselines3
Source: https://github.com/Clay-HHK/claude-config/tree/main/skills/stable-baselines3
Command: npx skills add https://github.com/Clay-HHK/claude-config --skill stable-baselines3-clay-hhk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires stable-baselines3, gymnasium, numpy, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill reduces the boilerplate and common pitfalls of training, evaluating, and persisting reinforcement learning agents by providing templates, best practices, and comprehensive references for Stable Baselines3 so practitioners can iterate faster and avoid integration errors.

Core Features & Use Cases

  • Training templates: A production-ready training script with vectorized environments, TensorBoard integration, and checkpointing for common algorithms.
  • Evaluation & recording: Evaluation and video-recording utilities to measure performance, load VecNormalize statistics, and compare models.
  • Custom environments & validation: A full custom Gymnasium environment template and guidance on implementing, validating, and registering environments compatible with SB3.
  • Vectorization & callbacks: Guidance and examples for DummyVecEnv/SubprocVecEnv, VecNormalize, callback chaining, early stopping, and custom monitoring.
  • Model persistence & inspection: Best practices for saving/loading models, normalization stats, and accessing parameters/state dicts.

Quick Start

Train a PPO agent on CartPole using the provided training template to obtain a working model, evaluation logs, and saved checkpoints.

Frequently Asked Questions about stable-baselines3

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I train a PPO agent using Stable Baselines3 with vectorized environments?

To train a PPO agent using Stable Baselines3, you can use production-ready training templates featuring vectorized environments like DummyVecEnv or SubprocVecEnv, TensorBoard integration, and automatic checkpointing to iterate quickly and avoid integration errors.

What is the best way to save and load reinforcement learning models with VecNormalize statistics?

Saving and loading reinforcement learning models with VecNormalize statistics requires persisting both the model and its normalization stats. Best practices include storing state dicts and reloading normalization statistics during evaluation to maintain training performance.

Can I use Stable Baselines3 to evaluate agents and record video in Gymnasium environments?

Yes, you can use Stable Baselines3 to evaluate agents and record video in Gymnasium environments. Provided evaluation and video-recording utilities measure performance, load VecNormalize statistics, and compare models seamlessly.

Does Stable Baselines3 support both on-policy and off-policy algorithms like SAC and DQN?

Stable Baselines3 supports both on-policy and off-policy reinforcement learning algorithms. It includes implementations of PPO, SAC, DQN, TD3, DDPG, and A2C for single-agent Gymnasium environments, enabling rapid prototyping and vectorized training.

How do I implement and validate a custom Gymnasium environment for reinforcement learning?

Implementing and validating a custom Gymnasium environment involves using a provided environment template to ensure compatibility with Stable Baselines3. This guidance helps you correctly register environments and avoid common integration pitfalls during agent training.

Why do I need callbacks for early stopping and custom monitoring in reinforcement learning training?

Callbacks are needed for early stopping and custom monitoring to control reinforcement learning training workflows dynamically. Chaining callbacks allows you to halt training upon convergence and track custom metrics without modifying core algorithm code.