apps/docs/src/content/docs/en/guides/openclaw/openclaw-sdk-sandbox.mdx
import { Image } from 'astro:assets'
import openclawSandbox from '../../../../../assets/docs/images/openclaw-sandbox.gif'
This guide shows how to run OpenClaw inside a Daytona sandbox using the Daytona SDK. The script automatically creates and configures a sandbox with OpenClaw and provides an authenticated preview URL for using OpenClaw in the browser.
When you run the script, it creates a Daytona sandbox, starts the OpenClaw gateway inside it, and prints a preview link for the dashboard:
$ npm start
Creating Daytona sandbox...
Configuring OpenClaw...
Starting OpenClaw...
(Ctrl+C to shut down and delete the sandbox)
š Secret link to Control UI: https://18789-xxxx.proxy.daytona.works?token=...
Open the provided link in your browser to connect to the OpenClaw Control UI. This link contains a configuration token, and anyone can use it to connect to OpenClaw without device approval.
<Image src={openclawSandbox} alt="OpenClaw Control UI running in a Daytona sandbox" width={600} style="max-width: 100%; height: auto; margin: 1rem 0;" />
You can use the Control UI to chat with your assistant, configure Telegram and WhatsApp, and manage sessions. When you exit the script (Ctrl+C), the sandbox will not be deleted unless sandbox persistence is disabled.
Clone the Daytona repository and go to the example directory:
git clone https://github.com/daytonaio/daytona.git
cd daytona/guides/typescript/openclaw
Get your API key from the Daytona Dashboard.
Copy .env.example to .env and add your Daytona API key:
DAYTONA_API_KEY=your_daytona_key
A default OpenClaw configuration is stored in openclaw.json. You can customize it according to the configuration reference. You can also add additional environment variables to .env.sandbox (e.g. ANTHROPIC_API_KEY for Claude) and they will be loaded into the sandbox.
:::note[Node.js] Node.js 18 or newer is required. :::
Install dependencies and run:
npm install
npm start
The script creates the sandbox, starts the OpenClaw gateway, and prints a secret link with the token in the URL.
DAYTONA_SNAPSHOT (e.g. daytona-medium) and loads env vars from .env.sandbox.openclaw.json is merged with built-in config and written to ~/.openclaw/openclaw.json in the sandbox.OPENCLAW_PORT via process execution.?token=...; this link is printed so you can open the Control UI.PERSIST_SANDBOX is true.You can change behavior by editing the constants in src/index.ts:
| Constant | Default | Description |
|---|---|---|
PERSIST_SANDBOX | true | When true, the sandbox is not deleted when the script exits |
MAKE_PUBLIC | true | Allow anyone to access the sandbox instead of limiting to your Daytona organization |
OPENCLAW_PORT | 18789 | OpenClaw Gateway and Control UI port |
SHOW_LOGS | true | Stream OpenClaw stdout/stderr to the terminal |
Key advantages:
allowInsecureAuth skip pairingPERSIST_SANDBOX)