Skip to content
Back to skills

Wrappers Recording

ASecurity

"Apply, inspect, author, and troubleshoot Gymnasium

  • 247 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 8, 2026
content-marketingpythonapi

Works with

  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill wrappers-recording --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Wrappers Recording?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Wrappers Recording
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-wrappers-recording/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-wrappers-recording)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: wrappers-recording
description: "Apply, inspect, author, and troubleshoot Gymnasium
  single-environment wrappers, recording helpers, and rendering helpers."
disable-model-invocation: true
metadata:
  disco-role: operating
license: MIT
---

# Gymnasium Wrappers and Recording

Use this sub-skill when a task needs single-environment Gymnasium wrappers: applying wrapper chains, inspecting wrapped environments, writing custom wrappers, recording episode statistics or videos, and diagnosing wrapper or render-mode failures.

## Start Here

1. Build the base environment with `gymnasium.make(...)`; most made environments already include `TimeLimit<OrderEnforcing<PassiveEnvChecker<...>>>` unless the spec/options disable parts of that stack.
2. Add wrappers outside-in: `env = Wrapper(env, ...)`; the last wrapper assigned is the first object the agent interacts with.
3. Inspect `env` for the full chain, `env.env` for the next inner layer, and `env.unwrapped` for the original base environment.
4. After any wrapper that changes observations or actions, verify `env.observation_space`, `env.action_space`, `reset()`, and one `step()` agree.
5. Use `RecordEpisodeStatistics` for lightweight metrics; add `RecordVideo` only when the environment was created with image-returning rendering such as `render_mode="rgb_array"` and `moviepy` is installed.

## Route by Task

| Task | Read |
| --- | --- |
| Choose or order built-in wrappers | [references/wrapper-catalog.md](references/wrapper-catalog.md) |
| Record episode returns, lengths, videos, or render frames | [references/recording-and-rendering.md](references/recording-and-rendering.md) |
| Write `Wrapper`, `ObservationWrapper`, `ActionWrapper`, or `RewardWrapper` subclasses | [references/custom-wrappers.md](references/custom-wrappers.md) |
| Diagnose wrapper order, changed spaces, render/video, image wrapper, Atari, or array conversion errors | [references/troubleshooting.md](references/troubleshooting.md) |
| Prove a local wrapper chain works | [`scripts/wrapper_smoke.py`](scripts/wrapper_smoke.py) |

## Common Patterns

```python
import gymnasium as gym
from gymnasium.wrappers import FlattenObservation, RecordEpisodeStatistics, TimeLimit

env = gym.make("CartPole-v1")
env = TimeLimit(env, max_episode_steps=200)
env = FlattenObservation(env)
env = RecordEpisodeStatistics(env)
obs, info = env.reset(seed=123)
obs, reward, terminated, truncated, info = env.step(env.action_space.sample())
```

```python
import gymnasium as gym
from gymnasium.wrappers import RecordVideo

env = gym.make("CartPole-v1", render_mode="rgb_array")
env = RecordVideo(env, video_folder="videos", episode_trigger=lambda episode: True)
```

## Boundaries

- For vector environments and `gymnasium.wrappers.vector`, use `../vectorization/SKILL.md`.
- For detailed `Space` constructor, flattening, dtype, and `contains` guidance, use `../spaces-data/SKILL.md`.
- For environment registration, `check_env`, and custom `Env` lifecycle, use `../environment-api/SKILL.md`.
- For built-in environment family extras such as Box2D, MuJoCo, Atari/ALE IDs, or Toy Text action masks, use `../builtin-envs/SKILL.md`.

Files in this skill

  • SKILL.md3.1 KB
  • references/custom-wrappers.md5.4 KB
  • references/recording-and-rendering.md4.8 KB
  • references/troubleshooting.md5.6 KB
  • references/wrapper-catalog.md8.2 KB
  • scripts/wrapper_smoke.py6.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.