The modbox/sandbox Image
The modbox/sandbox Image
The modbox/sandbox image is a full-featured, browser-capable sandbox. It runs a complete Ubuntu desktop environment inside a container and exposes everything — CDP, VNC, a web terminal, a file/exec API, and MCP endpoints — behind a single HTTPS URL.
Use this image when your workload needs a real browser, visual interaction, or a persistent remote desktop. For headless code execution without a browser, use modbox/sandbox-lite instead.
What is inside
All processes are managed by supervisord and restart automatically.
Provisioning
The SANDBOX_API_KEY is a secret you generate. It is injected into the container via env_vars and required to authenticate every call to the sandbox REST API (/modbox/api/*). Store it alongside sandboxUrl in your session.
Routes
All routes are served through nginx at https://{sandbox_url} (port 8080).
Executing commands
Use POST /modbox/api/exec to run a shell command inside the sandbox. The endpoint executes arbitrary bash and returns stdout, stderr, exit code and duration.
Response:
Fields:
Uploading and downloading files
Upload
POST /modbox/api/files/upload — multipart/form-data, field name file. Max 50 MB.
Response:
After uploading, the file is stored in /workspace/uploads/{filename} inside the container. Execute it with the exec endpoint.
List files
Download
Delete
Browser automation (CDP)
The sandbox runs a Chromium instance with Chrome DevTools Protocol enabled. Connect Playwright, Puppeteer, or any CDP client using the /cdp/ HTTP endpoint. Nginx rewrites the WebSocket URLs in CDP responses so they resolve correctly through the proxy.
Pass the HTTP endpoint (https://.../cdp) to connectOverCDP, not a WebSocket URL. Playwright fetches {endpoint}/json/version to discover the actual WebSocket debugger URL, which nginx rewrites to route correctly through the proxy.
Visual desktop (noVNC)
Open {sandbox_url}/vnc/ in a browser to access a full graphical desktop and watch the browser interact in real time. Useful for debugging automations, recording sessions, or running GUI applications.
No credentials required to access the VNC viewer — access is controlled by the sandbox URL itself, which is only known to the provisioning party.
Web terminal
Open {sandbox_url}/terminal/ in a browser to access a bash terminal running as the sandbox user inside the container. The terminal streams over WebSocket via ttyd.
MCP integration
The sandbox exposes two MCP servers, both available from the sandbox URL:
Connect any MCP-compatible client (Claude Desktop, VS Code, custom agent) by pointing it at https://{sandbox_url}/mcp/terminal/ or https://{sandbox_url}/mcp/cdp/.
Proxy support
If your sandbox needs to route traffic through a corporate proxy, pass the proxy settings via env_vars. The entrypoint propagates them automatically to apt, pip, git, and npm.
For SOCKS5 proxies, replace the value with socks5://proxy.example.com:1080.
sandbox vs sandbox-lite
Use modbox/sandbox when the task needs a real browser or visual interaction. Use modbox/sandbox-lite for code execution, scripts, and automation without a GUI.