π This page is for engineering teams self-hosting their own Lightdash instance. On Lightdash Cloud, sandboxes are fully managed for you β thereβs nothing to configure.
What sandboxes are for
Some Lightdash features use an AI agent (Claude Code) that writes and runs code on your behalf. Today thatβs:- AI writeback β the agent edits your dbt project (e.g. adds a metric or dimension),
runs
lightdash compileto validate it, and opens a pull request. - Data app generation β the agent generates and builds a small web app from a prompt.
Sandbox providers
The sandbox backend is pluggable. Lightdash talks to a provider-neutral interface, so the same feature code runs on whichever backend your deployment is configured for. You select the provider with theSANDBOX_PROVIDER environment variable.
More providers (Kubernetes, ECS, microVM-based) are planned, but E2B is the only
supported production backend today.
E2B (production default)
E2B runs each sandbox as a Firecracker microVM in E2Bβs cloud. Itβs the default β if you donβt setSANDBOX_PROVIDER, Lightdash uses E2B.
To use it you need an E2B account and API key, and the agent needs an Anthropic API key:
Local Docker provider (development)
For local development you can run sandboxes as plain Docker containers on your own machine β no E2B account required. This is the recommended way to work on or try the AI features locally. It uses the same images E2B builds, but as plain local Docker images. Two separate images are used (different toolchains), mirroring the two E2B templates:Prerequisites
- Docker running locally, with the daemon reachable from the Lightdash backend.
- S3-compatible object storage configured (locally this is MinIO). Suspended-sandbox snapshots are tarred to object storage so a conversation survives the container being destroyed β see external object storage.
- An Anthropic API key (
ANTHROPIC_API_KEY) for the agent.
Setup
-
Build the local sandbox images (each builds from
sandboxes/<feature>/):These are large (the writeback image bundles dbt, the Lightdash CLI and Claude Code) and only need rebuilding when the sandbox toolchain changes. -
Point Lightdash at the Docker provider:
-
Restart the backend and the scheduler so both pick up the new environment. Data app
generation runs in the scheduler worker, so a stale
SANDBOX_PROVIDERthere will keep it on E2B. (With PM2, a plainrestartreuses the cached env β delete and re-start the processes, or restart with--update-env, to actually reload the env file.)