---
title: qr command reference · Sandboxes docs
description: Every qr command and option, generated from the command line's own help.
url: https://www.quietrobot.ai/docs/sandboxes/cli-reference
---

# qr command reference

Every qr command and option, generated from the command line's own help.

> [!NOTE]
> Sandboxes is in early access. Every account gets $5 of sandbox time free each month, some parts are still in testing, and details may change.

Every command takes `--json` (machine-readable output), `--api-key` and `--base-url`, after the command name. `qr <command> --help` lists the same options. For installing, signing in and common tasks, see [qr command line](https://www.quietrobot.ai/docs/sandboxes/cli).

Exit codes: the command's own exit code for `qr exec` and `qr run`; otherwise 0 when it worked, 1 for an API error or a refusal (a key the service turned down, a denied command), 2 for a usage error, and 3 from `qr secrets test` when the key's service can't be checked automatically.

## Sign in

### qr login

Sign in with your browser (or save an API key) so you don't need QR_API_KEY.

```
qr login [--with-key] [--key-stdin] [--no-browser]
```

| Argument | What it does |
| --- | --- |
| `--with-key` | Paste an API key instead of signing in with a browser |
| `--key-stdin` | Read the API key from stdin (for scripts) |
| `--no-browser` | Print the sign-in link without opening a browser |

### qr logout

Forget the saved sign-in and end it on the server.

```
qr logout [--base-url BASE_URL]
```

### qr whoami

Which key qr is using, and for which organization.

```
qr whoami [--base-url BASE_URL]
```

## Sandboxes

### qr create

Start a sandbox.

```
qr create [--name NAME] [--template TEMPLATE] [--cpu-class {standard,performance}] [--cpus {1,2,4,8,16}] [--memory-mb MEMORY_MB] [--timeout TIMEOUT] [--region REGION] [--snapshot SNAPSHOT] [--egress {deny,allowlist,open}] [--allow RULE] [--deny RULE] [--lock] [--no-lock] [--env KEY=VALUE] [--meta KEY=VALUE] [--secret NAME] [--channel NAME] [--secret-budget NAME:requests=N,usd=X] [--ephemeral] [--auto-pause SECONDS]
```

| Argument | What it does |
| --- | --- |
| `--name` `NAME` | A name |
| `--template` `TEMPLATE` | Start from this template (qr templates lists them) |
| `--cpu-class` `{standard,performance}` | Standard or Performance CPUs |
| `--cpus` `{1,2,4,8,16}` | How many vCPUs |
| `--memory-mb` `MEMORY_MB` | Memory in MB, a multiple of 256 (default 2048) |
| `--timeout` `TIMEOUT` | Session length in seconds |
| `--region` `REGION` | Where it runs |
| `--snapshot` `SNAPSHOT` | Start from this snapshot id |
| `--egress` `{deny,allowlist,open}` | Outbound network: deny (nothing), allowlist (only what --allow names) or open (the internet; private networks stay blocked) |
| `--allow` `RULE` | Allowed domain, IP or CIDR range, optional :port (repeatable) |
| `--deny` `RULE` | Blocked domain, IP or CIDR range (repeatable) |
| `--lock` | The network rules can never be widened later |
| `--no-lock` | Not locked, even if your default network is |
| `--env` `KEY=VALUE` | An environment variable for it (repeatable) |
| `--meta` `KEY=VALUE` | A label to find it by later (repeatable) |
| `--secret` `NAME` | A stored secret the sandbox may use (repeatable) |
| `--channel` `NAME` | A channel programs in the sandbox may use at $QR_CHANNELS_URL with no key, or "*" for all (repeatable) |
| `--secret-budget` `NAME:requests=N,usd=X` | A tighter limit on a secret for this sandbox's run; can only lower the secret's own budget (repeatable) |
| `--ephemeral` | Delete it when it stops (sandboxes are saved by default: files kept, deleted after 72 hours unused) |
| `--auto-pause` `SECONDS` | Pause after this many idle seconds |

### qr ls

List sandboxes.

Also: `list`.

```
qr ls [--status {starting,running,paused,stopped,error}]
```

| Argument | What it does |
| --- | --- |
| `--status` `{starting,running,paused,stopped,error}` | Only sandboxes in this state |

### qr get

Show one sandbox.

```
qr get id
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |

### qr pause

Pause a sandbox.

```
qr pause id
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |

### qr resume

Resume a paused sandbox.

```
qr resume id
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |

### qr timeout

Set the deadline to now + seconds.

```
qr timeout id seconds
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `seconds` | Seconds from now |

### qr fork

Start copies of a sandbox (its files as they are now).

```
qr fork [--count COUNT] [--snapshot SNAPSHOT] [--name NAME] [--cpu-class {standard,performance}] [--cpus {1,2,4,8,16}] [--memory-mb MEMORY_MB] id
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `--count` `COUNT` | How many copies (default 1) |
| `--snapshot` `SNAPSHOT` | Copy this snapshot instead of taking a new one |
| `--name` `NAME` | A name |
| `--cpu-class` `{standard,performance}` | A different CPU class for the copies |
| `--cpus` `{1,2,4,8,16}` | A different size for the copies (how a sandbox is resized) |
| `--memory-mb` `MEMORY_MB` | Memory in MB |

### qr clone

Start running copies of a sandbox: memory, programs and files as they are this instant.

```
qr clone [--count COUNT] [--name NAME] [--timeout TIMEOUT] id
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `--count` `COUNT` | 1 to 10 |
| `--name` `NAME` | Copies are named NAME-1, NAME-2, ... |
| `--timeout` `TIMEOUT` | Each copy's time limit in seconds from now |

### qr resize

Change a sandbox's size (copies it at the new size, then destroys the original; prints the new id).

```
qr resize [--cpus {1,2,4,8,16}] [--memory-mb MEMORY_MB] [--cpu-class {standard,performance}] id
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `--cpus` `{1,2,4,8,16}` | How many vCPUs |
| `--memory-mb` `MEMORY_MB` | Memory in MB |
| `--cpu-class` `{standard,performance}` | Standard or Performance CPUs |

### qr rewind

Put a sandbox's files back to a snapshot (the latest by default).

```
qr rewind [--snapshot SNAPSHOT] [--save-current] id
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `--snapshot` `SNAPSHOT` | The snapshot to use (default: the latest) |
| `--save-current` | Snapshot the current state first |

### qr rm

Destroy a sandbox.

Also: `destroy`.

```
qr rm id
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |

## Commands and code

### qr run

Start a sandbox, copy files in, run a command, copy results out, then destroy it; or qr run start|list|show|cancel for runs of a graph.

```
qr run [--name NAME] [--template TEMPLATE] [--cpu-class {standard,performance}] [--cpus {1,2,4,8,16}] [--memory-mb MEMORY_MB] [--timeout TIMEOUT] [--region REGION] [--snapshot SNAPSHOT] [--egress {deny,allowlist,open}] [--allow RULE] [--deny RULE] [--lock] [--no-lock] [--env KEY=VALUE] [--meta KEY=VALUE] [--secret NAME] [--channel NAME] [--secret-budget NAME:requests=N,usd=X] [--ephemeral] [--auto-pause SECONDS] [--upload LOCAL[:REMOTE]] [--download REMOTE[:LOCAL]] [--cwd CWD] [--timeout-ms TIMEOUT_MS] [--keep] ...
```

| Argument | What it does |
| --- | --- |
| `--name` `NAME` | A name |
| `--template` `TEMPLATE` | Start from this template (qr templates lists them) |
| `--cpu-class` `{standard,performance}` | Standard or Performance CPUs |
| `--cpus` `{1,2,4,8,16}` | How many vCPUs |
| `--memory-mb` `MEMORY_MB` | Memory in MB, a multiple of 256 (default 2048) |
| `--timeout` `TIMEOUT` | Session length in seconds |
| `--region` `REGION` | Where it runs |
| `--snapshot` `SNAPSHOT` | Start from this snapshot id |
| `--egress` `{deny,allowlist,open}` | Outbound network: deny (nothing), allowlist (only what --allow names) or open (the internet; private networks stay blocked) |
| `--allow` `RULE` | Allowed domain, IP or CIDR range, optional :port (repeatable) |
| `--deny` `RULE` | Blocked domain, IP or CIDR range (repeatable) |
| `--lock` | The network rules can never be widened later |
| `--no-lock` | Not locked, even if your default network is |
| `--env` `KEY=VALUE` | An environment variable for it (repeatable) |
| `--meta` `KEY=VALUE` | A label to find it by later (repeatable) |
| `--secret` `NAME` | A stored secret the sandbox may use (repeatable) |
| `--channel` `NAME` | A channel programs in the sandbox may use at $QR_CHANNELS_URL with no key, or "*" for all (repeatable) |
| `--secret-budget` `NAME:requests=N,usd=X` | A tighter limit on a secret for this sandbox's run; can only lower the secret's own budget (repeatable) |
| `--ephemeral` | Delete it when it stops (sandboxes are saved by default: files kept, deleted after 72 hours unused) |
| `--auto-pause` `SECONDS` | Pause after this many idle seconds |
| `--upload` `LOCAL[:REMOTE]` | Copy a file or folder in first (default folder: work); the command runs there |
| `--download` `REMOTE[:LOCAL]` | Copy a file or folder out afterwards (repeatable) |
| `--cwd` `CWD` | The folder to run in (relative paths start in /home/sandbox) |
| `--timeout-ms` `TIMEOUT_MS` | The command's time limit (default 10 minutes) |
| `--keep` | Don't destroy the sandbox afterwards |
| `cmd` | The command, after -- |

### qr exec

Run a command (waits for approval if a rule holds it).

```
qr exec [--cwd CWD] [--env KEY=VALUE] [--timeout-ms TIMEOUT_MS] [--no-wait] [--stdin FILE] [--background] id ...
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `cmd` | The command to run, after -- |
| `--cwd` `CWD` | The folder to run in (relative paths start in /home/sandbox) |
| `--env` `KEY=VALUE` | An environment variable for it (repeatable) |
| `--timeout-ms` `TIMEOUT_MS` | The command's time limit, in milliseconds |
| `--no-wait` | Return at once if the command needs approval |
| `--stdin` `FILE` | Send a file (or - for this stdin) to the command |
| `--background` | Start it and print its execution id; read it with qr logs |

### qr shell

Open an interactive terminal in a sandbox.

Also: `terminal`, `ssh`.

```
qr shell id ...
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `cmd` | A program to run instead of a login shell |

### qr logs

Print a command's output (follow a running one with -f).

```
qr logs [-f] execution
```

| Argument | What it does |
| --- | --- |
| `execution` | The execution id (exe_…), as qr exec --background prints it |
| `-f`, `--follow` | Keep printing until it ends |

### qr kill

Stop a running command.

```
qr kill [--signal {TERM,KILL,INT,HUP,QUIT,USR1,USR2}] execution
```

| Argument | What it does |
| --- | --- |
| `execution` | The execution id (exe_…), as qr exec --background prints it |
| `--signal` `{TERM,KILL,INT,HUP,QUIT,USR1,USR2}` | The signal to send (default TERM) |

### qr code

Run Python in the sandbox's notebook kernel (variables persist).

```
qr code id [file]
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `file` | A .py file, or - for stdin |

### qr undo

Put a sandbox's files back to just before a command ran.

```
qr undo execution
```

| Argument | What it does |
| --- | --- |
| `execution` | The execution id (exe_…), as qr exec --background prints it |

## Files

### qr cp

Copy a file or folder in or out: qr cp ./src sbx_123:app, qr cp sbx_123:out ./out.

```
qr cp src dst
```

| Argument | What it does |
| --- | --- |
| `src` | Where to copy from: a local path, or sbx_…:path |
| `dst` | Where to copy to: a local path, or sbx_…:path |

### qr cat

Print a file from a sandbox.

```
qr cat id path
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `path` | A path in the sandbox (relative paths start in /home/sandbox) |

### qr put

Upload a local file (or - for stdin).

```
qr put id local path
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `local` | A local file, or - for stdin |
| `path` | A path in the sandbox (relative paths start in /home/sandbox) |

### qr files

List a folder in a sandbox.

```
qr files id [path]
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `path` | A path in the sandbox (relative paths start in /home/sandbox) |

## Ports and links

### qr ports

List a sandbox's preview URLs.

```
qr ports id
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |

### qr expose

Give a port a preview URL.

```
qr expose [--public] [--expires EXPIRES] id port
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `port` | The port the server listens on in the sandbox |
| `--public` | Anyone with the URL (default: needs the token or share link) |
| `--expires` `EXPIRES` | Stop answering after this long: 30m, 1h, 24h, 7d (default: never) |

### qr link

Make a private link to a port that expires.

```
qr link [--expires EXPIRES] id port
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `port` | The port the server listens on in the sandbox |
| `--expires` `EXPIRES` | How long the link works: 30m, 1h, 24h, 7d (default 24h) |

### qr unexpose

Stop exposing a port.

```
qr unexpose id port
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `port` | The port the server listens on in the sandbox |

## Snapshots and volumes

### qr snapshot

Save a sandbox's files as a snapshot.

```
qr snapshot [--name NAME] id
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `--name` `NAME` | A name |

### qr snapshots

List snapshots.

```
qr snapshots [--base-url BASE_URL]
```

### qr volumes

List volumes.

```
qr volumes [--base-url BASE_URL]
```

## Keys (secrets)

### qr secrets

Keys a sandbox can use without holding them: list, set, roll, test, delete, limits.

Also: `secret`.

```
qr secrets {list,ls,set,roll,rotate,test,delete,rm,limits} ...
```

#### qr secrets list

Your secrets with allowed hosts, rules, budgets and when each was rolled (never values).

Also: `ls`.

```
qr secrets list [--base-url BASE_URL]
```

#### qr secrets set

Add a secret; prompts for the value (or reads stdin).

```
qr secrets set [--allowed-host HOST] [--stdin] [--replace] name
```

| Argument | What it does |
| --- | --- |
| `name` | The secret's name, like OPENAI_API_KEY |
| `--allowed-host`, `--allowed-hosts` `HOST` | A host the key may be sent to, like api.openai.com (repeatable, or comma separated). The key is only added to calls to these hosts. Everything else is blocked. |
| `--stdin` | Read the value from stdin even in a terminal |
| `--replace` | Replace a secret that already exists without asking |

#### qr secrets roll

Replace a secret's value: prompts for (or reads from stdin) the new key, tests it, then swaps it in.

Also: `rotate`.

```
qr secrets roll [--stdin] [--allowed-host HOST] [--yes] name
```

| Argument | What it does |
| --- | --- |
| `name` | The secret's name, like OPENAI_API_KEY |
| `--stdin` | Read the new value from stdin even in a terminal |
| `--allowed-host`, `--allowed-hosts` `HOST` | Change the allowed hosts too (default: keep them) |
| `--yes`, `-y` | Swap in a key whose service can't be tested without asking |

#### qr secrets test

Check a saved key with its service (exit 0 accepted, 1 refused, 3 can't be tested).

```
qr secrets test [--value] [--stdin] name
```

| Argument | What it does |
| --- | --- |
| `name` | The secret's name, like OPENAI_API_KEY |
| `--value` | Test a different value first, without saving it (prompts, or reads stdin) |
| `--stdin` | With --value: read it from stdin |

#### qr secrets delete

Delete a secret; sandboxes using it lose access at once.

Also: `rm`.

```
qr secrets delete [--yes] name
```

| Argument | What it does |
| --- | --- |
| `name` | The secret's name, like OPENAI_API_KEY |
| `--yes`, `-y` | Don't ask first |

#### qr secrets limits

Which calls a secret may make and how much it may be used (same as qr secret-limits).

```
qr secrets limits [--rule 'METHODS PATHS'] [--clear-rules] [--per-run requests=N,usd=X] [--per-month requests=N,usd=X] [--usd-per-request X] [--clear-budget] name
```

| Argument | What it does |
| --- | --- |
| `name` | The secret's name, like OPENAI_API_KEY |
| `--rule` `'METHODS PATHS'` | An allowed call, like 'POST /v1/chat/completions' or 'GET,HEAD /v1/models/*'; * is one path part, ** any number. Once set, other calls are refused (repeatable; replaces the list) |
| `--clear-rules` | Allow any call to the secret's hosts again |
| `--per-run` `requests=N,usd=X` | Limit for one sandbox, or one whole Playground run |
| `--per-month` `requests=N,usd=X` | Limit for a calendar month (UTC) |
| `--usd-per-request` `X` | What one call costs, for services that don't report usage |
| `--clear-budget` | Remove the budget |

### qr secret-limits

Set which calls a stored secret may make and how much it may be used.

```
qr secret-limits [--rule 'METHODS PATHS'] [--clear-rules] [--per-run requests=N,usd=X] [--per-month requests=N,usd=X] [--usd-per-request X] [--clear-budget] name
```

| Argument | What it does |
| --- | --- |
| `name` | The secret's name, like OPENAI_API_KEY |
| `--rule` `'METHODS PATHS'` | An allowed call, like 'POST /v1/chat/completions' or 'GET,HEAD /v1/models/*'; * is one path part, ** any number. Once set, other calls are refused (repeatable; replaces the list) |
| `--clear-rules` | Allow any call to the secret's hosts again |
| `--per-run` `requests=N,usd=X` | Limit for one sandbox, or one whole Playground run |
| `--per-month` `requests=N,usd=X` | Limit for a calendar month (UTC) |
| `--usd-per-request` `X` | What one call costs, for services that don't report usage |
| `--clear-budget` | Remove the budget |

## Approvals

### qr approvals

Commands a rule is holding for a person: list, approve, deny, open.

Also: `approval`.

```
qr approvals {list,ls,approve,deny,open} ...
```

#### qr approvals list

What's waiting, newest first.

Also: `ls`.

```
qr approvals list [--base-url BASE_URL]
```

#### qr approvals approve

Open a held command in the dashboard to approve it.

```
qr approvals approve [--wait] [--no-browser] id
```

| Argument | What it does |
| --- | --- |
| `id` | The execution id (exe_…) from qr approvals list |
| `--wait` | Wait for the decision and exit 0 if approved, 1 if denied |
| `--no-browser` | Print the link without opening it |

#### qr approvals deny

Open a held command in the dashboard to deny it.

```
qr approvals deny [--wait] [--no-browser] id
```

| Argument | What it does |
| --- | --- |
| `id` | The execution id (exe_…) from qr approvals list |
| `--wait` | Wait for the decision and exit 0 if approved, 1 if denied |
| `--no-browser` | Print the link without opening it |

#### qr approvals open

Open the Approvals page.

```
qr approvals open [--no-browser]
```

| Argument | What it does |
| --- | --- |
| `--no-browser` | Print the link without opening it |

## Channels

### qr channels

Messages between sandboxes: list, send, read (-f follows), take, ack, delete. Works inside a sandbox started with --channel, with no key.

Also: `channel`.

```
qr channels {list,ls,send,read,take,ack,delete} ...
```

#### qr channels list

Channels you can use, with counts.

Also: `ls`.

```
qr channels list [--base-url BASE_URL]
```

#### qr channels send

Send a message (text, or JSON with --json-body; - reads stdin).

```
qr channels send [--json-body] name body
```

| Argument | What it does |
| --- | --- |
| `name` | A name |
| `body` |  |
| `--json-body` | The message is JSON (an object, list or number), not text |

#### qr channels read

Messages after a number, oldest first.

```
qr channels read [--after AFTER] [--limit LIMIT] [--wait WAIT] [-f] name
```

| Argument | What it does |
| --- | --- |
| `name` | A name |
| `--after` `AFTER` | A message number, or "latest" for only new ones (default 0: the oldest kept) |
| `--limit` `LIMIT` | How many to show |
| `--wait` `WAIT` | Seconds to wait for a message (up to 25) |
| `-f`, `--follow` | Keep printing new messages |

#### qr channels take

Take the next message nobody has (exit 3 when none).

```
qr channels take [--lease SECONDS] [--wait WAIT] name
```

| Argument | What it does |
| --- | --- |
| `name` | A name |
| `--lease` `SECONDS` | Give it back unless acked in time |
| `--wait` `WAIT` | Seconds to wait for one (up to 25) |

#### qr channels ack

Mark a message you took with a lease as done.

```
qr channels ack name seq
```

| Argument | What it does |
| --- | --- |
| `name` | A name |
| `seq` |  |

#### qr channels delete

Delete a channel and its messages.

```
qr channels delete name
```

| Argument | What it does |
| --- | --- |
| `name` | A name |

## Flows and runs

### qr flows

Saved flows: list, get, create (from a JSON file or a recipe), draft (from plain words), update, validate, export, run, delete.

Also: `flow`.

```
qr flows {list,ls,get,create,run,delete,rm,validate,check,draft,describe,export,update,schema,logs} ...
```

#### qr flows list

Your flows, newest change first.

Also: `ls`.

```
qr flows list [--base-url BASE_URL]
```

#### qr flows get

A flow and its steps (--json for its whole graph).

```
qr flows get id
```

| Argument | What it does |
| --- | --- |
| `id` | The flow id (flw_…) |

#### qr flows create

Save a new flow from a graph file or a recipe (blank with neither); prints its id.

```
qr flows create [--recipe ID] [--name NAME] [file]
```

| Argument | What it does |
| --- | --- |
| `file` | A graph as JSON, or {graph, guards, layout, name} (or - for stdin) |
| `--recipe` `ID` | Start from a recipe (qr recipes list) |
| `--name` `NAME` | A name |

#### qr flows run

Run a flow; guards left out are the flow's.

```
qr flows run [--max-loops MAX_LOOPS] [--time-sec TIME_SEC] [--budget DOLLARS] [--cpu-class {standard,performance}] [--cpus {1,2,4,8,16}] [--memory-mb MEMORY_MB] [--wait] [--meta KEY=VALUE] id
```

| Argument | What it does |
| --- | --- |
| `id` | The flow id (flw_…) |
| `--max-loops` `MAX_LOOPS` | Guard: stop after this many loops (default 5) |
| `--time-sec` `TIME_SEC` | Guard: stop after this many seconds (default 300) |
| `--budget` `DOLLARS` | Guard: stop once it has spent this much (default 0.25) |
| `--cpu-class` `{standard,performance}` | Standard or Performance CPUs |
| `--cpus` `{1,2,4,8,16}` | How many vCPUs |
| `--memory-mb` `MEMORY_MB` | Memory in MB |
| `--wait` | Print its steps as they happen until it ends |
| `--meta` `KEY=VALUE` | A label to find it by later (repeatable) |

#### qr flows delete

Delete a flow and its versions (its runs stay).

Also: `rm`.

```
qr flows delete id
```

| Argument | What it does |
| --- | --- |
| `id` | The flow id (flw_…) |

#### qr flows validate

Check a flow JSON file or a saved flow without running it; exits 1 when it wouldn't run.

Also: `check`.

```
qr flows validate [--flow ID] [file]
```

| Argument | What it does |
| --- | --- |
| `file` | A flow JSON file (or - for stdin) |
| `--flow` `ID` | A saved flow instead of a file |

#### qr flows draft

Draft a flow from plain words with your saved Claude key, and save it.

Also: `describe`.

```
qr flows draft [--key SECRET] [--no-save] [-o FILE] description [description ...]
```

| Argument | What it does |
| --- | --- |
| `description` | What the flow should do, in plain words |
| `--key` `SECRET` | The saved Claude key to draft with (default ANTHROPIC_API_KEY) |
| `--no-save` | Only print it; don't save a flow |
| `-o`, `--output` `FILE` | Also write the flow JSON to a file |

#### qr flows export

A flow as JSON, to keep, edit or copy (qr flows create FILE).

```
qr flows export [-o FILE] id
```

| Argument | What it does |
| --- | --- |
| `id` | The flow id (flw_…) |
| `-o`, `--output` `FILE` | Write it to a file instead of printing it |

#### qr flows update

Save a flow JSON file over a flow (fields the file leaves out keep their value).

```
qr flows update [--name NAME] id file
```

| Argument | What it does |
| --- | --- |
| `id` | The flow id (flw_…) |
| `file` | A flow JSON file (or - for stdin) |
| `--name` `NAME` | A name |

#### qr flows schema

The flow JSON schema, for editors.

```
qr flows schema [--base-url BASE_URL]
```

#### qr flows logs

A run's steps and what each printed (-f follows it until it ends).

```
qr flows logs [-f] id
```

| Argument | What it does |
| --- | --- |
| `id` | A run id (run_…), as qr flows run prints it |
| `-f`, `--follow` | Keep printing until it ends |

### qr recipes

Recipes: ready-made flows to start from.

Also: `recipe`.

```
qr recipes {list,ls} ...
```

#### qr recipes list

The recipes, with their level and default guards.

Also: `ls`.

```
qr recipes list [--level {everyday,advanced}]
```

| Argument | What it does |
| --- | --- |
| `--level` `{everyday,advanced}` | Only this level |

### qr graph

Loops and graphs: forecast the cost and time of a graph, a recipe or a flow.

```
qr graph [--recipe ID] [--flow ID] [--template ID] [--max-loops MAX_LOOPS] [--time-sec TIME_SEC] [--budget DOLLARS] [--cpu-class {standard,performance}] [--cpus {1,2,4,8,16}] [--memory-mb MEMORY_MB] {templates,simulate} [file]
```

| Argument | What it does |
| --- | --- |
| `action` (`templates`, `simulate`) | Templates is the old name for qr recipes list |
| `file` | A graph as JSON (or - for stdin) |
| `--recipe` `ID` | A recipe instead of a file (qr recipes list) |
| `--flow` `ID` | A saved flow instead of a file (qr flows list) |
| `--template` `ID` | The old name for --recipe |
| `--max-loops` `MAX_LOOPS` | Guard: stop after this many loops (default 5) |
| `--time-sec` `TIME_SEC` | Guard: stop after this many seconds (default 300) |
| `--budget` `DOLLARS` | Guard: stop once it has spent this much (default 0.25) |
| `--cpu-class` `{standard,performance}` | Standard or Performance CPUs |
| `--cpus` `{1,2,4,8,16}` | How many vCPUs |
| `--memory-mb` `MEMORY_MB` | Memory in MB |

## Templates

### qr templates

List our templates and yours.

```
qr templates [--base-url BASE_URL]
```

### qr template-build

Build (or rebuild) your own template from a Dockerfile.

Also: `build`.

```
qr template-build [--description DESCRIPTION] [--no-wait] name dockerfile
```

| Argument | What it does |
| --- | --- |
| `name` | The template's name |
| `dockerfile` | Path to the Dockerfile, or - for stdin |
| `--description` `DESCRIPTION` | A line saying what the template is for |
| `--no-wait` | Return once the build has started |

### qr template

Show one of your templates.

```
qr template [--log] name
```

| Argument | What it does |
| --- | --- |
| `name` | The template's name |
| `--log` | Print the latest build's log |

### qr template-rm

Delete one of your templates.

```
qr template-rm name
```

| Argument | What it does |
| --- | --- |
| `name` | The template's name |

## Network and spending

### qr learn

Learn mode: record the hosts a sandbox reaches, then allow only those.

```
qr learn [--allow HOST] id {start,show,apply,stop}
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `action` (`start`, `show`, `apply`, `stop`) | What to do |
| `--allow` `HOST` | With apply: allow only these (default: everything seen) |

### qr spend-cap

Cap what a sandbox may spend (an API key may only lower it).

```
qr spend-cap id dollars
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `dollars` | A dollar amount, or none |

## Looking around

### qr metrics

CPU, memory, disk and network for a sandbox.

```
qr metrics [--hours HOURS] id
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `--hours` `HOURS` | How many hours back |

### qr audit

Show the audit log (for one sandbox, or the organization).

```
qr audit [--limit LIMIT] [id]
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `--limit` `LIMIT` | How many to show |

### qr report

What the agent did in a sandbox, from the audit log.

```
qr report [--pdf FILE] id
```

| Argument | What it does |
| --- | --- |
| `id` | The sandbox id (sbx_…) |
| `--pdf` `FILE` | Save it as a PDF |

### qr usage

Show this month's usage and limits.

```
qr usage [--days DAYS]
```

| Argument | What it does |
| --- | --- |
| `--days` `DAYS` | The last N days instead of this month |

### qr ai-usage

Show what your own Claude and OpenAI keys were used for, and the estimated cost.

```
qr ai-usage [--days DAYS] [--key KEY]
```

| Argument | What it does |
| --- | --- |
| `--days` `DAYS` | 1 to 400, default 30 |
| `--key` `KEY` | One key, by its secret name |

### qr policy

Show your organization's rules: defaults for new sandboxes and the approval rules.

```
qr policy [--base-url BASE_URL]
```

## Runs of a graph or flow

`qr run` followed by one of these words works with runs instead of starting a sandbox.

### qr run start

Start a run of a graph file, a recipe or a saved flow.

```
qr run start [--recipe ID] [--flow ID] [--template ID] [--max-loops MAX_LOOPS] [--time-sec TIME_SEC] [--budget DOLLARS] [--cpu-class {standard,performance}] [--cpus {1,2,4,8,16}] [--memory-mb MEMORY_MB] [--wait] [--meta KEY=VALUE] [file]
```

| Argument | What it does |
| --- | --- |
| `file` | A graph as JSON (or - for stdin) |
| `--recipe` `ID` | A recipe instead of a file (qr recipes list) |
| `--flow` `ID` | A saved flow instead of a file (qr flows list) |
| `--template` `ID` | The old name for --recipe |
| `--max-loops` `MAX_LOOPS` | Guard: stop after this many loops (default 5) |
| `--time-sec` `TIME_SEC` | Guard: stop after this many seconds (default 300) |
| `--budget` `DOLLARS` | Guard: stop once it has spent this much (default 0.25) |
| `--cpu-class` `{standard,performance}` | Standard or Performance CPUs |
| `--cpus` `{1,2,4,8,16}` | How many vCPUs |
| `--memory-mb` `MEMORY_MB` | Memory in MB |
| `--wait` | Print its steps as they happen until it ends |
| `--meta` `KEY=VALUE` | A label to find it by later (repeatable) |

### qr run list

Recent runs, newest first.

```
qr run list [--limit LIMIT]
```

| Argument | What it does |
| --- | --- |
| `--limit` `LIMIT` | How many to show |

### qr run show

A run and its steps.

```
qr run show [--wait] id
```

| Argument | What it does |
| --- | --- |
| `id` | The run id (run_…) |
| `--wait` | Follow it until it ends |

### qr run cancel

Stop a run.

```
qr run cancel id
```

| Argument | What it does |
| --- | --- |
| `id` | The run id (run_…) |
