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.
1. Get an API key
Section titled “1. Get an API key”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:
export VIVARIUM_API_KEY="vv_live_..."2. Install an SDK
Section titled “2. Install an SDK”npm install @vivarium/sdkpip install vivarium3. Create a client and a sandbox
Section titled “3. Create a client and a sandbox”import { Vivarium } from "@vivarium/sdk";
const vv = new Vivarium({ apiKey: process.env.VIVARIUM_API_KEY, baseUrl: "https://api.wardcase.com" });import osfrom vivarium import Vivarium
vv = Vivarium(api_key=os.environ["VIVARIUM_API_KEY"], base_url="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# Returns once the sandbox is running.sbx = vv.sandboxes.create( image="python", size="small", region="eu-west", idle_timeout_s=600,)print(sbx.id) # sbx_4f9k2m8q1z7x3c5vThe 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.
4. Run a command
Section titled “4. Run a command”const result = await sbx.run("python -c 'print(sum(range(10)))'", { timeoutS: 60 });console.log(result.exitCode, result.stdout.trim(), result.durationMs); // 0 45 ...result = sbx.run("python -c 'print(sum(range(10)))'", timeout_s=60)print(result.exit_code, result.stdout.strip(), result.duration_ms) # 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),});import sys
sbx.run( "pip install requests", timeout_s=300, on_stdout=lambda chunk: sys.stdout.write(chunk), on_stderr=lambda chunk: sys.stderr.write(chunk),)5. Move files
Section titled “5. Move files”await sbx.files.write("/work/app.py", "print('hello')\n");const bytes = await sbx.files.read("/work/app.py"); // Uint8Arrayconsole.log(new TextDecoder().decode(bytes));const entries = await sbx.files.list("/work");sbx.files.write("/work/app.py", "print('hello')\n")data = sbx.files.read("/work/app.py") # bytesprint(data.decode())entries = 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.
6. Serve a port
Section titled “6. Serve a port”// 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);# Start a server that listens on all interfaces, then expose its port.sbx.run("nohup python -m http.server 8000 --bind 0.0.0.0 > /tmp/http.log 2>&1 &")exposure = sbx.expose(8000, access="public")print(exposure.url) # https://8000-4f9k2m8q1z7x3c5v.wardcase.com
# Token access (the default) returns the token once.private = sbx.expose(8080)print(private.url, private.token)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.
7. Connect over SSH
Section titled “7. Connect over SSH”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.ssh = sbx.ssh_command()print(ssh.command) # ssh sbx_4f9k2m8q1z7x3c5v@ssh.wardcase.com# ssh.token is the password. It expires at ssh.expires_at.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.
8. Snapshot, then clean up
Section titled “8. Snapshot, then clean up”// 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 });# Returns once the snapshot is ready.snap = sbx.snapshot(name="deps-installed")copy = vv.sandboxes.create(snapshot_id=snap.id, region="eu-west")snaps = vv.snapshots.list(sandbox_id=sbx.id)await sbx.kill();sbx.kill()9. Read the audit trail
Section titled “9. Read the audit trail”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 hourpage = sbx.audit.list(type="exec.")for event in page.data: print(event.type, event.payload)
# Returns once the export is ready.exported = vv.audit.export(sandbox_id=sbx.id)print(exported.url) # signed JSONL download, valid for one hourEvery 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.
- TypeScript SDK and Python SDK for every option.
- Sandboxes for the lifecycle and statuses.
- Egress policies to restrict outbound traffic.
- API reference for the REST endpoints behind the SDKs.