Sandboxes

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.

Kata + Cloud Hypervisor microVMsWarm pool of ready sandboxesPNG charts from the Python kernelBilled per vCPU-second and GB-secondDashboard, API, SDK, MCP
agent.ts
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.

Postgres databaseA dedicated Postgres 17 for every project: REST and GraphQL, table and SQL editors, backups with restore, reports and advisors.AuthenticationSign-up and sign-in, JWT sessions, MFA and Row Level Security — with user management in the dashboard. OAuth providers, magic links (once SMTP is configured), hooks and e-mail templates.StoragePublic and private buckets, signed URLs and RLS policies. Browse and upload files right from the dashboard.Edge FunctionsTypeScript/Deno functions deployed from the dashboard, API or MCP — with templates, secrets, an invocation tester, logs and metrics.WorkersHeavy, long-running jobs in 15 runtimes (Python, Node, Bun, Deno, Go, Rust, Java, .NET, PHP, Ruby, Elixir or a Dockerfile) with a gallery of 30+ ready-to-deploy templates — isolated gVisor containers.One-click apps60 open-source apps in one click (Metabase, Grafana, Gitea, Keycloak, WordPress, Nextcloud, Qdrant…) — wired to your Postgres through a least-privilege role, each on its own HTTPS address.SitesFrontend hosting next to your database: static sites (Vite, Astro, SvelteKit) and SSR apps (Next.js) with a preview for every PR, instant rollback and custom domains with TLS.RealtimeListen to database changes, broadcast and presence over WebSockets — in real time.Vectors & AIpgvector out of the box: embeddings, semantic search and RAG without a separate vector database.Transactional emailSend app email through an API: your own domain with DKIM, templates, event webhooks, a suppression list and a sandbox inbox for testing.AI GatewayOne OpenAI-compatible gateway for Claude, GPT and Mistral on your own keys: rate limits, cache, PII redaction, logs, cost tracking and automatic embeddings into pgvector.MCP serverConnect Claude, Cursor and other AI agents to your database through the Model Context Protocol.

Build in a weekend. Scale to millions.

Spin up a free project in 2 minutes. No credit card, no pausing after a week.