EnsureInfoKeysWrapper

class EnsureInfoKeysWrapper(env, required_keys: Iterable[str])[source]

Bases: Wrapper

Validates that required keys are present in the info dict after reset and step.

Supports regex patterns for flexible key matching. Raises RuntimeError if any required pattern has no matching key.

Parameters:
  • env – The Gymnasium environment to wrap.

  • required_keys – Iterable of regex patterns as strings. Each pattern must match at least one key in the info dict.

Raises:

RuntimeError – If any required pattern has no matching key in info dict.

reset(*args, **kwargs)[source]

Uses the reset() of the env that can be overwritten to change the returned data.

step(action)[source]

Uses the step() of the env that can be overwritten to change the returned data.