@solarisdk/sandbox
v0.4.13
Published
Solari Sandbox — spin up fast, ephemeral compute sandboxes (with optional desktops) over a computer-use action API.
Maintainers
Readme
@solarisdk/sandbox
Spin up fast, ephemeral compute sandboxes — with an optional desktop — and drive them with a computer-use action API.
npm install @solarisdk/sandboximport { SandboxClient } from "@solarisdk/sandbox";
// baseUrl defaults to https://api.getsolari.com
const sandboxes = new SandboxClient({ apiKey: process.env.SOLARI_API_KEY! });
const sandbox = await sandboxes.create();
const out = await sandbox.commands.run("python3", { args: ["-c", "print(2 + 2)"] });
console.log(out.stdout); // "4\n"
await sandbox.kill();commands.run takes the program and its args; it does not interpret a shell line (use run("sh", { args: ["-lc", "…"] })).
sandboxes.createDesktop() returns a Desktop handle when you need a GUI. Need
desktops as a first-class client, or a single unified client? Use
@solarisdk/sdk. For managed
desktops on their own, use
@solarisdk/desktop.
Release a sandbox when you are done with it: await sandbox.kill(), or declare it with await using sbx = await
sandboxes.create() (TypeScript 5.2+) so it is killed when the scope ends. A process that ends with a sandbox it never
killed or closed prints a one-line reminder at exit. commands.run(cmd, { timeoutMs }) is the deadline for one command
(default 600 000 ms); result.timedOut says it was cut off.
Capabilities and limits at a glance: https://docs.getsolari.com/sdk-capabilities.
Requirements
Node 18+ (or a browser with WebSocket and fetch). The type declarations need TypeScript 5.0 or newer; await using works in compiled TypeScript 5.2+ on Node 18.18+ (which provide Symbol.asyncDispose); running the syntax uncompiled needs Node 24.
License
MIT
