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

# Set up sandboxes

> Start from a Tilde sandbox image or build your own, create a sandbox blueprint, and give an agent a sandbox.

Setting up sandboxes takes four parts: a provider connection, a template, a blueprint, and the agent's sandbox setting. Read the [Sandboxes overview](https://trytilde.ai/docs/sandboxes/overview.md) first.

## Before you start

* **A provider connection.** Add an E2B or Modal connection from the Tilde catalog, or from the **New blueprint** menu. See [Connect a managed tool](https://trytilde.ai/docs/tools/management.md#connect-a-managed-tool).
* **A reachable gateway.** The VM dials out to the gateway's runtime URL, `ENGINE_RUNTIME_PUBLIC_URL`, from the provider's cloud. If you self-host, expose the runtime route to it. See [Network exposure](https://trytilde.ai/docs/security/overview.md#network-exposure).
* **A direct or Lambda agent.** Sidecar agents cannot use sandbox tools.

## Build a template

Your sandboxes start from an image with anything your agent's work needs, such as Git and language toolchains. The image must be Linux, with the `tilde` CLI on the `PATH`. You do not set a start command.

### Tilde sandbox images

Tilde publishes three public Debian images for `linux/amd64` and `linux/arm64`. Each has the `tilde` CLI of the same release, and common agent tools: Git, Git LFS, the GitHub CLI `gh`, `jq`, ripgrep, `fd`, `curl`, and build tools.

| Image | Adds |
| - | - |
| `ghcr.io/trytilde/sandbox-debian-node` | Node.js 24, with npm, pnpm, and Yarn. |
| `ghcr.io/trytilde/sandbox-debian-python` | Python 3, with pip, venv, and uv. |
| `ghcr.io/trytilde/sandbox-debian-full` | Both, plus Docker Engine and Docker Compose. |

Each image is tagged with its Tilde release, such as `5.2.0`, its minor version, such as `5.2`, and `latest`. Pin the release your gateway runs. The images run as root, which [GitHub egress](https://trytilde.ai/docs/sandboxes/github-egress.md) needs.

On Modal, enter the image reference, such as `ghcr.io/trytilde/sandbox-debian-node:5.2.0`, as the blueprint's **Container image**. On E2B, build an E2B template from it.

> [!NOTE]
>
> In `sandbox-debian-full`, the first `docker` command starts the Docker daemon. Docker needs a VM that can run containers, with nested virtualization, such as an E2B sandbox. It does not run on Modal, whose gVisor runtime does not support it.

### Build your own image

Install the `tilde` CLI in any Linux image:

```dockerfile Dockerfile theme={"system"}
FROM ubuntu:24.04

RUN apt-get update \
 && apt-get install -y --no-install-recommends ca-certificates curl git \
 && rm -rf /var/lib/apt/lists/*

# The tilde CLI, on the PATH for every user. Pin the release your gateway runs.
# Run as root if the blueprint uses GitHub egress: the sandbox process writes /etc/gitconfig.
RUN curl -fsSL https://trytilde.ai/install.sh \
  | TILDE_VERSION=<version> TILDE_INSTALL_DIR=/usr/local/bin TILDE_NO_MODIFY_PATH=1 sh
```

* **E2B:** build the Dockerfile into an [E2B template](https://e2b.dev/docs), and note its ID. The sandbox process logs to `~/.tilde/sandbox.log`, the first place to look when a sandbox fails to register.
* **Modal:** push the image to a registry, or use an image already in Modal, such as `im-…`. Modal must be able to pull it without credentials, so a registry image must be public.

## Create a blueprint

**1. Choose a connection**

Open **Sandboxes**, and select **New blueprint**. Select **Use existing connection** to choose a ready E2B or Modal connection, or **Add new connection** to set one up first.

**2. Name it, and enter the template**

Enter a name. For E2B, enter the **E2B template ID**. For Modal, enter the **Container image**.

**3. Choose a reuse mode**

Under **Reuse**, the default, **Per session**, gives every conversation its own sandbox. Read [Reuse modes](https://trytilde.ai/docs/sandboxes/reuse-modes.md) before you choose another. Every other mode lets data cross conversations.

**4. Configure the rest**

Keep the default [timings](#timings), or change them. Then add [environment variables](#environment-variables), [blueprint tools](#blueprint-tools), and, in Cloud and Enterprise, [egress](#egress).

Creating a blueprint launches nothing. Tilde launches sandboxes when agents that use it are invoked.

### Timings

Set these when you create the blueprint, or later on its **Settings** tab.

| Setting | Range | Default | What it does |
| - | - | - | - |
| **Sleep after (minutes)** | 1 to 1,440 | 10 | Puts a running sandbox to sleep once nobody has used it for this long. |
| **Terminate after (hours)** | 1 to 720 | 168, or 7 days | Terminates a sandbox once nobody has used it for this long. It must be at least the sleep time. |
| **Connect timeout (seconds)** | 10 to 600 | 120 | How long a launch or wake waits for `tilde sandbox connect` to connect. If it has not connected by then, the invocation fails. |

Changes apply to existing sandboxes within a minute.

### Environment variables

Add variables on the blueprint's **Environment** tab. Tilde exports them in every shell in the VM.

* Names that start with `TILDE_` are reserved.
* Values are write-only. Tilde encrypts them at rest, and never shows them again. To change one, set it again.
* A running sandbox picks up changes the next time its process connects, for example after it wakes. New shells then see them.

> [!WARNING]
>
> Every process in the sandbox can read its environment, and so can the agent, through `sandbox.exec`. Use environment variables for configuration, not secrets. For credentials, use [GitHub egress](https://trytilde.ai/docs/sandboxes/github-egress.md) or [credential vending](https://trytilde.ai/docs/sandboxes/credential-vending.md).

### Blueprint tools

A blueprint's **Tools** tab works like an agent's. Add managed providers, MCP servers, and [Tilde tool servers](https://trytilde.ai/docs/tools/overview.md#tilde-tool-servers), and switch on the tools processes in the VM may call. See [Choose an agent's tools](https://trytilde.ai/docs/tools/management.md#choose-an-agents-tools).

Processes call each tool by the source's slug and the tool name, such as `creds.git_credentials`, through the [local API or the CLI](https://trytilde.ai/docs/sandboxes/cli.md). The agent does not receive blueprint tools.

### Egress CLOUDENTERPRISE

A blueprint's **Egress** tab lists the connections its sandboxes reach through the gateway, such as GitHub. See [GitHub egress](https://trytilde.ai/docs/sandboxes/github-egress.md).

## Give an agent a sandbox

**1. Choose the blueprint**

Open the agent in the Agent Registry, and select **Capabilities**. In the **Sandbox** row, choose the blueprint. An agent has at most one. The change saves at once.

**2. Allow the sandbox tools**

Make sure the agent's `tools.invoke` capability allows the sandbox tools it should use, such as `sandbox.exec`. The **Tools** tab now lists them under **Sandbox · `<blueprint name>`**.

From the next invocation, Tilde launches or wakes a sandbox before the agent runs.

To take the sandbox away, clear the **Sandbox** row, and confirm **Remove sandbox**. Removing or changing an agent's sandbox terminates its sandboxes. Shared sandboxes are terminated once no agent uses the blueprint.

## Manage sandboxes

The blueprint's **Sandboxes** tab lists every sandbox launched from it, with its status (**Starting**, **Running**, **Sleeping**, or **Failed**), when it was last used, and its last error. Tilde cleans up failed sandboxes after one hour.

Select **Terminate** to destroy a sandbox. Its files are lost. The next invocation that needs it launches a new one.

Edit a blueprint on its **Settings** tab:

* A new template applies only to sandboxes launched afterwards.
* A new connection or reuse mode terminates the blueprint's sandboxes, and their files are lost.
* You cannot delete a blueprint while an agent uses it. Deleting it terminates its sandboxes.

## Who can manage sandboxes CLOUDENTERPRISE

Sandbox blueprints follow [resource access](https://trytilde.ai/docs/operator-access.md#resource-access), like connections and tool servers. A blueprint belongs to a team and its creator. Its sandboxes, environment variables, tools, and egress grants follow it.

* Seeing a blueprint needs `view`. Changing it, or terminating its sandboxes, needs `edit`.
* Creating a blueprint, or adding an egress grant, also needs `view` on the connection.
* Giving an agent a sandbox needs `edit_sandbox` on the agent, and `view` on the blueprint.

`edit_sandbox` is separate from `edit_tools`. A sandbox runs any command the agent chooses, in a VM that holds the blueprint's environment variables. See [Operator access](https://trytilde.ai/docs/operator-access.md) for detail.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.