<linkrel="index"title="Index"href="../../genindex/"/><linkrel="search"title="Search"href="../../search/"/><linkrel="next"title="Registry"href="../registry/"/><linkrel="prev"title="v21 to v26 Migration Guide"href="../../content/migration-guide/"/>
<liclass="toctree-l1"><aclass="reference external"href="https://github.com/Farama-Foundation/Gymnasium/blob/main/docs/README.md">Contribute to the Docs</a></li>
<emclass="property"><spanclass="pre">class</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">gymnasium.</span></span><spanclass="sig-name descname"><spanclass="pre">Env</span></span><aclass="headerlink"href="#gymnasium.Env"title="Permalink to this definition">#</a></dt>
<dd><p>The main Gymnasium class for implementing Reinforcement Learning Agents environments.</p>
<p>The class encapsulates an environment with arbitrary behind-the-scenes dynamics through the <aclass="reference internal"href="#gymnasium.Env.step"title="gymnasium.Env.step"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">step()</span></code></a> and <aclass="reference internal"href="#gymnasium.Env.reset"title="gymnasium.Env.reset"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">reset()</span></code></a> functions.
An environment can be partially or fully observed by single agents. For multi-agent environments, see PettingZoo.</p>
<p>The main API methods that users of this class need to know are:</p>
<ulclass="simple">
<li><p><aclass="reference internal"href="#gymnasium.Env.step"title="gymnasium.Env.step"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">step()</span></code></a> - Updates an environment with actions returning the next agent observation, the reward for taking that actions,
if the environment has terminated or truncated due to the latest action and information from the environment about the step, i.e. metrics, debug info.</p></li>
<li><p><aclass="reference internal"href="#gymnasium.Env.reset"title="gymnasium.Env.reset"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">reset()</span></code></a> - Resets the environment to an initial state, required before calling step.
Returns the first agent observation for an episode and information, i.e. metrics, debug info.</p></li>
<li><p><aclass="reference internal"href="#gymnasium.Env.render"title="gymnasium.Env.render"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">render()</span></code></a> - Renders the environments to help visualise what the agent see, examples modes are “human”, “rgb_array”, “ansi” for text.</p></li>
<li><p><aclass="reference internal"href="#gymnasium.Env.close"title="gymnasium.Env.close"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">close()</span></code></a> - Closes the environment, important when external software is used, i.e. pygame for rendering, databases</p></li>
</ul>
<p>Environments have additional attributes for users to understand the implementation</p>
<ulclass="simple">
<li><p><aclass="reference internal"href="../vector/#action_space"title="action_space"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">action_space</span></code></a> - The Space object corresponding to valid actions, all valid actions should be contained within the space.</p></li>
<li><p><aclass="reference internal"href="../vector/#observation_space"title="observation_space"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">observation_space</span></code></a> - The Space object corresponding to valid observations, all valid observations should be contained within the space.</p></li>
<li><p><aclass="reference internal"href="#gymnasium.Env.reward_range"title="gymnasium.Env.reward_range"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">reward_range</span></code></a> - A tuple corresponding to the minimum and maximum possible rewards for an agent over an episode.
The default reward range is set to <spanclass="math notranslate nohighlight">\((-\infty,+\infty)\)</span>.</p></li>
<li><p><aclass="reference internal"href="../registry/#gymnasium.spec"title="gymnasium.spec"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">spec</span></code></a> - An environment spec that contains the information used to initialize the environment from <aclass="reference internal"href="../registry/#gymnasium.make"title="gymnasium.make"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">gymnasium.make()</span></code></a></p></li>
<li><p><aclass="reference internal"href="#gymnasium.Env.metadata"title="gymnasium.Env.metadata"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">metadata</span></code></a> - The metadata of the environment, i.e. render modes, render fps</p></li>
<li><p><aclass="reference internal"href="#gymnasium.Env.np_random"title="gymnasium.Env.np_random"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">np_random</span></code></a> - The random number generator for the environment. This is automatically assigned during
<codeclass="docutils literal notranslate"><spanclass="pre">super().reset(seed=seed)</span></code> and when assessing <codeclass="docutils literal notranslate"><spanclass="pre">self.np_random</span></code>.</p></li>
</ul>
<divclass="admonition seealso">
<pclass="admonition-title">See also</p>
<p>For modifying or extending environments use the <aclass="reference internal"href="../wrappers/#gymnasium.Wrapper"title="gymnasium.Wrapper"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">gymnasium.Wrapper</span></code></a> class</p>
</div>
</dd></dl>
<sectionid="methods">
<h3>Methods<aclass="headerlink"href="#methods"title="Permalink to this heading">#</a></h3>
<spanclass="sig-prename descclassname"><spanclass="pre">gymnasium.Env.</span></span><spanclass="sig-name descname"><spanclass="pre">step</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">self</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">action</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">ActType</span></span></em><spanclass="sig-paren">)</span><spanclass="sig-return"><spanclass="sig-return-icon">→</span><spanclass="sig-return-typehint"><spanclass="pre">Tuple</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">ObsType</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">float</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">bool</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">bool</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">dict</span><spanclass="p"><spanclass="pre">]</span></span></span></span><aclass="headerlink"href="#gymnasium.Env.step"title="Permalink to this definition">#</a></dt>
<dd><p>Run one timestep of the environment’s dynamics using the agent actions.</p>
<p>When the end of an episode is reached (<codeclass="docutils literal notranslate"><spanclass="pre">terminated</span><spanclass="pre">or</span><spanclass="pre">truncated</span></code>), it is necessary to call <aclass="reference internal"href="#gymnasium.Env.reset"title="gymnasium.Env.reset"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">reset()</span></code></a> to
reset this environment’s state for the next episode.</p>
<divclass="versionchanged">
<p><spanclass="versionmodified changed">Changed in version 0.26: </span>The Step API was changed removing <codeclass="docutils literal notranslate"><spanclass="pre">done</span></code> in favor of <codeclass="docutils literal notranslate"><spanclass="pre">terminated</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">truncated</span></code> to make it clearer
to users when the environment had terminated or truncated which is critical for reinforcement learning
<li><p><strong>observation</strong> (<em>ObsType</em>) – An element of the environment’s <aclass="reference internal"href="../vector/#observation_space"title="observation_space"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">observation_space</span></code></a> as the next observation due to the agent actions.
An example is a numpy array containing the positions and velocities of the pole in CartPole.</p></li>
<li><p><strong>reward</strong> (<em>float</em>) – The reward as a result of taking the action.</p></li>
<li><p><strong>terminated</strong> (<em>bool</em>) – Whether the agent reaches the terminal state (as defined under the MDP of the task)
which can be positive or negative. An example is reaching the goal state or moving into the lava from
the Sutton and Barton, Gridworld. If true, the user needs to call <aclass="reference internal"href="#gymnasium.Env.reset"title="gymnasium.Env.reset"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">reset()</span></code></a>.</p></li>
<li><p><strong>truncated</strong> (<em>bool</em>) – Whether the truncation condition outside the scope of the MDP is satisfied.
Typically, this is a timelimit, but could also be used to indicate an agent physically going out of bounds.
Can be used to end the episode prematurely before a terminal state is reached.
If true, the user needs to call <aclass="reference internal"href="#gymnasium.Env.reset"title="gymnasium.Env.reset"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">reset()</span></code></a>.</p></li>
<li><p><strong>info</strong> (<em>dict</em>) – Contains auxiliary diagnostic information (helpful for debugging, learning, and logging).
In OpenAI Gym <v26, it contains “TimeLimit.truncated” to distinguish truncation and termination,
however this is deprecated in favour of returning terminated and truncated variables.</p></li>
<li><p><strong>done</strong> (<em>bool</em>) – (Deprecated) A boolean value for if the episode has ended, in which case further <aclass="reference internal"href="#gymnasium.Env.step"title="gymnasium.Env.step"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">step()</span></code></a> calls will
return undefined results. This was removed in OpenAI Gym v26 in favor of terminated and truncated attributes.
A done signal may be emitted for different reasons: Maybe the task underlying the environment was solved successfully,
a certain timelimit was exceeded, or the physics simulation has entered an invalid state.</p></li>
<spanclass="sig-prename descclassname"><spanclass="pre">gymnasium.Env.</span></span><spanclass="sig-name descname"><spanclass="pre">reset</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">self</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">*</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">seed</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">int</span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">options</span></span><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="n"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">dict</span><spanclass="p"><spanclass="pre">]</span></span></span><spanclass="w"></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><spanclass="sig-return"><spanclass="sig-return-icon">→</span><spanclass="sig-return-typehint"><spanclass="pre">Tuple</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">ObsType</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">dict</span><spanclass="p"><spanclass="pre">]</span></span></span></span><aclass="headerlink"href="#gymnasium.Env.reset"title="Permalink to this definition">#</a></dt>
<dd><p>Resets the environment to an initial internal state, returning an initial observation and info.</p>
<p>This method generates a new starting state often with some randomness to ensure that the agent explores the
state space and learns a generalised policy about the environment. This randomness can be controlled
with the <codeclass="docutils literal notranslate"><spanclass="pre">seed</span></code> parameter otherwise if the environment already has a random number generator and
<aclass="reference internal"href="#gymnasium.Env.reset"title="gymnasium.Env.reset"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">reset()</span></code></a> is called with <codeclass="docutils literal notranslate"><spanclass="pre">seed=None</span></code>, the RNG is not reset.</p>
<p>Therefore, <aclass="reference internal"href="#gymnasium.Env.reset"title="gymnasium.Env.reset"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">reset()</span></code></a> should (in the typical use case) be called with a seed right after initialization and then never again.</p>
<p>For Custom environments, the first line of <aclass="reference internal"href="#gymnasium.Env.reset"title="gymnasium.Env.reset"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">reset()</span></code></a> should be <codeclass="docutils literal notranslate"><spanclass="pre">super().reset(seed=seed)</span></code> which implements
the seeding correctly.</p>
<divclass="versionchanged">
<p><spanclass="versionmodified changed">Changed in version v0.25: </span>The <codeclass="docutils literal notranslate"><spanclass="pre">return_info</span></code> parameter was removed and now info is expected to be returned.</p>
If the environment does not already have a PRNG and <codeclass="docutils literal notranslate"><spanclass="pre">seed=None</span></code> (the default option) is passed,
a seed will be chosen from some source of entropy (e.g. timestamp or /dev/urandom).
However, if the environment already has a PRNG and <codeclass="docutils literal notranslate"><spanclass="pre">seed=None</span></code> is passed, the PRNG will <em>not</em> be reset.
If you pass an integer, the PRNG will be reset even if it already exists.
Usually, you want to pass an integer <em>right after the environment has been initialized and then never again</em>.
Please refer to the minimal example above to see this paradigm in action.</p></li>
<li><p><strong>options</strong> (<em>optional dict</em>) – Additional information to specify how the environment is reset (optional,
<li><p><strong>observation</strong> (<em>ObsType</em>) – Observation of the initial state. This will be an element of <aclass="reference internal"href="../vector/#observation_space"title="observation_space"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">observation_space</span></code></a>
(typically a numpy array) and is analogous to the observation returned by <aclass="reference internal"href="#gymnasium.Env.step"title="gymnasium.Env.step"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">step()</span></code></a>.</p></li>
<li><p><strong>info</strong> (<em>dictionary</em>) – This dictionary contains auxiliary information complementing <codeclass="docutils literal notranslate"><spanclass="pre">observation</span></code>. It should be analogous to
the <codeclass="docutils literal notranslate"><spanclass="pre">info</span></code> returned by <aclass="reference internal"href="#gymnasium.Env.step"title="gymnasium.Env.step"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">step()</span></code></a>.</p></li>
<spanclass="sig-prename descclassname"><spanclass="pre">gymnasium.Env.</span></span><spanclass="sig-name descname"><spanclass="pre">render</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">self</span></span></em><spanclass="sig-paren">)</span><spanclass="sig-return"><spanclass="sig-return-icon">→</span><spanclass="sig-return-typehint"><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">Union</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">RenderFrame</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">List</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">RenderFrame</span><spanclass="p"><spanclass="pre">]</span></span><spanclass="p"><spanclass="pre">]</span></span><spanclass="p"><spanclass="pre">]</span></span></span></span><aclass="headerlink"href="#gymnasium.Env.render"title="Permalink to this definition">#</a></dt>
<dd><p>Compute the render frames as specified by <aclass="reference internal"href="#gymnasium.Env.render_mode"title="gymnasium.Env.render_mode"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">render_mode</span></code></a> during the initialization of the environment.</p>
<p>The environment’s <aclass="reference internal"href="#gymnasium.Env.metadata"title="gymnasium.Env.metadata"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">metadata</span></code></a> render modes (<cite>env.metadata[“render_modes”]</cite>) should contain the possible
ways to implement the render modes. In addition, list versions for most render modes is achieved through
<cite>gymnasium.make</cite> which automatically applies a wrapper to collect rendered frames.</p>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>As the <aclass="reference internal"href="#gymnasium.Env.render_mode"title="gymnasium.Env.render_mode"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">render_mode</span></code></a> is known during <codeclass="docutils literal notranslate"><spanclass="pre">__init__</span></code>, the objects used to render the environment state
should be initialised in <codeclass="docutils literal notranslate"><spanclass="pre">__init__</span></code>.</p>
</div>
<p>By convention, if the <aclass="reference internal"href="#gymnasium.Env.render_mode"title="gymnasium.Env.render_mode"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">render_mode</span></code></a> is:</p>
<li><p>“human”: The environment is continuously rendered in the current display or terminal, usually for human consumption.
This rendering should occur during <aclass="reference internal"href="#gymnasium.Env.step"title="gymnasium.Env.step"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">step()</span></code></a> and <aclass="reference internal"href="#gymnasium.Env.render"title="gymnasium.Env.render"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">render()</span></code></a> doesn’t need to be called. Returns <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p></li>
<li><p>“rgb_array”: Return a single frame representing the current state of the environment.
A frame is a <codeclass="docutils literal notranslate"><spanclass="pre">np.ndarray</span></code> with shape <codeclass="docutils literal notranslate"><spanclass="pre">(x,</span><spanclass="pre">y,</span><spanclass="pre">3)</span></code> representing RGB values for an x-by-y pixel image.</p></li>
<li><p>“ansi”: Return a strings (<codeclass="docutils literal notranslate"><spanclass="pre">str</span></code>) or <codeclass="docutils literal notranslate"><spanclass="pre">StringIO.StringIO</span></code> containing a terminal-style text representation
for each time step. The text can include newlines and ANSI escape sequences (e.g. for colors).</p></li>
<li><p>“rgb_array_list” and “ansi_list”: List based version of render modes are possible (except Human) through the
wrapper, <aclass="reference internal"href="../wrappers/misc_wrappers/#gymnasium.wrappers.RenderCollection"title="gymnasium.wrappers.RenderCollection"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">gymnasium.wrappers.RenderCollection</span></code></a> that is automatically applied during <codeclass="docutils literal notranslate"><spanclass="pre">gymnasium.make(...,</span><spanclass="pre">render_mode="rgb_array_list")</span></code>.
The frames collected are popped after <aclass="reference internal"href="#gymnasium.Env.render"title="gymnasium.Env.render"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">render()</span></code></a> is called or <aclass="reference internal"href="#gymnasium.Env.reset"title="gymnasium.Env.reset"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">reset()</span></code></a>.</p></li>
<p>Make sure that your class’s <aclass="reference internal"href="#gymnasium.Env.metadata"title="gymnasium.Env.metadata"><codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">metadata</span></code></a><codeclass="docutils literal notranslate"><spanclass="pre">"render_modes"</span></code> key includes the list of supported modes.</p>
</div>
<divclass="versionchanged">
<p><spanclass="versionmodified changed">Changed in version 0.25.0: </span>The render function was changed to no longer accept parameters, rather these parameters should be specified
in the environment initialised, i.e., <codeclass="docutils literal notranslate"><spanclass="pre">gymnasium.make("CartPole-v1",</span><spanclass="pre">render_mode="human")</span></code></p>
<spanclass="sig-prename descclassname"><spanclass="pre">Env.</span></span><spanclass="sig-name descname"><spanclass="pre">action_space</span></span><emclass="property"><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><aclass="reference internal"href="../spaces/#gymnasium.spaces.Space"title="gymnasium.spaces.space.Space"><spanclass="pre">Space</span></a><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">ActType</span><spanclass="p"><spanclass="pre">]</span></span></em><aclass="headerlink"href="#gymnasium.Env.action_space"title="Permalink to this definition">#</a></dt>
<dd><p>The Space object corresponding to valid actions, all valid actions should be contained with the space. For example, if the action space is of type <cite>Discrete</cite> and gives the value <cite>Discrete(2)</cite>, this means there are two valid discrete actions: 0 & 1.</p>
<spanclass="sig-prename descclassname"><spanclass="pre">Env.</span></span><spanclass="sig-name descname"><spanclass="pre">observation_space</span></span><emclass="property"><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><aclass="reference internal"href="../spaces/#gymnasium.spaces.Space"title="gymnasium.spaces.space.Space"><spanclass="pre">Space</span></a><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">ObsType</span><spanclass="p"><spanclass="pre">]</span></span></em><aclass="headerlink"href="#gymnasium.Env.observation_space"title="Permalink to this definition">#</a></dt>
<dd><p>The Space object corresponding to valid observations, all valid observations should be contained with the space. For example, if the observation space is of type <codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Box</span></code> and the shape of the object is <codeclass="docutils literal notranslate"><spanclass="pre">(4,)</span></code>, this denotes a valid observation will be an array of 4 numbers. We can check the box bounds as well with attributes.</p>
<spanclass="sig-prename descclassname"><spanclass="pre">Env.</span></span><spanclass="sig-name descname"><spanclass="pre">metadata</span></span><emclass="property"><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="pre">Dict</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">str</span><spanclass="p"><spanclass="pre">,</span></span><spanclass="w"></span><spanclass="pre">Any</span><spanclass="p"><spanclass="pre">]</span></span></em><emclass="property"><spanclass="w"></span><spanclass="p"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="pre">{'render_modes':</span><spanclass="pre">[]}</span></em><aclass="headerlink"href="#gymnasium.Env.metadata"title="Permalink to this definition">#</a></dt>
<dd><p>The metadata of the environment containing rendering modes, rendering fps, etc</p>
<spanclass="sig-prename descclassname"><spanclass="pre">Env.</span></span><spanclass="sig-name descname"><spanclass="pre">render_mode</span></span><emclass="property"><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="pre">Optional</span><spanclass="p"><spanclass="pre">[</span></span><spanclass="pre">str</span><spanclass="p"><spanclass="pre">]</span></span></em><emclass="property"><spanclass="w"></span><spanclass="p"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="pre">None</span></em><aclass="headerlink"href="#gymnasium.Env.render_mode"title="Permalink to this definition">#</a></dt>
<dd><p>The render mode of the environment determined at initialisation</p>
<spanclass="sig-prename descclassname"><spanclass="pre">Env.</span></span><spanclass="sig-name descname"><spanclass="pre">reward_range</span></span><emclass="property"><spanclass="w"></span><spanclass="p"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="pre">(-inf,</span><spanclass="pre">inf)</span></em><aclass="headerlink"href="#gymnasium.Env.reward_range"title="Permalink to this definition">#</a></dt>
<dd><p>A tuple corresponding to the minimum and maximum possible rewards for an agent over an episode. The default reward range is set to <spanclass="math notranslate nohighlight">\((-\infty,+\infty)\)</span>.</p>
<spanclass="sig-prename descclassname"><spanclass="pre">Env.</span></span><spanclass="sig-name descname"><spanclass="pre">spec</span></span><emclass="property"><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="pre">EnvSpec</span></em><emclass="property"><spanclass="w"></span><spanclass="p"><spanclass="pre">=</span></span><spanclass="w"></span><spanclass="pre">None</span></em><aclass="headerlink"href="#gymnasium.Env.spec"title="Permalink to this definition">#</a></dt>
<dd><p>The <codeclass="docutils literal notranslate"><spanclass="pre">EnvSpec</span></code> of the environment normally set during <aclass="reference internal"href="../registry/#gymnasium.make"title="gymnasium.make"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">gymnasium.make()</span></code></a></p>
<spanclass="sig-prename descclassname"><spanclass="pre">gymnasium.Env.</span></span><spanclass="sig-name descname"><spanclass="pre">close</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">self</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#gymnasium.Env.close"title="Permalink to this definition">#</a></dt>
<emclass="property"><spanclass="pre">property</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">Env.</span></span><spanclass="sig-name descname"><spanclass="pre">unwrapped</span></span><emclass="property"><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><aclass="reference internal"href="#gymnasium.Env"title="gymnasium.core.Env"><spanclass="pre">Env</span></a></em><aclass="headerlink"href="#gymnasium.Env.unwrapped"title="Permalink to this definition">#</a></dt>
<dd><p>Returns the base non-wrapped environment (i.e., removes all wrappers).</p>
<emclass="property"><spanclass="pre">property</span><spanclass="w"></span></em><spanclass="sig-prename descclassname"><spanclass="pre">Env.</span></span><spanclass="sig-name descname"><spanclass="pre">np_random</span></span><emclass="property"><spanclass="p"><spanclass="pre">:</span></span><spanclass="w"></span><spanclass="pre">Generator</span></em><aclass="headerlink"href="#gymnasium.Env.np_random"title="Permalink to this definition">#</a></dt>
<dd><p>Returns the environment’s internal <codeclass="xref py py-attr docutils literal notranslate"><spanclass="pre">_np_random</span></code> that if not set will initialise with a random seed.</p>
<h3>Implementing environments<aclass="headerlink"href="#implementing-environments"title="Permalink to this heading">#</a></h3>
<p>When implementing an environment, the :meth:Env.reset and <aclass="reference internal"href="#gymnasium.Env.step"title="gymnasium.Env.step"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">Env.step()</span></code></a> functions much be created describing the
dynamics of the environment.
For more information see the environment creation tutorial.</p>