> ## Documentation Index
> Fetch the complete documentation index at: https://wiki.latch.bio/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment

> How Latch Agent runs on Latch Plots and manages resources.

<Columns>
  <div>
    Latch Agent operates within [Latch Plots](/plots/overview), where each notebook is backed by a dedicated virtual machine. Understanding how the notebook runtime works helps you manage agent sessions effectively.
  </div>

  <Frame>
    <img src="https://mintcdn.com/latchbio/O9ccDM5r9gHXixUG/images/agent/environment.png?fit=max&auto=format&n=O9ccDM5r9gHXixUG&q=85&s=3a6d94de73cd3f4ff146fef7f2d96cbc" alt="Environment" width="1006" height="556" data-path="images/agent/environment.png" />
  </Frame>
</Columns>

## Notebook Runtime

Latch Agent runs within a [Latch Plots notebook runtime](/plots/layouts#notebook-runtime). Each notebook is backed by a dedicated virtual machine with a Python kernel, compute resources (CPU, GPU, RAM), and the `plots-faas` conda environment. The agent is only available when the notebook is in the "Connected" state.

## Notebook Statuses and Agent Availability

When you create or open a notebook, it transitions through these states:

* **Creating Runtime / Layout Connecting / Initializing**: The agent is not available during these startup phases. Initialization automatically executes all cells, which can take several minutes for complex notebooks.

* **Connected**: The agent is fully operational and can interact with the notebook, execute code, and manipulate cells.

* **Dormant**: The notebook has shut down. In-memory variables and session state are cleared, but files and installed packages persist on disk. The agent is unavailable until the notebook restarts and completes initialization.

<Note>
  By default, notebooks automatically shut down after 1 hour of inactivity.
</Note>

## Session Persistence

**What persists**: Code cells, files on disk, and installed packages.

**What doesn't persist**: In-memory variables, functions, and loaded data are cleared when the notebook shuts down. On restart, autorunning re-executes all cells, which recreates these variables.

<Note>
  Before ending a session and shutting down the notebook, save important data to disk or upload to Latch Data. Ask the agent to help save data if needed.
</Note>

## Dependencies

The agent runs in the `plots-faas` conda environment and **can automatically install custom dependencies** as needed during analysis. Installed packages persist on disk across sessions, so they're available in future sessions without reinstallation.

## Best Practices

* **Check notebook status**: If the agent seems unresponsive, verify the notebook is in the "Connected" state. It may be initializing or dormant
* **Plan for startup time**: Opening a dormant notebook requires waiting for initialization (several minutes for complex notebooks) before the agent is ready
* **Let the agent handle dependencies**: The agent automatically installs required packages; manually installing everything upfront isn't necessary
* **Save important data**: In-memory variables are cleared on shutdown, so explicitly save critical outputs to disk
* **Restart strategically**: Restart if memory issues occur, but expect temporary agent unavailability during reinitialization
