计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
wrappers-recording【效率与协作】Apply, inspect, author, and troubleshoot Gymnasium single-environment wrappers, recording helpers, and rendering helpers.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
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.
gymnasium.make(...); most made environments already include TimeLimit<OrderEnforcing<PassiveEnvChecker<...>>> unless the spec/options disable parts of that stack.env = Wrapper(env, ...); the last wrapper assigned is the first object the agent interacts with.env for the full chain, env.env for the next inner layer, and env.unwrapped for the original base environment.env.observation_space, env.action_space, reset(), and one step() agree.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.| Task | Read |
|---|---|
| Choose or order built-in wrappers | references/wrapper-catalog.md |
| Record episode returns, lengths, videos, or render frames | references/recording-and-rendering.md |
Write Wrapper, ObservationWrapper, ActionWrapper, or RewardWrapper subclasses | references/custom-wrappers.md |
| Diagnose wrapper order, changed spaces, render/video, image wrapper, Atari, or array conversion errors | references/troubleshooting.md |
| Prove a local wrapper chain works | scripts/wrapper_smoke.py |
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())
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)
gymnasium.wrappers.vector, use ../vectorization/SKILL.md.Space constructor, flattening, dtype, and contains guidance, use ../spaces-data/SKILL.md.check_env, and custom Env lifecycle, use ../environment-api/SKILL.md.../builtin-envs/SKILL.md.