You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6ea6db5
Browse filesBrowse the repository at this point in the historyBrowse files
feat(sandbox): add boxd as a remote sandbox provider
Adds a boxd adapter next to E2B and Daytona. It mirrors the Daytona
adapter: runtime dependency strategy, one snapshot per sandbox kind, a
wall-clock lifetime, and kill() deletes the machine. Machines are
created isolated.
BOXD_FUNCTION_SNAPSHOT takes a version-pinned <snapshot>@<version> ref.
The adapter checks the version the machine was restored from and fails
closed on any other.
Includes the Function snapshot builder, capability and sim-setup
registration, billing rates, the conformance suite run three ways, a
gated live smoke test, and self-hosting docs.
Copy file name to clipboardExpand all lines: apps/docs/content/docs/platform/self-hosting/architecture.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ Sim runs an app, a realtime server, PostgreSQL, Redis, and a scheduler. This pag
25
25
26
26
The Next.js app serves the workflow builder, API routes, and workflow orchestration. Local JavaScript runs in Node child workers using isolated-vm inside the app container. The app and those workers share the container's memory budget. The Helm chart requests 4 GiB and limits the app to 8 GiB; `docker-compose.prod.yml` sets an 8 GB memory limit without a reservation.
27
27
28
-
E2Bor Daytona moves supported code execution to a remote sandbox. `TRIGGER_DEV_ENABLED` routes asynchronous jobs to Trigger.dev; the default deployment uses database-backed jobs. See [Sandboxes](/platform/self-hosting/sandboxes) for the provider and image requirements.
28
+
E2B, Daytona, or boxd moves supported code execution to a remote sandbox. `TRIGGER_DEV_ENABLED` routes asynchronous jobs to Trigger.dev; the default deployment uses database-backed jobs. See [Sandboxes](/platform/self-hosting/sandboxes) for the provider and image requirements.
29
29
30
30
Any replica can serve files once shared object storage is configured. Before adding replicas, configure storage, Redis, and database connection capacity as described in [Scaling and high availability](/platform/self-hosting/scaling).
|`DAYTONA_API_KEY`| Daytona API key (used when `SANDBOX_PROVIDER=daytona`) |
186
186
|`E2B_FUNCTION_TEMPLATE_ID`| Immutable `<template>:<build-id>` ref for the Function base image. Required for E2B; a mutable tag is refused |
187
187
|`E2B_FUNCTION_TEMPLATE_GENERATION`| Monotonic release generation printed by the same build. Required for E2B |
188
188
|`DAYTONA_FUNCTION_SNAPSHOT_ID`| Immutable snapshot **ID** (not a name) for the Function base image. Required for Daytona |
189
-
|`E2B_PI_TEMPLATE_ID` / `DAYTONA_PI_SNAPSHOT_ID`| The image Pi runs on. Separate from the Function base — configuring the provider and Function image alone leaves Pi failing closed |
189
+
|`BOXD_API_KEY`| boxd API key (used when `SANDBOX_PROVIDER=boxd`) |
190
+
|`BOXD_REGION` / `BOXD_ORG`| Region and org for boxd sandboxes. The region must hold the snapshots; the org defaults to the key's |
191
+
|`BOXD_FUNCTION_SNAPSHOT`| Version-pinned `<snapshot>@<version>` ref for the Function base image. Required for boxd; an unpinned name is refused |
192
+
|`E2B_PI_TEMPLATE_ID` / `DAYTONA_PI_SNAPSHOT_ID` / `BOXD_PI_SNAPSHOT`| The image Pi runs on. Separate from the Function base — configuring the provider and Function image alone leaves Pi failing closed |
190
193
|`SANDBOXES_ENABLED`| Enable custom sandbox entitlement through deployment configuration where supported; see the [enterprise guide](/platform/enterprise/self-hosted) for billing-mode requirements. Not sufficient on its own — a provider key **and** an immutable Function base must also be configured. The Function block's Sandbox selector appears once the server confirms both |
191
194
|`IVM_MAX_EXECUTIONS_PER_WORKER`| Executions before an isolated-vm worker is recycled |
192
195
|`IVM_MAX_BROKERS_PER_EXECUTION`| Host-call brokers per execution |
Copy file name to clipboardExpand all lines: apps/docs/content/docs/platform/self-hosting/index.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,7 @@ The editor and execution engine run within your deployment. Configure these depe
65
65
| Agent blocks | A model provider key or a self-hosted compatible endpoint such as Ollama, vLLM, LM Studio, or LiteLLM. |
66
66
| Chat |`COPILOT_API_KEY` for the default Sim service. Set `NEXT_PUBLIC_CHAT_DISABLED=true` to hide Chat when it is not configured. |
67
67
| OAuth integrations | Your provider app and credentials for each OAuth service you use. API-key integrations take keys in their blocks. |
68
-
| Remote Function or Pi execution | An E2Bor Daytona provider key and the appropriate immutable image. Function and Pi use separate images. |
68
+
| Remote Function or Pi execution | An E2B, Daytona, or boxd provider key and the appropriate immutable image. Function and Pi use separate images. |
69
69
70
70
Plain JavaScript without `import` or `require` runs in isolated-vm within Node child workers in the app container. Python, Shell, imported JavaScript, custom Function Sandboxes, and file-path or sandbox execution require remote sandbox configuration. See [Sandboxes](/platform/self-hosting/sandboxes).
Copy file name to clipboardExpand all lines: apps/docs/content/docs/platform/self-hosting/reference-architectures.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ The chart bundles PostgreSQL and Redis for evaluation. For production, decide ho
24
24
| Ingress | Off | You install the controller; the chart renders the Ingress |
25
25
| TLS certificates | Off | You provision them |
26
26
| Remote sandbox | Off | Required for Python, Shell, and imported JavaScript — a provider **and** an immutable Function image. See [Sandboxes](/platform/self-hosting/sandboxes)|
27
-
| Pi execution | Off | A separate image from the Function one, set with `E2B_PI_TEMPLATE_ID` (a template name, an alias, or an immutable `<template>:<build-id>` ref) or `DAYTONA_PI_SNAPSHOT_ID`. Unlike the Function base these are not format-validated, but execution still fails closed when unset |
27
+
| Pi execution | Off | A separate image from the Function one, set with `E2B_PI_TEMPLATE_ID` (a template name, an alias, or an immutable `<template>:<build-id>` ref) `DAYTONA_PI_SNAPSHOT_ID`, or `BOXD_PI_SNAPSHOT`. Unlike the Function base these are not format-validated, but execution still fails closed when unset |
28
28
| PII redaction, Ollama, telemetry collector | Off | Optional, off unless you enable them |
29
29
30
30
The bundled Postgres uses a 10 Gi `ReadWriteOnce` volume and is intended for evaluation. Moving to managed Postgres is the single most important production change.
Copy file name to clipboardExpand all lines: apps/docs/content/docs/platform/self-hosting/sandboxes.mdx
+43-4Lines changed: 43 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ Selecting a sandbox without a configured provider is refused with 503. File-path
23
23
24
24
Run these repository scripts from a checkout with dependencies installed (`bun install` at the repository root). Supply provider credentials to the build environment. Custom workspace sandboxes layer their packages on this base.
[boxd](https://boxd.sh?ref=sim) runs each sandbox as an isolated microVM restored from a snapshot. Like Daytona, the builder reconstructs packages from an accepted E2B manifest, so complete the E2B build and verification first. It boots a build machine in the region you pick, installs the Function surface, saves the snapshot, and deletes the build machine. Snapshots stay in their region, so build in the region you will run in.
79
+
80
+
```bash
81
+
BOXD_API_KEY=... \
82
+
BOXD_REGION=nyc \
83
+
bun run apps/sim/scripts/build-function-boxd-snapshot.ts \
Function images must be immutable. `E2B_FUNCTION_TEMPLATE_ID` requires an exact `<template>:<build-id>` reference with a UUID build ID, plus the positive `E2B_FUNCTION_TEMPLATE_GENERATION` printed by that build. `DAYTONA_FUNCTION_SNAPSHOT_ID` requires a snapshot UUID, not a mutable name. Missing or invalid values do not fall back to a shell image.
105
+
Function images must be immutable. `E2B_FUNCTION_TEMPLATE_ID` requires an exact `<template>:<build-id>` reference with a UUID build ID, plus the positive `E2B_FUNCTION_TEMPLATE_GENERATION` printed by that build. `DAYTONA_FUNCTION_SNAPSHOT_ID` requires a snapshot UUID, not a mutable name. `BOXD_FUNCTION_SNAPSHOT` requires a `<snapshot>@<version>` pin: re-saving a boxd snapshot under the same name creates a new version, and Sim refuses to run on a machine restored from any other version. Missing or invalid values do not fall back to a shell image.
80
106
</Callout>
81
107
82
108
## Configure the deployment
83
109
84
110
Apply the verified runtime values through the deployment's environment or secret mechanism:
These values do not replace `E2B_FUNCTION_TEMPLATE_ID`or `DAYTONA_FUNCTION_SNAPSHOT_ID`. Shell, Function, document, and Pi images have separate package contracts and release cadences. Pi also needs `E2B_PI_TEMPLATE_ID`or `DAYTONA_PI_SNAPSHOT_ID`; `E2B_ENABLED` reveals the Pi cloud modes but does not supply that image.
176
+
These values do not replace `E2B_FUNCTION_TEMPLATE_ID`, `DAYTONA_FUNCTION_SNAPSHOT_ID`, or `BOXD_FUNCTION_SNAPSHOT`. Shell, Function, document, and Pi images have separate package contracts and release cadences. Pi also needs `E2B_PI_TEMPLATE_ID`, `DAYTONA_PI_SNAPSHOT_ID`, or `BOXD_PI_SNAPSHOT`; `E2B_ENABLED` reveals the Pi cloud modes but does not supply that image.
Copy file name to clipboardExpand all lines: apps/docs/content/docs/platform/self-hosting/security.mdx
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -178,6 +178,7 @@ Workflows can execute user-authored JavaScript and Python. Know which sandbox yo
178
178
| **isolated-vm** (default) | none | V8 isolate in a Node child worker inside the app container. The worker shares the container's network namespace and OS/filesystem context. JavaScript only. |
179
179
| **E2B** | `E2B_ENABLED=true`, `E2B_API_KEY`, `E2B_FUNCTION_TEMPLATE_ID`, `E2B_FUNCTION_TEMPLATE_GENERATION` | Remote sandbox per execution; requires outbound access to E2B. Review the provider's isolation and network configuration. |
| **boxd** | `SANDBOX_PROVIDER=boxd`, `BOXD_API_KEY`, `BOXD_FUNCTION_SNAPSHOT` | Remote microVM per execution, created isolated: no access to the org's other machines and no metadata endpoint. |
181
182
182
183
Python, Shell, JavaScript with external imports, and tooling-dependent blocks
183
184
require a remote sandbox provider and, on a billing-disabled self-host, the sandbox
@@ -191,6 +192,7 @@ no remote provider is configured.
191
192
- `E2B_FUNCTION_TEMPLATE_ID`must be `<template>:<build-id>`, where the build id is a UUID. A human-readable tag is rejected because E2B lets tags be reassigned.
192
193
- `E2B_FUNCTION_TEMPLATE_GENERATION`must be a positive integer release generation.
193
194
- `DAYTONA_FUNCTION_SNAPSHOT_ID`must be the snapshot **ID** (a UUID), not the snapshot name — Daytona accepts a name anywhere it accepts an ID, and only the ID is immutable.
195
+
- `BOXD_FUNCTION_SNAPSHOT`must pin a version, `<snapshot>@<version>`. boxd keeps only the latest version of a snapshot name, so Sim checks the version the machine was restored from and refuses any other.
194
196
195
197
Without valid provider credentials and the required Function image, code that needs a remote sandbox fails with a configuration error. Verify readiness before enabling its browser controls.
# DAYTONA_FUNCTION_SNAPSHOT_ID=<snapshot-uuid> # Copy the immutable ID printed by the Daytona builder
63
63
# DAYTONA_SHELL_SNAPSHOT_ID= # Mothership shell snapshot ref, required when Mothership runs code on Daytona
64
+
#
65
+
# boxd
66
+
# Build from an accepted E2B parity manifest with: bun run apps/sim/scripts/build-function-boxd-snapshot.ts --name <name> --parity-manifest <path>
67
+
# SANDBOX_PROVIDER=boxd
68
+
# BOXD_API_KEY=
69
+
# BOXD_REGION=nyc # Region of the snapshots ('fra' or 'nyc')
70
+
# BOXD_FUNCTION_SNAPSHOT=<snapshot>@<version> # Copy the version-pinned ref printed by the boxd builder
71
+
# BOXD_SHELL_SNAPSHOT= # Mothership shell snapshot ref, required when Mothership runs code on boxd
64
72
65
73
# Security (Required)
66
74
ENCRYPTION_KEY=your_encryption_key# Use `openssl rand -hex 32` to generate, used to encrypt environment variables and connected-account OAuth tokens (ENCRYPT_ACCOUNT_TOKENS=false opts the tokens out)
0 commit comments