Corevelos

Sandboxes

The sandbox lifecycle — create, run commands, read and write files, pause to disk, resume, and kill.

A sandbox is a running MicroVM. It boots from a template (a disk image) and lives until you kill it or it is reclaimed.

Create

import { Sandbox } from "@corevelos/sdk";

const box = await Sandbox.create({
  template: "base",
  timeoutMs: 300_000, // auto-reclaim after 5 minutes of inactivity
});

Run commands

const result = await box.commands.run("npm install && npm test");
console.log(result.exitCode, result.stdout, result.stderr);

Long-running processes can be started in the background and streamed:

const proc = await box.commands.run("npm run dev", { background: true });
proc.stdout.on("data", (chunk) => process.stdout.write(chunk));

Files

await box.files.write("/app/main.py", "print('hello')");
const content = await box.files.read("/app/main.py");
await box.files.list("/app");

Pause and resume

Pausing snapshots the sandbox to disk — memory included — and stops billing for vCPU and RAM. Only storage is billed while paused.

await box.pause();
// ...later...
const resumed = await Sandbox.resume(box.id); // ~1s, memory intact

Kill

await box.kill(); // stops all billing immediately

Every sandbox belongs to exactly one project. Its billing subject is the project's workspace, and its visibility follows project access.

On this page