A safe place for code written by an AI agent.
Run any code in an on-demand isolated environment: every sandbox is its own microVM (Kata Containers + Cloud Hypervisor) with its own kernel, disk and network - or cheaper gVisor. Run commands with streamed output, write files, execute code in a Python kernel with PNG charts and expose ports over HTTPS. From the dashboard, API, SDK, MCP and the AI Gateway.
import { Sandbox } from "@hostbase/sandbox";
const sbx = await Sandbox.create({ apiKey: process.env.HOSTBASE_TOKEN!, project: "<ref>", template: "python-3.12" });
const run = await sbx.runCode("import pandas as pd; pd.DataFrame({'a': [1, 2, 3]}).describe()");
console.log(run.results); // text/html, image/png, ...
const out = await sbx.exec("pip list | head"); // { exitCode, stdout, stderr }
await sbx.files.write("/workspace/data.csv", "a,b
1,2");
await sbx.close();Capabilities
What you get with Sandboxes
microVM isolation
Kata + Cloud Hypervisor by default: its own guest kernel and KVM hardware isolation. gVisor is available as a cheaper, faster-starting option. Sandboxes run only on a dedicated host, away from databases.
Templates
Python 3.12 (numpy, pandas, matplotlib, scikit-learn), Node.js 22, Bun, Ubuntu 24.04 with common tools, and Playwright + Chromium.
Exec and files
Commands synchronously or as an SSE stream (live stdout/stderr), a terminal in the dashboard, and upload/download of files and whole directories (tar).
Jupyter-like code runs
The Python kernel keeps state between calls and returns rich results: text, pandas HTML tables and matplotlib charts as PNG.
Port preview URLs
A server on port 3000 inside the sandbox is reachable at https://<id>-3000.sbx.workers-waw1.host.ulewicz.space with TLS - public or token-protected.
Limits and egress policy
vCPU, RAM, disk and lifetime (5 min idle by default, 24 h max). Egress: open, an allowlist of hosts, or none. Private networks and the cloud metadata service are always blocked.
Pause and resume
Freeze the VM in memory or stop it and keep the /workspace disk. Live CPU, memory, disk and network metrics.
Fast start
A small warm pool per template: claiming a ready machine takes tens of milliseconds instead of a ~2 s cold start.
Use cases
What teams use it for
Coding agents
Claude Code or Cursor run and test generated code through MCP tools, with no risk to your machine.
LLM data analysis
The model writes Python, the sandbox computes and returns a chart - through the AI Gateway just add hostbase_tools: ["code_interpreter"].
Previews and tests
Run an app and open its port on an HTTPS URL, or test a page with Playwright.
The rest of the platform
Every service shares the same database, authentication and permissions.
Build in a weekend. Scale to millions.
Spin up a free project in 2 minutes. No credit card, no pausing after a week.