@syva/sdk
v0.2.0
Published
TypeScript SDK for Syva sandboxes
Readme
Syva TypeScript SDK
Install:
npm install @syva/sdkUse:
import { config } from "dotenv";
config({ path: ".env.local" });
import { Sandbox } from "@syva/sdk";
const sandbox = await Sandbox.create({
image: "node-22:base",
});
const result = await sandbox.runCommand("printf", ["Hello from Syva Sandbox!\\n"]);
console.log(result.stdout.trim());
await sandbox.destroy();Persistent sandboxes snapshot their filesystem when stopped and resume where they left off. Give a sandbox a name and reconnect to it from anywhere:
const sandbox = await Sandbox.getOrCreate({ name: "agent-workspace", image: "node-22:base" });
await sandbox.runCommand("npm", ["install"]);
const stopped = await sandbox.stop(); // snapshots the filesystem, stops billing compute
console.log(stopped.lastSnapshot?.id);
const resumed = await stopped.start(); // boots a new session from the snapshot
const fork = await resumed.fork({ name: "agent-workspace-copy" }); // new sandbox, same stateSnapshots are billed at $0.08/GiB-month on the compressed delta. Every
snapshot is kept until it expires (30 days after last use by default). Pass
persistent: false for throwaway sandboxes, bound storage with
keepLastSnapshots: { count: 1 }, or tune settings later with
sandbox.update(...) — including rolling back via currentSnapshotId.
The docs app renders this same quickstart from frontend/src/lib/sdk-examples.ts.
