client.sandboxes and client.volumes to run isolated Linux sandboxes.
Surface parity: macOS sandboxes and Persistent Disks (
/api/disks) are currently available via the REST API and hx vm CLI.Sandbox Lifecycle, Networking & Snapshots
| Operation | Node.js (@hyperbrowser/sdk) | Python (hyperbrowser) |
|---|---|---|
| Create sandbox | client.sandboxes.create(params) | client.sandboxes.create(params) |
| Boot from snapshot | client.sandboxes.startFromSnapshot(params) | client.sandboxes.start_from_snapshot(params) |
| Connect / attach / get / list | client.sandboxes.connect(id) / attach(detail) / get(id) / list(params?) | client.sandboxes.connect(id) / attach(detail) / get(id) / list(params=None) |
| Stop sandbox | sandbox.stop() | sandbox.stop() |
| Create memory snapshot | sandbox.createMemorySnapshot(params) | sandbox.create_memory_snapshot(params) |
| List / get / delete snapshots | client.sandboxes.listSnapshots / getSnapshot / deleteSnapshot | client.sandboxes.list_snapshots / get_snapshot / delete_snapshot |
| Expose / unexpose port | sandbox.expose(params) / sandbox.unexpose(port) | sandbox.expose(params) / sandbox.unexpose(port) |
| Update / clear egress policy | sandbox.updateNetwork(patch) / sandbox.clearNetwork() | sandbox.update_network(patch) / sandbox.clear_network() |
Execution, Processes, Terminal & Files
| Operation | Node.js | Python |
|---|---|---|
| One-shot command | sandbox.exec(cmd, opts?) | sandbox.exec(cmd, ...) |
| Background processes | sandbox.processes.start / get / list | sandbox.processes.start / get / list |
| Start process with secrets | client.sandboxes.startSecretProcess(id, params) | client.sandboxes.start_secret_process(id, params) |
| Interactive PTY terminal | sandbox.terminal.create / get, then terminal.attach() | sandbox.terminal.create / get, then terminal.attach() |
| Filesystem CRUD & watch | sandbox.files.list / read / write / upload / download / mkdir / remove / watch | sandbox.files.list / read / write / upload / download / mkdir / remove / watch |
Volumes & Custom Images
| Operation | Node.js | Python |
|---|---|---|
| Volumes CRUD | client.volumes.create / list / get / delete | client.volumes.create / list / get / delete |
| List / delete images | client.sandboxes.listImages / deleteImage | client.sandboxes.list_images / delete_image |
| Build or reuse image | client.sandboxes.getOrBuildImage / buildImageFromDockerfile / buildImageFromDockerImage / reuseDockerImage | client.sandboxes.get_or_build_image / build_image_from_dockerfile / build_image_from_docker_image / reuse_docker_image |
| Manage image builds | createImageBuild / listImageBuilds / getImageBuild / waitForImageBuild / cancelImageBuild | create_image_build / list_image_builds / get_image_build / wait_for_image_build / cancel_image_build |
import { Hyperbrowser } from "@hyperbrowser/sdk";
const client = new Hyperbrowser({ apiKey: process.env.HYPERBROWSER_API_KEY });
const sandbox = await client.sandboxes.create({ imageName: "node" });
try {
await sandbox.files.writeText("/tmp/hello.js", "console.log('ok');\n");
const res = await sandbox.exec("node /tmp/hello.js");
console.log(res.stdout.trim());
} finally {
await sandbox.stop();
}
import os
from hyperbrowser import Hyperbrowser
client = Hyperbrowser(api_key=os.environ["HYPERBROWSER_API_KEY"])
sandbox = client.sandboxes.create({"image_name": "node"})
try:
sandbox.files.write_text("/tmp/hello.js", "console.log('ok');\n")
res = sandbox.exec("node /tmp/hello.js")
print(res.stdout.strip())
finally:
sandbox.stop()