# Sandboxes

> Choose where agent code runs, what network it can reach, which image it starts from and how much of the server it may use.

Source: https://werker.cloud/docs/sandboxes (updated 2026-12-02)

Code that agents write runs in a sandbox made for that run and deleted
after it. An instance administrator sets this up in **Admin →
Sandboxes**. What a sandbox protects against, and what it does not, is
in [security](https://werker.cloud/security).

## Choosing a provider

|                   | Your Docker host (gVisor)      | Daytona                          | Docker Cloud Sandboxes               |
| ----------------- | ------------------------------ | -------------------------------- | ------------------------------------ |
| Runs on           | Your own server                | Daytona's service                | Docker's service                     |
| You need          | gVisor, which the install adds | A Daytona API key                | A Docker ID and access token         |
| Git               | Through Werker's gateway       | With a GitHub App connection     | With a GitHub App connection         |
| Run it (previews) | No                             | Yes                              | Yes                                  |
| CPU and memory    | As set                         | Rounded up to whole CPUs and GiB | The smallest of five sizes that fits |

The install adds gVisor on Debian and Ubuntu; on other distributions
install it first. To use a hosted provider, choose it under "Sandboxes
run on", press **Save**, then add its key. The key is sealed when
saved and never shown again.

- **Daytona:** Git needs a key with `manage:secrets`. Werker turns
  Daytona's auto-stop off, so if every worker stays down sandboxes
  keep running until you delete them in Daytona.
- **Docker Cloud Sandboxes:** make the token with "Allow Cloud
  Sandboxes access". Werker stops a sandbox 24 hours after it starts.

## Network

Daytona and Docker Cloud Sandboxes default to **Open**. Your Docker
host defaults to **No network**.

## Images

A sandbox starts from an image, which decides what is installed. List
the ones you want under Images and pick a default (`node:22-alpine` to
begin with). Werker starts each once to see which languages and tools
it has, and then picks one that suits the work. Press **Probe again**
after rebuilding a tag.

## Limits

On your Docker host and Daytona, set CPUs, memory and processes for
each sandbox; empty means no limit. Daytona ignores the process limit.
Docker Cloud Sandboxes has a **Size** menu instead. **Sandboxes at
once** caps how many run together. On your Docker host, Admin shows
how many fit once memory per sandbox is set.

**Stop sandboxes of runs waiting for input** is on by default: a
waiting run's sandbox is stopped and kept, because its files are the
work so far. Workers remove sandboxes left over from finished runs
every 10 minutes.

## What has not been tested

- The allowed-sites network, and CPU and memory limits, on Daytona.
- Git on the hosted providers was checked with scripts against both on
  2026-11-28, not in a Werker run on Daytona.

How each provider is driven is in the
[engineering docs](engineering/sandboxes.md).
