Command line
beachside creates and manages sandboxes from the command line, on any provider with a Beachside adapter. It is built for coding agents first: no command waits for input outside a terminal, every command has a stable --json form, and exit codes clearly indicate what to do next. People get readable output by default, and a guided setup.
Install
Section titled “Install”Install the CLI, then run beachside init:
npm install -g @beachside/clibeachside initinit asks which providers you want, installs their adapters, asks for each provider’s key and settings (with a link to where you get the key), keeps new keys in beachside.json, readable only by you (--store keychain uses your OS keychain instead), checks that each provider accepts its key, offers to try a sandbox on each one, and saves one profile per provider in beachside.json. It ends by printing the command that repeats the setup without questions, so you can put it in a dotfiles script or hand it to an agent. Nothing is saved until the end, and Ctrl-C leaves your config as it was. Running it again lets you add providers, change one, pick the default or check them all. See Set up providers with init.
To install an adapter yourself, use beachside adapter add. Adapters live in their own folder so a project you happen to be in can’t supply one:
beachside adapter add e2bThe CLI runs on Node.js or Bun; beachside adapter uses npm to install. beachside adapter add takes one or more provider ids (boxd, freestyle, daytona, e2b, vercel, modal, runloop, archil, exe-dev, boat) and installs each official adapter at the same version as the CLI, so the two always match. It then imports the package to check that the adapter is there. Running it again with nothing to change skips npm, so it is safe in CI setup steps. beachside adapter ls shows what is installed and flags an official adapter whose version differs from the CLI’s; beachside adapter rm e2b removes one.
beachside providers lists the official adapters, whether each is installed, which credentials are missing and where to get them, and the profiles that use each one.
Quick start
Section titled “Quick start”After beachside init, or with a provider picked by environment variables (as in CI), check the setup, then work:
beachside init e2b --api-key env:E2B_API_KEY # or plain `beachside init` for the guided setupbeachside doctor # checks the config and that the provider accepts the key; creates nothing
beachside create --name webbeachside cp ./app.py web:/home/user/app.pybeachside exec web --cwd /home/user -- python3 app.pybeachside sh web 'ls -la /home/user | head'beachside rm webTo test a checkout in a throwaway sandbox, send it with run --push, and copy results out with cp -r:
beachside run --push . --timeout 15m -- sh -c 'npm ci && npm test'
beachside create --name ci --ttl 30mbeachside push ci # prints /home/user/workbeachside exec ci --cwd /home/user/work -- npm testbeachside cp -r ci:/home/user/work/coverage ./coveragebeachside rm ciFor one command in a throwaway sandbox, run creates it, runs the command and always destroys it, even when the command fails or you press Ctrl-C (it then exits 130):
beachside run -- python3 -c 'print(2 + 2)'To keep provider settings in one place instead of environment variables, see Configuration. To run CI jobs in sandboxes, see Run CI jobs.
Naming sandboxes
Section titled “Naming sandboxes”create prints the sandbox’s name: the --name you gave, or a generated one such as sb-1a2b3. Every other command takes that name. The CLI also accepts a provider’s own sandbox ID if the sandbox is in its list, or @file.json for a file holding a saved sandbox reference (the reference field of beachside inspect --json).
beachside ls shows every sandbox the CLI knows about with its live state (running, gone, unreachable and so on). beachside ls --offline skips the provider calls.
beachside ls --remote asks the selected profile’s provider instead, so it also shows sandboxes created elsewhere. It prints whether the provider listed every sandbox in the account scope or only ones created through Beachside. The NAME column shows the store name for sandboxes the CLI already knows. To work with a listed sandbox by name, record it with beachside adopt <id> --name <name>; adopt reopens it first and fails if the provider cannot give a verifiable reference. The CLI did not create adopted sandboxes, so rm --all skips them and rm <name> needs --force. The listing also shows each sandbox’s creation time and labels where the provider reports them.
Cleaning up after killed jobs
Section titled “Cleaning up after killed jobs”A job that is killed or cancelled can leave its sandbox running, and its store may be gone with the runner. Label every sandbox a job creates, then collect by label from the provider’s own listing:
beachside create --name ci --label run=$GITHUB_RUN_ID --ttl 1h# later, from any machine with the same profilebeachside gc --label run=$GITHUB_RUN_IDbeachside gc --label ci=true --older-than 2h --dry-rungc destroys every listed sandbox whose labels match all the --label pairs, and drops any store record for it. --older-than keeps sandboxes the provider says are younger than that, and skips ones without a reported creation time. --dry-run shows what would go. At least one --label is required, so gc never sweeps an account by age alone. Sandboxes the provider lists without a reopenable reference (Modal) and sandboxes adopted into the store are skipped and reported. Boat keeps no labels, so gc finds nothing there. On every provider, --ttl stays the backstop: the provider removes a sandbox when its lifetime ends even if nothing runs gc.
Commands and arguments
Section titled “Commands and arguments”execpasses the command after--as separate arguments, with no shell. Useshwhen you need pipes, redirects or&&.exec,shandrunexit with the remote command’s own exit code, sobeachside exec web -- test -f /x && echo yesworks as expected. Failures of the CLI itself exit 125.exec,shandrunprint output as it arrives on every provider, so long builds and test runs show progress. Boat and Runloop stream it as UTF-8 text; the others pass the exact bytes through. With--jsonor--no-stream, the output is printed when the command ends;--max-outputlimits only that captured output.--timeout(default 5 minutes) applies either way: a streaming command that runs past it, or that you stop with Ctrl-C, is asked to terminate before the CLI exits.create --env K=V(repeatable) and--env-file <path>set environment variables for every command in the sandbox;exec --envoverrides a name for one command.--env NAMEwithout a value copiesNAMEfrom your shell, which keeps secrets out of history..envfiles holdNAME=VALUElines;#comments (also after a value, following a space), blank lines andexportare allowed. Unquoted values are trimmed;"..."values understand\n,\"and\\, and'...'values are literal. Multi-line values are not supported. Values are never written to the store,--jsonoutput or messages. Every first-party provider supports them; an adapter without sandbox-wide variables rejects--envand--grantoncreatebefore creating anything. Onexec,shandrun, the same flags apply to that one command.cpcopies a file in either direction; the sandbox side is written<name>:/absolute/path.cat <name>:/pathprints a file. Files of any size work: they stream where the provider streams files, and otherwise travel in 1 MiB parts. With-rit copies a directory too, likecp -r: an existing destination folder receives a child of the same name.--exclude <glob>(repeatable) skips matching paths; a pattern without/, such asnode_modulesor*.log, matches a name at any depth.push <name>[:/dir] [path]sends a local folder (default.) into the sandbox, by default toworkunder the sandbox user’s home, and prints where it landed. In a git work tree it sends what git would: tracked files plus untracked files that are not ignored, so.git,node_modulesand build output stay behind.--include-ignoredsends every file.run --push <path>does the same in its new sandbox and runs the command in that folder unless you pass--cwd.- Directory copies keep file modes and symlinks. They move one tar archive and unpack it with one command, so the sandbox needs
tar(without it they fail with exit 4 andUNSUPPORTEDbefore anything is sent). Copying out never writes through a symlink, never leaves the destination folder, and drops setuid bits. Files deleted locally are not deleted from an earlier copy in the sandbox. --image <oci-ref>boots an OCI image on boxd and Modal. E2B and Daytona need it built once withbeachside image build <oci-ref>; until then--imagefails before creating anything, and--buildbuilds it during the command instead.--prepared <id>picks a provider template or snapshot.beachside image ls,inspect,rmandforgetmanage the recorded builds:rmdeletes the template or snapshot on the provider and drops the record (only builds this CLI created, unless you pass--force), whileforgetonly drops the record and lists what the provider still holds.beachside image ls --remotelists the provider’s own images. Ifimage rmexits 6, the outcome is unknown; running it again asks the provider how the delete ended without resending it.
Agent message board
Section titled “Agent message board”beachside board runs beachbar, a message board where agents in different sandboxes share tasks and threads. beachbar’s library ships with the CLI, so there is nothing else to install. It reads your beachbar config (~/.config/beachbar/config.json), and every argument goes to beachbar’s own commands, so beachside board create fix-auth, beachside board use fix-auth, beachside board task add "..." --board fix-auth and beachside board watch --board fix-auth work as they do in beachbar. Board management words (create, ls, show, use, archive, rm, set, guard) become beachbar board <word>, even after beachbar’s global flags such as --server prod.
beachside board is a pass-through, the one exception to the CLI’s JSON contract: with --json it prints beachbar’s own envelope ({ ok, data } or { ok: false, error: { code, reason, message, next } }, without retryable, outcome or hint) and exits with beachbar’s exit code.
create --board <name> mints a token for the new sandbox on that board and sets BEACHBAR_URL and BEACHBAR_TOKEN in its environment. The token’s identity is the sandbox name (--board-agent changes it), its role is worker unless --board-role lead|observer says otherwise, and it lasts as long as the sandbox’s --ttl (7 days without one; --board-ttl overrides it). The owner token never goes into a sandbox. beachside inspect shows the token id, never the token; rm, run and gc revoke it, and rm says how to revoke it by hand when it cannot (the saved board is gone or is another board now). run --board works the same way. --board-ttl (and --ttl when it sets the token’s lifetime) must be 60s to 366d, and the sandbox name must be a beachbar agent name (1-48 lowercase letters, digits, ., _ or -) unless --board-agent names one. Like --grant, --board needs sandbox-wide environment variables and a network that reaches the board, and a sandbox with --board is never saved to a setup cache.
Snapshots
Section titled “Snapshots”A snapshot saves a sandbox’s state so new sandboxes can start from it, for example a checkout with its dependencies already installed:
beachside create --name base --network internetbeachside sh base 'git clone https://github.com/acme/app /work/app && cd /work/app && npm ci'beachside snapshot create base --name depsbeachside rm base
beachside run --snapshot deps --cwd /work/app -- npm testsnapshot create <sandbox> captures a sandbox from the store and records the snapshot under --name (default <sandbox>-snap). What it keeps, files only or memory too, and whether the source pauses during capture depend on the provider and the profile’s snapshots.preserve; the command prints both. A provider that cannot capture fails with exit 4 before anything happens.
create --snapshot <name> and run --snapshot <name> start a sandbox from a recorded snapshot, on the profile that captured it. The snapshot fixes the image, so --image, --prepared and --build do not apply. --env, --label and --ttl work as on any create, for example to pass a CI job its secrets. A provider that can’t apply one of them on restore fails with exit 4 before anything is created: Boat and boxd take only --ttl, Runloop takes --env, --label and --ttl (--ttl only when the profile sets no idleSeconds), and Daytona and E2B take --env only for filesystem snapshots, because a memory snapshot resumes its processes with the environment they had.
To refresh a snapshot, capture it again with snapshot create <sandbox> --name <name> --replace. The record keeps the old snapshot until the new one exists, then the old one is deleted. A snapshot still in use by a running sandbox can’t be deleted; the command says so and leaves it on the provider.
snapshot ls lists the recorded snapshots and snapshot ls --remote the provider’s own. snapshot inspect <name> shows a snapshot’s state. snapshot rm <name> deletes it on the provider and drops the record (only snapshots this CLI captured, unless you pass --force), while snapshot forget <name> only drops the record. Snapshots are kept until you delete them, and some providers charge for storage. If snapshot create or snapshot rm exits 6, the outcome is unknown: snapshot inspect or running snapshot rm again checks how it ended without sending it twice.
JSON output for agents and scripts
Section titled “JSON output for agents and scripts”Add --json, or set BEACHSIDE_JSON=1, and stdout holds exactly one JSON document:
{ "ok": true, "data": { "name": "web", "provider": "e2b", "status": "created" } }{ "ok": false, "error": { "code": "OUTCOME_UNKNOWN", "message": "...", "retryable": false, "outcome": "unknown", "hint": "...", "known": { "sandbox": "web" } }}outcome says whether anything happened: rejected means nothing did, unknown means it might have, and partial means some steps did. Never repeat a create after unknown (exit 6). Run beachside ls first: the CLI keeps the name so you can inspect or remove whatever was created.
The command reference lists every exit code, and beachside schema prints all commands, flags and exit codes as JSON.
Servers in a sandbox
Section titled “Servers in a sandbox”--with installs a server in a new sandbox and puts it on your Tailscale tailnet, so you can open it from your own machine without a public port:
export TAILSCALE_AUTH_KEY=... # reusable, ephemeral, tagged tag:beachsidebeachside create --name web --with rexbeachside create --name dev --with herdr| Server | What you get |
|---|---|
rex |
A Rex server on Rex’s own Tailscale. Add its https:// address in Rex. |
herdr |
A Tailscale SSH device for Herdr. Run the printed hc machine add … command to add it to the Herdr app. |
create prints how to connect when it finishes, and inspect shows it again. --with implies --network internet, because the sandbox downloads the server and reaches Tailscale. The tailnet setup is the same for both: see Set up Tailscale once. Devices are named beachside-<sandbox>, and rm logs each device out of your tailnet before the sandbox goes, so it doesn’t linger offline. If setup fails after the sandbox exists, create exits 8 and keeps the sandbox, so you can look inside or remove it.
herdr connects over Tailscale SSH, so it also needs an ssh rule in your tailnet policy:
"ssh": [ { "action": "accept", "src": ["autogroup:member"], "dst": ["tag:beachside"], "users": ["autogroup:nonroot", "root"] }]The printed command adds the sandbox to herdr-core, the server behind the Herdr app, as a short-lived machine named after the sandbox:
hc machine add boxd@beachside-dev.<your-tailnet>.ts.net --temp --install --name devhc machine add prints the machine’s name. It is the sandbox’s name unless herdr-core refuses it (over 32 characters, or shaped like a terminal id such as t14), in which case create leaves out --name and herdr-core names it after the device, adding a number if that name is taken. The sandbox’s spaces and agents then show up in the Herdr sidebar under that name, and hc run --on dev … starts terminals there. They keep running while your laptop sleeps or the app is closed. --install puts hc in the sandbox on the first connect: your own build when the OS and CPU match, otherwise that version’s release.
On the first connect, ssh asks you to accept the device’s host key. create prints that key’s fingerprint, read inside the sandbox over your provider rather than over the network, so compare the two and answer yes if they match. Recent OpenSSH asks (yes/no/[fingerprint]), and pasting the printed fingerprint there accepts the key only if it matches. --json lists the device’s keys as known_hosts lines in data.addons[].knownHosts. Beachside makes any host key the sandbox’s /etc/ssh lacks with ssh-keygen before Tailscale starts; in a sandbox without ssh-keygen, Tailscale makes its own and create prints no fingerprint. The fingerprint shows you reached the sandbox’s keys, not which sandbox: the default boxd, E2B and Freestyle images ship host keys made when the image was built, so sandboxes from one image can show the same fingerprint.
Don’t pin a fingerprint or carry one over from another sandbox. Host keys change when a provider rebuilds its image, when a sandbox is restored, or when something in the sandbox makes new ones, so compare against what Beachside reads for this sandbox now. beachside inspect dev reads a running sandbox’s keys again and says if they changed since create. If ssh then warns that the host identification changed, check the new fingerprint with inspect before you drop the old entry with ssh-keygen -R <address>.
After beachside rm dev (or gc), Herdr still lists the machine, and ssh still has the host key you accepted. rm and gc print the hc machine rm <name> that forgets it, looking the name up with hc machine ls by its address, and the ssh-keygen -R <address> that drops the old key, so a new sandbox with the same name isn’t refused as a changed host.
On Herdr TUI, run herdr --remote ssh://<same user@address> instead. It asks you to accept the same host key (compare the printed fingerprint) and to install its server in the sandbox.
Status on terminal tabs
Section titled “Status on terminal tabs”Inside Rex and the Herdr app, commands that create, change or wait on sandboxes (create, run, exec, sh, rm, gc, cp, push, image build, snapshot create, and others) show their progress on the terminal tab: a spinner while they work, then done or failed. run also says which step it is on: pushing files, running the command, or destroying the sandbox. cp and push into a sandbox show a progress bar while the files upload. When run, exec or sh finishes after more than 30 seconds, you also get a desktop notification.
The CLI reports this with the Program Status Protocol (OSC 7501), written to stderr only when stderr is a terminal, so --json and piped output are unchanged. Set BEACHSIDE_PROGRAM_STATUS=on to report in other terminals that support the protocol, or off to turn it off in Rex and Herdr. Notifications use OSC 777. Set BEACHSIDE_NOTIFY_AFTER to a number of seconds to change when they appear, or to off to stop them.
To run a Rex server inside a sandbox and open it from your Mac, see Remote workspace with Rex.
Cleaning up
Section titled “Cleaning up”rm destroys a sandbox and forgets it. It only destroys sandboxes this CLI created; add --force for others. rm --all removes everything the CLI created and reports what it skipped. If some removals fail, rm keeps going and exits 8 with a list of what was removed, skipped and failed.
Sandboxes cost money while they run. run and rm are the tools for keeping that bounded; beachside ls shows anything left behind.
As a backstop for a job that is killed before it can clean up, create --ttl <duration> and run --ttl <duration> (like 30m or 2h) set how long the provider keeps that sandbox before removing it. Without --ttl, the profile’s lifecycle.lifetimeSeconds applies, 15 minutes by default. Keep it longer than --timeout for long commands. A provider that cannot apply the value rejects it before creating anything.
Privacy
Section titled “Privacy”The Beachside SDK does not track your usage. Only the CLI sends basic usage telemetry, enabled by default outside CI. You can turn it off with beachside telemetry disable or BEACHSIDE_TELEMETRY=0. See Privacy for what is collected and the available controls.
© 2026 Beachside Compute · Made by humans & in Texas