stable-baselines3

Train reinforcement learning agents with Stable Baselines3 and Gymnasium environments.

21|2|Updated Dec 8, 2025
One-click install
npx skills add https://github.com/silverstein/claude-scientific-skills-desktop --skill stable-baselines3-silverstein
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stable-baselines3
Source: https://github.com/silverstein/claude-scientific-skills-desktop/tree/main/corpus/stable-baselines3
Command: npx skills add https://github.com/silverstein/claude-scientific-skills-desktop --skill stable-baselines3-silverstein

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It helps you implement and debug reinforcement learning training workflows by providing reliable, end-to-end guidance for using Stable Baselines3 with Gymnasium-style environments.

Core Features & Use Cases

  • Algorithm implementation guidance: Choose and configure core SB3 algorithms (PPO, SAC, TD3, DQN, A2C) for discrete/continuous and on-policy/off-policy scenarios, including practical hyperparameter tips and when to use HER or RecurrentPPO.
  • Custom environment design: Build Gymnasium-compatible environments (spaces, reset/step signatures, termination vs truncation) and validate them with SB3’s check_env() to prevent subtle interface bugs.
  • Vectorized training & callbacks: Accelerate data collection with DummyVecEnv/SubprocVecEnv, handle VecEnv API differences, and structure training monitoring via Eval/Checkpoint callbacks, model saving/loading, and evaluation patterns (including recording video).

Quick Start

Use the stable-baselines3 skill to set up and validate a custom Gymnasium environment, select the appropriate SB3 RL algorithm, and write a minimal training loop with callbacks for evaluation and checkpointing.

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 in Stable Baselines3 using a custom Gymnasium environment?

To train a PPO agent in Stable Baselines3, define a custom Gymnasium environment with correct reset, step, and space definitions, validate it with check_env, and then configure the PPO model with the appropriate hyperparameters for your on-policy training loop.

When should I use SAC versus TD3 for continuous reinforcement learning tasks?

Use SAC for continuous reinforcement learning tasks requiring automatic entropy tuning and better exploration, whereas TD3 is preferred for deterministic policy gradients and stable off-policy training without entropy regularization.

What's the best way to accelerate data collection during reinforcement learning model training?

Accelerate reinforcement learning model training data collection by wrapping your Gymnasium environments using DummyVecEnv for single-process vectorization or SubprocVecEnv for multi-process parallelization.

Can I use custom callbacks to monitor and evaluate reinforcement learning agents during training?

Yes, you can use custom callbacks to monitor reinforcement learning agents during training by configuring EvalCallback for periodic evaluation and CheckpointCallback to save model progress, ensuring robust model persistence.

Why does my Stable Baselines3 training crash when using a custom Gymnasium environment?

Stable Baselines3 training crashes with custom Gymnasium environments usually occur due to incorrect space definitions or invalid reset and step signatures; validate your environment interface using SB3's check_env utility to prevent subtle bugs.

Does Stable Baselines3 support recording video of agent evaluations?

Yes, Stable Baselines3 supports recording video of agent evaluations by configuring the evaluation workflow with specific callbacks that record video output during the model assessment phase.