Sandbox SDK
API Reference

Processes

Start background processes, stream output, write stdin, and cancel work.

Starting a process

processes.ts
const process = await sandbox.processes.start("bun run dev", {
  env: { PORT: "3000" },
});

A process exposes id, status(), output(), write(), and kill().

Streaming output

processes.ts
for await (const event of process.output()) {
  console.log(event.stream, event.data);
}

Each event reports stream, data, and an optional timestamp. Providers that combine output declare combined-stream; the SDK does not invent stdout/stderr separation.

Writing stdin

Check the capability before writing because Vercel does not expose normalized background stdin.

stdin.ts
import { supports } from "@opencoredev/sandbox-sdk";

if (supports(sandbox, "process.stdin")) {
  await process.write("yes\n");
}

Stopping a process

processes.ts
await process.kill("SIGTERM");

The default signal depends on the provider. Pass a signal only when the provider supports it.

Expose the process through Ports.

On this page