# kosa8 cloud sandbox create

Make a cloud sandbox: a template's pooled VM, or one of a size, image and disk

With no flags, starts a sandbox from a template (the organization's default,
else base) in milliseconds. --size, --cpus/--mem-mb, --image or --disk-gb make a
sized sandbox instead: booted cold for you at that size (2x4, 4x8, 8x16 or 16x32:
vCPUs x GiB), from that OCI image, with that data disk. kosa8 waits until it is
running (--no-wait returns at once, state creating).

Images: any public OCI image, or kosa8's own, e.g.
  kosa8-template/universal-24.04-20261115.2       Ubuntu 24.04, Python, Node, Go, build tools
  kosa8-template/universal-full-24.04-20261115.2  the same plus browsers, Docker CLI and more
(kosa8 cloud images lists the templates).

--docker lets the sandbox run its own dockerd (needs a sized create).
--persistent runs every exec in one long-lived container, so the whole filesystem
and background processes last between commands (the code interpreter needs it).
--from-snapshot starts a copy of a saved snapshot (kosa8 cloud snapshot ls).

-e NAME=value sets the sandbox's own environment for every command it runs;
-e NAME takes NAME's value from this shell and --env-file reads KEY=value lines,
so a secret need not be on the command line. Values are never printed.
--secret NAME attaches an org secret (kosa8 cloud secrets): the sandbox holds only
a placeholder and the host adds the real value on the way out.

--sleep-after puts it to sleep after that long idle (0 never); --ttl or
--delete-after deletes it then. Left out, the organization's settings apply.

Many at once (RL rollouts, evals): --count N makes N alike (up to 1000) in one
call and prints their IDs, one a line. --run labels them kosa8.run=RUN (the run
heartbeat, drain and kosa8 cloud rl select by), --lease deletes each unless a
heartbeat extends it, --prefix names them PREFIX-0001, …, and --partial keeps
the ones made when some fail (else all or nothing).

Small sizes, for fleets of mostly idle sandboxes: 0.25x0.5, 0.5x1 and 1x2 reserve
(and bill) that much vCPU and burst above it while the host is idle
(kosa8 cloud sizes lists what this organization can use).

## Flags

| Flag | Type | What it does | Default |
|---|---|---|---|
| `--accept-price` | float64 | a paid Store template: its price in USD, which you agree to | `0` |
| `--ai-gateway` | bool | route its model calls through the AI gateway with the org's provider keys (kosa8 cloud ai); --ai-gateway=false opts out of the org default |  |
| `--allow` | stringArray | egress: allow only these hosts (or *.domain; repeatable) | `[]` |
| `--count` | int | make this many alike in one call (1 to 1000) and print their IDs | `1` |
| `--cpu` | string | "shared" (default) or "dedicated": each vCPU a whole physical core |  |
| `--cpus` | int | vCPUs, with --mem-mb (instead of --size) | `0` |
| `--dedicated` | bool | shorthand for --cpu dedicated |  |
| `--delete-after` | string | delete it at this time (ISO 8601, e.g. 2026-12-01T00:00:00Z) |  |
| `--deny` | stringArray | egress: block these hosts (repeatable) | `[]` |
| `--disk-gb` | int | size of its data disk in GB | `0` |
| `--docker` | bool | let the sandbox run its own dockerd (needs a sized create) |  |
| `--env, -e` | stringArray | the sandbox's environment: NAME=value, or NAME for this shell's value (repeatable) | `[]` |
| `--env-file` | stringArray | read NAME=value lines from this file (- for stdin; repeatable) | `[]` |
| `--from-snapshot` | string | start a copy of this snapshot (snap_…) |  |
| `--gpu` | string | whole GPUs, TYPE[:COUNT] (h100, b200:8, nvidia:1); only where kosa8 Cloud offers GPUs (GPU access is off by default) |  |
| `--image` | string | OCI image to boot, e.g. kosa8-template/universal-24.04-20261115.2 or python:3.12 |  |
| `--label, -l` | stringArray | a label, key=value (repeatable) | `[]` |
| `--lease` | duration | delete each sandbox this long from now unless a heartbeat extends it (1m to 24h), so a crashed trainer leaks none | `0s` |
| `--mem-mb` | int | memory in MB, with --cpus (instead of --size) | `0` |
| `--name` | string | a name for it, unique in the organization |  |
| `--no-internet` | bool | egress: no internet except what --allow and --preset let through |  |
| `--no-wait` | bool | do not wait for a sized sandbox to finish booting |  |
| `--partial` | bool | keep what was made when some fail (default: all or nothing) |  |
| `--persistent` | bool | run every exec in one long-lived container (filesystem and processes last) |  |
| `--pr` | int | with --repo OWNER/NAME: continue this pull request (check out its branch; changes go back to it only if it is a kosa8/* branch, else to a new kosa8/* branch and pull request) | `0` |
| `--prefix` | string | name them PREFIX-0001, PREFIX-0002, … |  |
| `--preset` | stringArray | egress: allow a preset, e.g. pypi or npm (kosa8 cloud egress presets; repeatable) | `[]` |
| `--region` | string | us-ash1 (Ashburn, Virginia), the only region today, or just us (default: your org's default, else us-ash1) |  |
| `--repo` | string | start from a GitHub repo: OWNER/NAME[@BRANCH\|TAG\|SHA], or . for this checkout's origin and branch (kosa8 github connect first) |  |
| `--run` | string | label every sandbox kosa8.run=RUN, the run heartbeat, drain and kosa8 cloud rl select by |  |
| `--secret` | stringArray | attach this org secret by name (repeatable; needs a sized create) | `[]` |
| `--size` | string | vCPUs x GiB: 2x4, 4x8, 8x16 or 16x32, or a small size 0.25x0.5, 0.5x1 or 1x2 (a sized sandbox, booted cold) |  |
| `--sleep-after` | duration | sleep after this long idle, e.g. 15m; 0 never (default: the organization's setting) | `0s` |
| `--template` | string | template key, e.g. base (default: the organization's default) |  |
| `--ttl` | duration | delete it this long from now, e.g. 2h (1m to 90 days) | `0s` |
| `--wait-timeout` | duration | how long to wait for a sized sandbox to boot | `5m0s` |

## Example

```
  kosa8 cloud sandbox create
  kosa8 cloud sandbox create --size 4x8 --image kosa8-template/universal-24.04-20261115.2 --docker
  kosa8 cloud sandbox create --size 2x4 --persistent --name api -e OPENAI_API_KEY --ttl 2h
  kosa8 cloud sandbox create --from-snapshot snap_0123abcd --region eu
  kosa8 cloud sandbox create --repo acme/app@main   # cloned into /workspace/app (kosa8 github connect first)
  kosa8 cloud sandbox create --repo .               # this checkout's GitHub repo and branch
  kosa8 cloud sandbox create --repo acme/app --pr 42   # continue pull request #42 on its branch
  kosa8 cloud sandbox create --size 2x4 --secret openai --allow pypi.org --allow files.pythonhosted.org
  kosa8 cloud sandbox create --count 64 --size 0.5x1 --run run_8f2k --lease 10m --prefix rollout
  id=$(kosa8 cloud sandbox create --json | jq -r .sandbox.id)
```

---
Source: https://docs.kosa8.com/reference/cloud-sandbox-create/
