# Environments

> What an Environment is, what an agent can do in it, when it sleeps, how to wake it, and what is saved when it is replaced.

Source: https://docs.whorl.work/agents/environments

An Environment is the computer where an agent runs code and tools for a [Thread](/threads) or a [Captain](/captains). It is replaceable. If it goes to sleep or is swapped for a fresh one, the Thread and its files stay.

## What is in an Environment

An Environment is an Ubuntu computer with a web browser the agent can control, so it can build a page, run a script, open a spreadsheet or test an app. Each Thread has its own Environment. Subagents share their Thread's Environment, and a child Thread gets its own. See [Threads](/threads#child-threads-and-subagents).

People do not see the Environment directly. They see what the agent shares: files saved to the Thread's folder, screenshots, and [Portals](/portals) for apps the agent runs.

Outside access is limited. An agent's commands reach the internet only through a proxy that allows the npm and PyPI package registries. For pages and other services, the agent uses Whorl's own tools. Connect a service as a tool when agents need to act in it. See [Tools, MCP servers and connectors](/agents/tools).

## What is saved

Only the agent's working folder is saved to [Files](/files). Anything outside it, and anything the agent keeps in its scratch folder, is gone when the Environment is replaced. When an agent produces a result you need, ask it to save the result in the Thread's folder.

Files that other Threads and Captains save in the Space appear in an Environment while the agent works, so an agent can read them.

## Sleep and wake

An Environment sleeps after 30 minutes with no activity, to save cost. Sleeping loses nothing. A Portal in a sleeping Thread shows **Sleeping**.

Work sent to the Thread starts the Environment again. A Thread whose Environment is asleep can also show a **Wake** button in the Thread's sidebar. Choose it to start the Environment now. While it starts, the button reads **Waking…**. If it fails, Whorl says "Whorl couldn't wake this Thread." or "The Thread's Environment could not start. Try again."

## Replacement

Whorl replaces an Environment when it needs to, for example after a failure. The Thread, its messages and its Files stay. Anything a program in the Environment held in memory, or any app the agent left running, has to be started again. A [Box](/boxes) is the choice for an app that should keep running with its own machine.

## Cost

Whorl records what each Thread's Environment costs. Owners and admins see it in **Settings → Company → Usage**, by day and by Space and Captain, and you see your own in **Settings → Your usage**. See [Usage and insights](/usage-and-insights).

## Related

- [Threads](/threads)
- [Portals](/portals)
- [Boxes](/boxes)
