Lease
Rent a fresh Linux box for one run, then throw it away. agents run --lease provisions a machine, runs your agent on it, shreds the credentials, and deletes the box — all from one flag. Under the hood it drives 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 defaultCreate a token with Read & Write permission (it must create and delete servers). It lands in the hetzner.com bundle under HCLOUD_TOKEN. Prefer to do it by hand? agents secrets create hetzner.com then agents secrets add hetzner.com HCLOUD_TOKEN — see Secrets.
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 # keep it after--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 Hetzner server (~30–90s) and waits for SSH. A box from a recent lease that is still inside its idle window is reused warm — your command starts immediately, no boot. The crabbox defaults that bound this:
idle-timeout30m — an untouched box auto-stops, so a forgotten lease can't bill forever.marketspot — cheaper capacity by default;on-demandis the alternative.classbeast — the machine size (maps to a Hetzner server type).
List and manage boxes
A leased box bills while it is alive. crabbox list shows them — but it needs the provider token in the environment, which is what the bundle is for:
agents secrets exec hetzner.com -- crabbox list # inject the token, then list
crabbox ssh --id blue-hermit # SSH into a box
crabbox stop blue-hermit # release + delete a boxIf a run dies badly and leaves an orphan holding quota, the reaper is safe by construction — it only stops a box whose lease has expired and that has been idle past a safety window:
agents lease gc --dry-run # show reap-safe orphans, stop nothing
agents lease gc --yes # stop them without the confirm promptNot just Hetzner
Hetzner is the default, but crabbox is multi-cloud — hetzner, aws, gcp, azure, proxmox, e2b, modal, and more. Select one with --lease <backend>.
In CI
agents lease setup wants a terminal. For headless runs, make the token available with an environment variable instead — either point at a pre-provisioned bundle or supply the raw token:
export AGENTS_LEASE_SECRETS_BUNDLE=hetzner.com # use a keychain bundle
# ...or...
export HCLOUD_TOKEN=$HETZNER_CLOUD_TOKEN # a CI secret
agents run claude "run the migration" --lease --keep-boxRelated
- Learn: Lease an ephemeral box — the narrative walkthrough with diagrams.
- Remote runs — dispatch to machines you own instead of leasing one.
- Cloud dispatch — offload to managed cloud pods that open a PR.
- Secrets — the Keychain bundle that holds the provider token.