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

# Sandbox

> Give agents an isolated container on your own servers where they run code, install packages and save files to the report.

A sandbox is an isolated container where an agent runs code for one report. The agent can run Python, Node, Go or shell code there, install packages, keep files between runs, and save the files it produces to the report.

Sandboxes run on Linux servers that you provide. BOW connects to each server over SSH, prepares it, and starts one container per report.

> [!NOTE]
>
> Sandboxes are off until an admin turns them on. Setting them up takes a server, an environment and one switch. See [Turn sandboxes on](#turn-sandboxes-on).

## What agents use a sandbox for

* Processing or converting an uploaded file with a script.
* Work that needs a package the agent has to install.
* Producing a file you asked for: a chart image, a spreadsheet, a document.

A sandbox does not query your connected data. It holds none of your data source credentials, and agents keep using their normal tools for that. A file from the report is in the sandbox only when the agent passes it in.

## How it fits together

| Term | What it is | Where you manage it |
| - | - | - |
| **Compute** | A place sandboxes run: a Linux server with Docker that BOW reaches over SSH | **Settings → Sandbox → Compute** |
| **Environment** | The template a sandbox starts from: image, resources, network policy, scripts, and who may use it | **Settings → Sandbox → Environments** |
| **Sandbox** | One container for one report, created the first time the agent runs code there | **Settings → Sandbox → Sandboxes** |
| **Run** | One execution of code in a sandbox. One run at a time per sandbox | The report's chat, and the sandbox's details |

A report has at most one sandbox. A sandbox belongs to one report and is never shared between reports.

## Who can use sandboxes

Two things must both be true before an agent is offered a sandbox for a person:

1. **The organization switch is on.** An admin turns on **Enable agent sandboxes** under **Settings → Sandbox → Settings**.
2. **The person is allowed.** They hold the **Use Agent Sandbox** permission, and they have been granted at least one enabled environment.

Neither is on by default. Members do not get the permission until an admin adds it to a role, and a new environment is granted to no one.

Setting sandboxes up needs a separate permission, **Manage Sandboxes**. It is kept apart from **Manage settings** on purpose: whoever holds it can make BOW run commands as root on the sandbox servers. See [Roles & permissions](https://docs.bow.ai/users/roles-and-permissions.md).

## Turn sandboxes on

**1. Add and prepare a compute**

Add a Linux server, confirm its identity, bootstrap it and enable it. See [Compute](https://docs.bow.ai/sandboxes/compute.md).

**2. Create or adjust an environment**

BOW creates a **Default** environment for you: Python with common data packages and no network. Edit it or add your own, and choose who may use it. See [Environments](https://docs.bow.ai/sandboxes/environments.md).

**3. Give people the permission**

Add **Use Agent Sandbox** to the roles that should have it, under **Settings → Members → Roles**. It is listed under **Other**.

**4. Turn the switch on**

Under **Settings → Sandbox → Settings**, turn on **Enable agent sandboxes** and save. The page lists what is still missing until a compute is bootstrapped and enabled and an environment is enabled.

![The Sandbox settings tab with sandboxes turned on](https://mintcdn.com/bagofwords/jdi37jk3RbRDCvpb/images/sandboxes/settings-tab.png?fit=max\&auto=format\&n=jdi37jk3RbRDCvpb\&q=85\&s=77f2364bf1d07b108f8e742df0bc14b3)

From then on, people with access can ask an agent in a report to run code. See [Run code in a report](https://docs.bow.ai/sandboxes/run-code.md).

## What a sandbox keeps, and what it loses

| | Kept between runs | Survives the sandbox being deleted or recreated |
| - | - | - |
| Files under `/workspace/outputs` | Yes | Yes. They are saved to the report after each run |
| Other files in `/workspace`, installed packages | Yes | Only if a [snapshot](https://docs.bow.ai/sandboxes/manage.md#snapshots) was taken |
| Running programs | Until the sandbox is stopped | No |

Treat everything outside `/workspace/outputs` as a cache. Sandboxes are stopped when idle and deleted after a period of disuse. See [Manage sandboxes](https://docs.bow.ai/sandboxes/manage.md).

## Related

* [Compute](https://docs.bow.ai/sandboxes/compute.md) — add and prepare the servers sandboxes run on.
* [Environments](https://docs.bow.ai/sandboxes/environments.md) — images, limits, network policy, scripts, volumes and access.
* [Run code in a report](https://docs.bow.ai/sandboxes/run-code.md) — what people see in the chat.
* [Manage sandboxes](https://docs.bow.ai/sandboxes/manage.md) — the list of sandboxes, lifetimes, limits and snapshots.
* [Network and security](https://docs.bow.ai/sandboxes/network-and-security.md) — isolation, outbound access and corporate networks.


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