
Upload Files and Run a Service with the Sandbox SDK
When your application needs a short-lived environment, the Sandbox SDK keeps the lifecycle explicit: create a Sandbox with limits, move the files you need, run the service, open a private preview, then stop and delete the compute.

Create a bounded Sandbox
Install openpond-sdk, keep OPENPOND_API_KEY in server-side infrastructure,
and create a Sandbox with the CPU, memory, disk, spend, duration, and port
limits that fit the job. Do not use a Sandbox as an unbounded background
machine.
Upload a file, start a process, and open a preview
import { createOpenPondClient } from "openpond-sdk";
const openpond = createOpenPondClient({
apiKey: process.env.OPENPOND_API_KEY!,
});
const sandbox = await openpond.sandboxes.create({
resources: { cpu: 1, memoryGb: 2, diskGb: 8 },
budget: { maxUsd: "0.15" },
quotas: { maxDurationSeconds: 900, maxOpenPorts: 1 },
});
await openpond.sandboxes.uploadFile(
sandbox.id,
"server.mjs",
"import { createServer } from 'node:http'; createServer((_, r) => r.end('ok')).listen(3000, '0.0.0.0');",
);
const started = await openpond.sandboxes.startProcess(sandbox.id, {
command: "node server.mjs",
timeoutSeconds: 600,
});
const preview = await openpond.sandboxes.openPort(sandbox.id, {
port: 3000,
label: "example-service",
access: "private",
});Before returning preview.preview.url to a user, wait for the service to listen
and check its process status. The SDK exposes structured file, process, and
preview methods so application code does not have to infer state from shell
output.

End the lifecycle deliberately
Stop the managed process and delete the Sandbox when the preview is no longer needed. Resolve the exact Sandbox-relative path before deletion, keep previews private by default, and do not log preview tokens.
The SDK guide to files, processes, and previews contains a complete example with file inspection and cleanup.