# Module: tf_agents.environments

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/environments/__init__.py) |

Environments module.

## Modules

[`batched_py_environment`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/batched_py_environment) module: Treat multiple non-batch environments as a single batch environment.

[`gym_wrapper`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/gym_wrapper) module: Wrapper providing a PyEnvironmentBase adapter for Gym environments.

[`parallel_py_environment`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/parallel_py_environment) module: Runs multiple environments in parallel processes and steps them in batch.

[`py_environment`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/py_environment) module: Python RL Environment API.

[`random_py_environment`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/random_py_environment) module: Environment implementation that generates random observations.

[`random_tf_environment`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/random_tf_environment) module: Utility environment that creates random observations.

[`suite_gym`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/suite_gym) module: Suite for loading Gym Environments.

[`tf_environment`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/tf_environment) module: TensorFlow RL Environment API.

[`tf_py_environment`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/tf_py_environment) module: Wrapper for PyEnvironments into TFEnvironments.

[`trajectory_replay`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/trajectory_replay) module: A Driver-like object that replays Trajectories.

[`utils`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/utils) module: Common utilities for TF-Agents Environments.

[`wrappers`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/wrappers) module: Environment wrappers.

## Classes

[`class ActionClipWrapper`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/ActionClipWrapper): Wraps an environment and clips actions to spec before applying.

[`class ActionDiscretizeWrapper`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/ActionDiscretizeWrapper): Wraps an environment with continuous actions and discretizes them.

[`class ActionOffsetWrapper`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/ActionOffsetWrapper): Offsets actions to be zero-based.

[`class ActionRepeat`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/ActionRepeat): Repeates actions over n-steps while acummulating the received reward.

[`class BatchedPyEnvironment`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/BatchedPyEnvironment): Batch together multiple py environments and act as a single batch.

[`class FlattenObservationsWrapper`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/FlattenObservationsWrapper): Wraps an environment and flattens nested multi-dimensional observations.

[`class GoalReplayEnvWrapper`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/GoalReplayEnvWrapper): Adds a goal to the observation, used for HER (Hindsight Experience Replay).

[`class HistoryWrapper`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/HistoryWrapper): Adds observation and action history to the environment's observations.

[`class ObservationFilterWrapper`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/ObservationFilterWrapper): Filters observations based on an array of indexes.

[`class OneHotActionWrapper`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/OneHotActionWrapper): Converts discrete action to one_hot format.

[`class ParallelPyEnvironment`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/ParallelPyEnvironment): Batch together environments and simulate them in external processes.

[`class PerformanceProfiler`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/PerformanceProfiler): End episodes after specified number of steps.

[`class PyEnvironment`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/PyEnvironment): Abstract base class for Python RL environments.

[`class PyEnvironmentBaseWrapper`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/PyEnvironmentBaseWrapper): PyEnvironment wrapper forwards calls to the given environment.

[`class RandomPyEnvironment`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/RandomPyEnvironment): Randomly generates observations following the given observation_spec.

[`class RandomTFEnvironment`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/RandomTFEnvironment): Randomly generates observations following the given observation_spec.

[`class RunStats`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/RunStats): Wrapper that accumulates run statistics as the environment iterates.

[`class TFEnvironment`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/TFEnvironment): Abstract base class for TF RL environments.

[`class TFPyEnvironment`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/TFPyEnvironment): Exposes a Python environment as an in-graph TF environment.

[`class TimeLimit`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/TimeLimit): End episodes after specified number of steps.

[`class TrajectoryReplay`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/TrajectoryReplay): A helper that replays a policy against given `Trajectory` observations.

## Functions

[`validate_py_environment(...)`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/environments/validate_py_environment): Validates the environment follows the defined specs.