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

# DeerFlow

> Run each DeerFlow thread's sandbox on its own isolated boxd machine, with the thread's files restored and its outputs copied back.

![The DeerFlow deer and wordmark inside the boxd card.](https://mintcdn.com/azin/knk60xx_cez0iGac/images/boxd-x-deer-flow.png?fit=max\&auto=format\&n=knk60xx_cez0iGac\&q=85\&s=ec0565e6bd5262aeb6a912f3cd187f6d)

[DeerFlow](https://github.com/bytedance/deer-flow) is ByteDance's open-source super agent harness. It plans, spawns sub-agents, keeps memory, and runs its shell and file tools in a sandbox that you pick in `config.yaml`.

`BoxdSandboxProvider` makes that sandbox a boxd machine. Each user and thread gets its own isolated machine. It is in DeerFlow's main branch ([pull request](https://github.com/bytedance/deer-flow/pull/8314)) and not in a tagged release yet, so install DeerFlow from main.

## Set up

**1. Clone DeerFlow**

```bash theme={"theme":"github-dark"}
git clone https://github.com/bytedance/deer-flow.git
cd deer-flow
```

`make setup` writes `config.yaml` and `.env` with a model for the agent. Or copy `config.example.yaml` to `config.yaml` and add a model yourself.

**2. Create an API key**

```bash theme={"theme":"github-dark"}
boxd auth keys create deer-flow --org <your-org>
```

Machines are created and billed in the key's organization. Put the key in `.env`, with `UV_EXTRAS=boxd` so `make dev` keeps the boxd SDK installed when it syncs dependencies:

```dotenv theme={"theme":"github-dark"}
BOXD_API_KEY=bxd_...
UV_EXTRAS=boxd
```

**3. Pick the provider**

In `config.yaml`, replace the `sandbox:` section:

```yaml theme={"theme":"github-dark"}
sandbox:
  use: deerflow.community.boxd_sandbox:BoxdSandboxProvider
  # org: my-org                # optional; the key's own org when omitted
  # region: fra                # optional; fra or nyc
  # vcpu: 2                    # optional; 1, 2, 4 or 8
  # from_snapshot: my-snapshot # optional; start machines from a snapshot
  # idle_timeout: 600          # warm seconds before a machine is deleted
```

An unknown region or a size boxd does not offer fails when the provider starts, before any machine is created.

**4. Start DeerFlow**

```bash theme={"theme":"github-dark"}
make install
make dev
```

`make dev` reads `UV_EXTRAS` from `.env` and installs the boxd SDK with the other dependencies. Every thread's shell commands and file tools now run on its own machine.

## Try it without a model

The agent calls the provider through DeerFlow's sandbox interface. This script does the same with no model, so you can check the setup. Save it as `backend/boxd_demo.py`:

```python theme={"theme":"github-dark"}
from deerflow.config.paths import get_paths
from deerflow.sandbox.sandbox_provider import get_sandbox_provider, shutdown_sandbox_provider

provider = get_sandbox_provider()
sandbox_id = provider.acquire("demo-thread", user_id="demo-user")
sandbox = provider.get(sandbox_id)
print("machine:", sandbox.machine_id)

print(sandbox.execute_command("uname -sr && nproc && python3 --version"))
sandbox.write_file("/mnt/user-data/workspace/sum.py", "print(sum(range(101)))\n")
print(sandbox.execute_command("python3 /mnt/user-data/workspace/sum.py > /mnt/user-data/outputs/sum.txt"))

provider.release(sandbox_id)  # copies outputs back, parks the machine in the warm pool
outputs = get_paths().sandbox_outputs_dir("demo-thread", user_id="demo-user")
print("outputs/sum.txt:", (outputs / "sum.txt").read_text().strip())

shutdown_sandbox_provider()  # deletes the machine
```

```bash theme={"theme":"github-dark"}
cd backend
uv sync --all-packages --extra boxd
uv run python boxd_demo.py
```

We ran it against boxd from DeerFlow's main branch on 18 November 2026. Each run took 5 to 8 seconds, from creating the machine to deleting it:

```text theme={"theme":"github-dark"}
machine: <machine-id>
Linux 6.18.0+
2
Python 3.12.3

(no output)
outputs/sum.txt: 5050
```

The file the script wrote to `/mnt/user-data/outputs` on the machine is now in the thread's output directory in DeerFlow.

## What each thread gets

* **Its own machine.** Machines are created isolated: no private network, and no boxd credentials inside. The API key stays in DeerFlow's Gateway, and per-call secrets travel as the command's environment, not in the command text.
* **Its files.** A new machine receives the thread's uploads, workspace, outputs, and skills before the agent gets it, at the same `/mnt/user-data` paths the agent sees. Each transfer is one archive of at most 5,000 files and 128 MiB.
* **Its outputs back.** At the end of a turn, DeerFlow copies `/mnt/user-data/outputs` back to the thread's output directory, up to 2,000 files and 512 MiB in 120 seconds.
* **A warm pool.** After a turn the machine waits in DeerFlow's warm pool. Only the same thread can take it back, after a health check. `idle_timeout` (600 seconds by default) deletes it after that. A later turn gets a new machine with the thread's files restored, so anything outside `/mnt/user-data` is gone then.
* **Command deadlines.** Commands run through `bash -lc`. One that runs past its timeout ends inside the machine with exit code 124 and keeps its partial output.
* **Sleep and wake.** A machine in standby or hibernation wakes on the next call. Set `auto_suspend_timeout` to put idle machines in [standby](https://docs.boxd.sh/guides/suspend-resume.md) sooner.
* **Your tools.** Set up one machine with the tools your agents need, save it as a [snapshot](https://docs.boxd.sh/guides/snapshots.md), and name it in `from_snapshot`. New machines start from it.

DeerFlow deletes its machines on shutdown. A Gateway that crashes can't, so each machine carries the labels `deer-flow: sandbox` and `deer-flow-scope: <scope id>`. Look for these labels to find machines a crashed Gateway left behind.

## Read more

* [The boxd sandbox provider](https://github.com/bytedance/deer-flow/blob/main/backend/packages/harness/deerflow/community/boxd_sandbox/README.md) in DeerFlow's repo, with every option and the full lifecycle
* [Sandbox configuration](https://github.com/bytedance/deer-flow/blob/main/backend/docs/CONFIGURATION.md) in DeerFlow's docs
* [Sandboxes on boxd](https://docs.boxd.sh/use-cases/sandboxes.md)


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