v1.20.64see what's new →
← Learn

Lease an ephemeral box

Updated July 21, 2026

Rent a fresh Linux box for one run, then throw it away. One flag provisions a machine, runs your agent on it, shreds the credentials, and deletes the box — driving crabbox, a multi-cloud leasing layer (Hetzner by default).

Set up the token once

Leasing needs one secret: a Hetzner Cloud API token. The guided setup opens the console, prompts for the token, validates it, and stores it in a Keychain-backed bundle — never on disk.

agents lease setup     # --provider hetzner is the default

Lease and run

Add --lease to any run. A box is born, your agent runs on it headless, and it is gone before you look away.

agents run claude "do a big refactor and run the tests" --lease
agents run codex  "port this module" --lease aws      # pick another cloud
agents run claude "investigate the flake" --lease --keep-box
warmupcrabbox warmupprovision · 30–90sreadywait for SSHpoll 5s · 180s capruninstall + runcreds injected JITteardownshred · stopkept by --keep-box
Credentials are shredded inside the box regardless of --keep-box, so a kept box still loses your token when the run ends.

Warm vs. cold

A plain --lease is a cold start: crabbox provisions a fresh server (~30–90s). A box from a recent lease still inside its idle window (default 30m) is reused warm — the command starts immediately, no boot. Spot capacity by default keeps it cheap.

List and manage

A leased box bills while it is alive. crabbox list shows them — it needs the token in the environment, which is what the bundle is for.

agents secrets exec hetzner.com -- crabbox list   # inject the token, then list
crabbox stop blue-hermit                          # release + delete a box
agents lease gc --dry-run                          # find safe-to-reap orphans
Reference: Lease · Remote runs · Secrets