Caveman Cloud· Hosted & VPCSandboxes
Sandbox CLI and SDK Reference (TypeScript, Python, Go)
Complete reference for cvm sandbox commands (create, exec, cp, ls, port-forward, url, snapshot, restore, fork, sleep, resume, delete) and TypeScript, Python, and Go SDK clients.
Control Firecracker sandboxes from the cvm CLI or programmatically from TypeScript (@caveman-ai/sdk/sandboxes), Python (caveman_cloud), and Go (github.com/caveman-ai/sdk-go).
Complete CLI lifecycle#
export CAVE_TOKEN="cave_live_..." # or run `cvm key quick` after `cvm login`
# Create a sandbox and wait until running
cvm sandbox create --name scratch --size 2cpu-4gb --sleep-after 10m --network internet
# Run commands (stdout/stderr kept separate; exits with the command's exit code)
cvm sandbox exec SANDBOX_ID -- uname -a
cvm sandbox exec -e NODE_ENV=test -w /workspace SANDBOX_ID -- npm test
# Interactive terminal (-t matches local terminal size; -i forwards stdin)
cvm sandbox exec -t -i SANDBOX_ID -- bash
echo "hello" | cvm sandbox exec -i SANDBOX_ID -- cat
# Copy files in or out (atomic rename on copy-out; preserves executable bits)
cvm sandbox cp ./run.sh SANDBOX_ID:/home/user/
cvm sandbox cp SANDBOX_ID:/home/user/output.json ./output.json
cvm sandbox ls SANDBOX_ID /home/user
# Forward a sandbox loopback port to 127.0.0.1 locally
cvm sandbox port-forward SANDBOX_ID 8080
cvm sandbox port-forward SANDBOX_ID 9000:3000
# Expose a port at a private HTTPS URL (or --public / --private)
cvm sandbox url SANDBOX_ID 3000 --ttl 1h
cvm sandbox url SANDBOX_ID 3000 --public
cvm sandbox url SANDBOX_ID 3000 --private
# Snapshot, restore, fork, and manage snapshots
# Note: keeping 2 sandboxes at once or sizing above 2x8 requires a paid plan
cvm sandbox snapshot SANDBOX_ID --name clean
cvm sandbox snapshots SANDBOX_ID
cvm sandbox restore SANDBOX_ID SNAPSHOT_ID
cvm sandbox fork SANDBOX_ID SNAPSHOT_ID --name try-2 --size 4cpu-16gb
cvm sandbox snapshot-delete SANDBOX_ID SNAPSHOT_ID --yes
# Sleep (stops compute, keeps disk), resume, list, and delete
cvm sandbox sleep SANDBOX_ID --wait
cvm sandbox resume SANDBOX_ID
cvm sandbox list
cvm sandbox get SANDBOX_ID
cvm sandbox delete SANDBOX_ID --yesKey flags on cvm sandbox create#
Org computer pools (cvm pools)#
Manage shared N:M computer pools across Cloud and connected local Mac hosts:
cvm pools list
cvm pools create ci-runners
cvm pools computers ci-runners
cvm pools archive ci-runnersTypeScript SDK (@caveman-ai/sdk/sandboxes)#
npm install @caveman-ai/sdkimport { Sandboxes } from "@caveman-ai/sdk/sandboxes";
const sandboxes = new Sandboxes({
controlURL: process.env.CAVE_API_URL ?? "https://api.caveman.so",
apiKey: process.env.CAVE_TOKEN!,
});
const sb = await sandboxes.create({ name: "scratch", size: "2cpu-4gb" });
const out = await sb.exec(["uname", "-a"]);
console.log(out.stdout);
await sb.sleep();
await sb.delete();Python SDK (caveman_cloud)#
python -m pip install https://github.com/caveman-ai/cloud-sdk/releases/download/v2.0.0/caveman_sdk-2.0.0-py3-none-any.whlimport os
from caveman_cloud import Sandboxes
sandboxes = Sandboxes(
control_url=os.environ.get("CAVE_API_URL", "https://api.caveman.so"),
api_key=os.environ["CAVE_TOKEN"],
)
sb = sandboxes.create(name="scratch")
res = sb.exec(["uname", "-a"])
print(res.stdout)
sb.delete()Go SDK (github.com/caveman-ai/sdk-go)#
go get github.com/caveman-ai/sdk-gopackage main
import (
"context"
"fmt"
"os"
caveman "github.com/caveman-ai/sdk-go"
)
func main() {
ctx := context.Background()
client, err := caveman.NewSandboxes(caveman.SandboxesConfig{
ControlURL: "https://api.caveman.so",
APIKey: os.Getenv("CAVE_TOKEN"),
})
if err != nil {
panic(err)
}
sb, err := client.Create(ctx, caveman.CreateSandboxInput{Name: "scratch"})
if err != nil {
panic(err)
}
defer client.Delete(ctx, sb.ID)
res, err := client.Exec(ctx, sb.ID, []string{"uname", "-a"})
if err != nil {
panic(err)
}
fmt.Print(res.Stdout)
}Limits and error codes#
- On Hobby ($0/mo), Cloud workspaces include 30 hours/mo of
2x4sandboxes (recurring monthly), up to 3 concurrent sandboxes (24 GiBawake), 3 kept sandboxes (auto-archived after 7d idle),10/minstarts (1,000/mo),1 hourmax awake session, and max shape2x8. Upgrade to Pro ($25/mo) (20concurrent /160 GiB,30 → 120/min,24h, up to8x32,25kept), Scale ($300/mo) (100concurrent /800 GiB,120 → 600/min, unlimited session, up to16x64,100kept), or Business ($750/mo) (300concurrent /2.4 TiB,300 → 1,500/min, up to16x64+,300kept, Warm Snapshot Pools<200ms), or bolt on a Concurrency Pack (+$50/mo) for+25concurrent sandboxes (+200 GiBawake). See Billing for all sandbox limits and metered rates. - Running
cvm sandbox execon a sleeping sandbox returnscave_code_computer_not_running(exit4): callcvm sandbox resume SANDBOX_IDfirst. - Each service-account key retains up to
32snapshots at once (cave_code_computer_limit_snapshots, exit4). cvm sandbox urlrequires the target installation to have port URLs enabled (cave_sandbox_ports_off, exit4);cvm sandbox port-forwardworks on every installation.- Port URL tokens (
Caveman-Port-Tokenheader or browser open link) are short-lived credentials; treat them as secrets while active.