Skip to content
Wardcase Docs

Quickstart

This page takes you from an API key to a sandbox that runs a command, serves a port, accepts SSH and leaves an audit trail. Each step shows TypeScript and Python; pick a tab once and the rest of the page follows. To build an agent loop first, start with Your first agent sandbox.

Wardcase is in private early access, so signing up needs an invite code. To ask for one, write to business@wardcase.com.

Sign in to the dashboard at app.wardcase.com with GitHub, open API keys, and create a key with the sandboxes:read and sandboxes:write scopes. The key starts with vv_live_ and is shown once. Keep it in an environment variable:

Terminal window
export VIVARIUM_API_KEY="vv_live_..."
Terminal window
npm install @vivarium/sdk
import { Vivarium } from "@vivarium/sdk";
const vv = new Vivarium({ apiKey: process.env.VIVARIUM_API_KEY, baseUrl: "https://api.wardcase.com" });
// Resolves once the sandbox is running.
const sbx = await vv.sandboxes.create({
image: "python",
size: "small",
region: "eu-west",
idleTimeoutS: 600,
});
console.log(sbx.id); // sbx_4f9k2m8q1z7x3c5v

The client needs the API URL; both SDKs also read it as https://api. plus the VIVARIUM_DOMAIN environment variable. create returns once the sandbox is running. image, size and region pick what runs and where, and the sandbox is destroyed after 600 seconds without activity; see Timeouts.

const result = await sbx.run("python -c 'print(sum(range(10)))'", { timeoutS: 60 });
console.log(result.exitCode, result.stdout.trim(), result.durationMs); // 0 45 ...

Pass callbacks to receive output while the command runs:

await sbx.run("pip install requests", {
timeoutS: 300,
onStdout: (chunk) => process.stdout.write(chunk),
onStderr: (chunk) => process.stderr.write(chunk),
});
await sbx.files.write("/work/app.py", "print('hello')\n");
const bytes = await sbx.files.read("/work/app.py"); // Uint8Array
console.log(new TextDecoder().decode(bytes));
const entries = await sbx.files.list("/work");

File paths live under /work, the sandbox’s writable volume. Each transfer is recorded in the audit trail with its path, size and SHA-256. The contents are not.

// Start a server that listens on all interfaces, then expose its port.
await sbx.run("nohup python -m http.server 8000 --bind 0.0.0.0 > /tmp/http.log 2>&1 &");
const { url } = await sbx.expose(8000, { access: "public" });
console.log(url); // https://8000-4f9k2m8q1z7x3c5v.wardcase.com
// Token access (the default) returns the token once.
const { url: privateUrl, token } = await sbx.expose(8080);
await sbx.unexpose(8080);

The URL has the shape https://<port>-<id-part>.wardcase.com. Your server must listen on 0.0.0.0, not 127.0.0.1. See Port exposure for token access.

const ssh = await sbx.sshCommand();
console.log(ssh.command); // ssh sbx_4f9k2m8q1z7x3c5v@ssh.wardcase.com
// ssh.token is the password. It expires at ssh.expiresAt.

sshCommand() mints a token that works as the password for 10 minutes; the username is the sandbox id. A public key registered in the dashboard works too. During early access SSH reaches sandboxes in EU West (eu-west). See SSH access.

// Resolves once the snapshot is ready.
const snap = await sbx.snapshot({ name: "deps-installed" });
const copy = await vv.sandboxes.create({ snapshotId: snap.id, region: "eu-west" });
const snaps = await vv.snapshots.list({ sandboxId: sbx.id });
await sbx.kill();
const page = await sbx.audit.list({ type: "exec." });
for (const event of page.data) console.log(event.type, event.payload);
// Resolves once the export is ready.
const exported = await vv.audit.export({ sandboxId: sbx.id });
console.log(exported.url); // signed JSONL download, valid for one hour

Every API command, file transfer, exposed port and outbound connection from this walkthrough is in the list, along with the start and end of the SSH session. See Audit trail and exports.