> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zode.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Sandboxes

> List, make, enter, run commands in, fork, stop, start and delete sandboxes from the zode CLI.

## List

```bash theme={null}
zode ls
```

```text theme={null}
NAME        STATUS    SIZE      REGION       CREATED   ID
demo        running   small     eu-central   2h ago    sbx_q3vfn7tkx2mhcw4a
demo-fork   stopped   default   eu-central   3d ago    sbx_r7k2wbn6tdyx3lpe
```

With no sandboxes it prints `No sandboxes yet. Make one with: zode new`.

## Make

```bash theme={null}
zode new [name] [flags]
```

Leave out the name and the API picks one. Names use lowercase letters, digits and hyphens, up to 63 characters.

| Flag | Effect |
| - | - |
| `--size S` | `small`, `default`, `large` or `xlarge`. Without it you get **small**; the size named `default` is not the default. |
| `--image IMG` | Start from a [custom image](https://docs.zode.dev/cli/images.md), by name or `img_` id. The image sets the size, so you cannot combine it with `--size`. |
| `--browser` | Run Chrome in the sandbox from the start. See [Browser and desktop](https://docs.zode.dev/cli/browser-desktop.md). |
| `--desktop` | Run a Linux desktop from the start. Not on the Free plan. |
| `--environment ENV` | The [environment](https://docs.zode.dev/concepts/environments-and-secrets.md), by name or `env_` id, whose variables and secrets the sandbox reads. Default: the workspace's `default`. |
| `--repo URL` | Label the sandbox with a git repo. `zode cost --by repo` groups by it. |
| `--branch NAME` | Label the sandbox with a git branch, up to 255 characters. `zode cost --by branch` groups by it. |
| `--pr N` | Label the sandbox with a pull request number. `#42` works too. `zode cost --by pr` groups by it. |
| `--max-cost USD` | Cap the sandbox's AI spend, in dollars, such as `5` or `2.50` (more than \$0, up to six decimals). See [Spend and caps](https://docs.zode.dev/concepts/spend-and-caps.md#cap-a-sandbox). |

`--repo`, `--branch` and `--pr` are labels; they do not clone anything. Leave out `--browser` or `--desktop` and the workspace default applies; `--browser=false` turns it off explicitly.

| Size | vCPU | RAM | Disk |
| - | - | - | - |
| small | 2 | 4 GB | 50 GB |
| default | 4 | 8 GB | 50 GB |
| large | 8 | 16 GB | 110 GB |
| xlarge | 16 | 32 GB | 250 GB |

```bash theme={null}
zode new demo --size large --browser
```

```text theme={null}
demo is running (large, 8 vCPU, 16 GB, eu-central) in 12.4s
  zode ssh demo
  zode browser demo
```

On the Free plan you can run 2 sandboxes at once. A third `zode new` fails with `Your free plan runs at most 2 sandboxes at once. Stop one first.`

A workspace with no card on file and no credit left cannot make, fork or start sandboxes until someone adds a card or credit in **Billing**. See [Pricing](https://docs.zode.dev/pricing.md#when-credit-runs-out).

## Open a shell

```bash theme={null}
zode ssh <sandbox> [-- cmd ...]
```

Without a command you get a root login shell (`bash -l`) in `/workspace`. When your stdin and stdout are a terminal, the session gets a TTY and follows your window size. With `-- cmd`, it runs that command instead, the same way as [`zode exec`](#run-a-command): one argument runs through `bash -lc`, several run as is. `zode ssh` takes the same `-e` and `--env-file` flags as `zode exec`, placed before the sandbox name.

## Run a command

```bash theme={null}
zode exec [-t] [-e KEY=VALUE] [-e KEY] [--env-file FILE] <sandbox> -- cmd [args...]
```

`zode exec` streams stdout and stderr as the command runs, then exits with the command's exit code. Put the flags before the sandbox name.

| Flag | Effect |
| - | - |
| `-t`, `--tty` | Allocate a terminal (when your stdin is one). stdout and stderr merge. |
| `-e KEY=VALUE`, `--env KEY=VALUE` | Set a variable for this command. Repeat for more. |
| `-e KEY` | Pass the value of `KEY` from your own environment. Fails if it is not set. |
| `--env-file FILE` | Load `KEY=VALUE` lines. Blank lines, `#` comments and lines without `=` are skipped; a leading `export ` and quotes around values are stripped. |

The variables go on top of the sandbox's [environment](https://docs.zode.dev/concepts/environments-and-secrets.md) and travel in a header, not the URL.

How the command runs depends on how many arguments follow `--`:

* **Exactly one argument** runs through `bash -lc`, so pipes, `&&`, globs and variables work. Quote the whole command line as one argument.
* **Several arguments** run as argv, as given, with no shell.

```bash theme={null}
zode exec demo -- 'npm ci && npm test'
zode exec -e NODE_ENV=test --env-file .env demo -- npm test
cat data.json | zode exec demo -- python3 -m json.tool
```

With several arguments, a program that does not exist gives `zode: command not found: X`, and one that is not executable gives `zode: permission denied: X`. With one argument, bash reports it and the command exits 127 or 126, as in any shell.

stdin: piped input is streamed to the command. If your stdin is a terminal and you did not pass `-t`, the command gets end-of-file at once, so commands that read stdin do not hang. Without a TTY, Ctrl-C sends `INT` to the remote command instead of dropping the connection.

If the kernel kills the command for running out of memory, `zode` prints `zode: killed: out of memory (peak N MB)`. A sandbox that is not running gives `zode: demo is stopped; zode start demo`.

## Give an agent a task

```bash theme={null}
zode prompt box "fix the failing tests"
```

Runs your default coding agent (set under **Agents & proxying**, Claude Code otherwise) on one task in the sandbox and streams its output. The command exits with the agent's exit code.

| Flag | What it does |
| - | - |
| `--agent A` | `claude-code`, `codex`, `opencode`, `pi` or `kimi-code` |
| `--model M` | a model id the agent takes; defaults to the one set in the console |
| `--cd DIR` | run in this directory in the sandbox |
| `-e KEY=VALUE` | set a variable for the agent (`-e KEY` passes yours) |
| `--new` | make a sandbox first; `--size` and `--max-cost` as for `zode new` |

The agent signs in with your subscription or your keys, whichever you chose for it. It runs with its own permission prompts off, because nobody can answer them in an unattended VM.

## Fork

```bash theme={null}
zode fork <sandbox> [name] [--browser[=false]] [--desktop[=false]] [--branch B] [--pr N] [--max-cost USD]
```

The copy has the parent's memory, running processes and disk, and keeps its size, region, repo and environment. Browser and desktop follow the parent unless you pass the flags. `--branch`, `--pr` and `--max-cost` replace the parent's branch label, PR label and AI spend cap, with the same rules as on `zode new`. Flags can go anywhere on the line.

```bash theme={null}
zode fork demo demo-try-2 --browser=false
```

```text theme={null}
demo-try-2 is a copy of demo, running in 19.8s
  zode ssh demo-try-2
```

A fork counts toward your plan's running-sandbox limit.

## Stop, start, delete

```bash theme={null}
zode stop <sandbox>    # hibernate: disk and memory kept, compute billing stops
zode start <sandbox>   # wake it where it left off
zode rm <sandbox>      # delete it and its disk
```

```text theme={null}
demo is stopped
demo is running
demo deleted
```

A stopped sandbox still pays for storage once it is 48 hours old. `zode rm` cannot be undone. See [Sandboxes](https://docs.zode.dev/concepts/sandboxes.md) for the full lifecycle.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.