# Sandbox isolation and security

Source: https://agenta.ai/docs/self-host/agent-execution/sandbox-isolation-and-security

Agenta runs agent code in a sandbox. A self-hosted deployment picks the sandbox provider: a
**Daytona** cloud sandbox, or a **local** run inside the runner container. The two give different
isolation, so the choice decides whether it is safe to let other people run agents on your
deployment.

Daytona isolates every run. Local runs do not isolate agents from each other or from the runner.
Enable providers with `AGENTA_RUNNER_ENABLED_SANDBOX_PROVIDERS`; see
[Runner and sandbox configuration](https://agenta.ai/docs/self-host/configuration.md#agent-runner) for the syntax
and [Run agents in a cloud sandbox (Daytona)](https://agenta.ai/docs/self-host/agent-execution/daytona.md) for the Daytona
setup.

## Daytona

### The boundary

Each run gets its own cloud sandbox: a separate machine with its own filesystem, processes, and
environment. Agent code in a Daytona run cannot read the runner container's filesystem, its
process environment, or the working directory of another run.

### What crosses into a Daytona sandbox

| Value | Crosses in |
|---|---|
| The model key for the run | No, by default. The sandbox holds a placeholder. |
| An HTTP MCP server's credential or header | No, by default. The sandbox holds a placeholder. |
| A model credential a provider SDK signs with locally | Yes. Today that means the AWS access keys behind Bedrock and the Google service account credentials behind Vertex AI. |
| The run's own working directory | Yes, mounted from the durable store. |
| The drives its configuration lists | Yes, mounted from the durable store, when the run's person or key may use each drive. The storage credentials for each drive reach only that drive, and only allow reads for a drive with `"read"` access. |
| The runner's Daytona API key | No. It stays on the runner. |
| The runner's other environment variables | No. |
| A mounted personal subscription login | No. It never leaves the runner container. |

The runner stores each hidden key as a Daytona Secret restricted to the one hostname that key
authenticates against, and Daytona substitutes the real value into outbound requests to that host.
The model call and the MCP call still work, and a request to any other host carries only the
placeholder. This needs a Daytona API key that may manage Secrets, and it can be switched off. See
[Hiding API keys from the sandbox](https://agenta.ai/docs/self-host/configuration.md#hiding-api-keys-from-the-sandbox).

### What Daytona runs share with each other

Nothing by default. Each run gets its own sandbox, so one user's agent cannot see another user's
agent, its files, or its model key. Sandboxes are reused across the turns of one session only. A
drive that two agents list is the exception: both sandboxes mount the same files, because the
configuration asks for it. Sandbox isolation does not stop access to a drive the configuration
lists.

### When to use it

Use Daytona when more than one person can start runs on the deployment, or when the deployment is
reachable by people you do not fully trust. See
[Run agents in a cloud sandbox (Daytona)](https://agenta.ai/docs/self-host/agent-execution/daytona.md).

## Local runs

### The boundary

A local run executes the harness inside the runner container. The container is a boundary against
the host: agent code cannot read files, environment variables, or executables outside the
container unless you mounted them into it. Mounting a host directory into the runner (a repository
worktree, a subscription login) puts it inside that boundary and inside reach of every local run.

### What crosses into a local run

| Value | Crosses in |
|---|---|
| The model key for the run | Yes. The harness needs it to call the model. |
| An HTTP MCP server's credential or header | Yes. |
| The run's own working directory | Yes. |
| The runner container's environment | Yes, including `AGENTA_RUNNER_TOKEN` and, when it is set, `AGENTA_RUNNER_DAYTONA_API_KEY`. |
| Anything you mounted into the runner container | Yes, including a personal subscription login. |
| Anything on the host you did not mount | No. |

Hiding keys behind Daytona Secrets does not apply here. The harness runs inside the runner
container, so its keys stay inside your own deployment instead of travelling to a third party.

### What local runs share with each other

Every local run executes in the same runner container. Agents in that container share its
filesystem, so one agent can read the working directory of another agent running at the same time.
They also share the container's environment and its mounts.

:::warning Local runs are not isolated from each other
On a multi-user deployment, one user's agent can read another user's agent files, the runner's
environment variables (including the Daytona API key and the runner token), and any credential you
mounted into the runner. Enable `daytona` for multi-user deployments.
:::

### When to use it

Use local runs on a deployment you run for yourself or for a team that already trusts each other
with the same data. They need no cloud account, and they are the only runs that can authenticate a
harness with a [personal subscription login](https://agenta.ai/docs/self-host/use-your-own-subscription.md). Constrain what
an agent may do inside the container with the agent's own tool permissions. See
[Run agents locally](https://agenta.ai/docs/self-host/agent-execution/run-agents-locally.md).

## Next

- [Run agents in a cloud sandbox (Daytona)](https://agenta.ai/docs/self-host/agent-execution/daytona.md) enables Daytona.
- [Run agents locally](https://agenta.ai/docs/self-host/agent-execution/run-agents-locally.md) configures local runs.
- [Runner and sandbox configuration](https://agenta.ai/docs/self-host/configuration.md#agent-runner) lists every variable.
