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

> ## Agent Instructions
> To build and serve your own model, start at /deploy/development/quickstart and /deploy/development/overview. Deploying is the default path: reactor init scaffolds a workspace, reactor auth login authenticates, and reactor model deploy registers the model, publishes the release with the weights/ folder, and activates it on Reactor's GPUs, in one command from that workspace. Docker must be running, because the publish step builds the image locally. Bump model.version in reactor.yaml before redeploying a change, because a release that already has an image is reactivated as it is. Deployment access is granted per account, so contact team@reactor.inc if a deploy is refused. Every key in reactor.yaml is documented at /deploy/platform/reactor-yaml. Model code imports reactor_runtime; Python client code imports reactor_sdk. The runtime overview explains the model interface. Running the model on your own machine with reactor run is optional and needs a GPU you attach with --gpus; /deploy/development/local-testing covers that loop and pairs a complete brightness model with a Python client test in a separate brightness-test workspace.
> Reactor hosts multiple models, each with its own connect slug (modelName) and command/event schema. The video model catalog — slug, typed SDK package, and links to its schema — is at /model-api-reference/overview. Robotics policy documentation starts at /robotics/overview; The launch policies are Cosmos Nano DROID (/robotics/cosmos/nano-policy-droid/), DreamZero DROID (/robotics/dreamzero/droid/), and FLUX Action DROID (/robotics/flux-action/droid/), organized by model family and embodiment. Some models expose one slug per experience (e.g. HappyOyster); always take the slug from the model's own pages, never guess it.
> Fastest path to a working app: `npx create-reactor-app my-app --model=<slug>` scaffolds a complete app with secure auth wired up. Typed TypeScript SDKs are published as @reactor-models/<model>; Python uses the base reactor-sdk package.
> Auth: exchange an API key (rk_...) for a JWT via POST https://api.reactor.inc/tokens from your server. Never put the API key in client-side code.
> Append .md to any docs URL for clean Markdown. Search these docs via the MCP server at https://docs.reactor.inc/mcp.

# Environment variables and secrets

> Set variables and secrets on an environment. Learn what a rollback and an unset do.

> [!NOTE]
>
> These commands belong to the environment workflow of the `reactor` CLI. Turn it on in each
> terminal with `export REACTOR_PROJECTS_ENABLED=1`.

An environment holds two kinds of variables:

* A **plain variable** has a value that `reactor environment show` and the revision history show.
* A **secret** has a value that the Reactor API and the CLI never show after you send it.

Your model reads both from `os.environ`. Use a secret for a credential, such as an API key or a
token. Never put a credential in a plain variable.

## Before you start

* Install the CLI and log in. See [Install the CLI](https://docs.reactor.inc/deploy/platform/installation.md) and
  [Authentication](https://docs.reactor.inc/deploy/platform/authentication.md).
* Have an environment that already runs an image. The examples use `staging`.
  `reactor environment list -p your-org/your-model` lists the environments of a project.
* Know your project name, such as `your-org/your-model`. The CLI takes the project from `-p`, else
  from `REACTOR_PROJECT`, else from the nearest `reactor.yaml`. The examples name the project with
  `-p`, so a `REACTOR_PROJECT` in your shell cannot send them to another project.
* Build your image with `reactor-runtime` 3.11.6 or later. The `build.runtime_version` key in
  [`reactor.yaml`](https://docs.reactor.inc/deploy/platform/reactor-yaml#build) sets it. An older runtime does not put
  secrets in the environment of your model.

## Set your first secret

```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
reactor environment update staging -p your-org/your-model --secret API_KEY
```

Type the value at the prompt and press Enter. The prompt does not show what you type. The output
names the change and never shows the value:

```text theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
✓ Created revision 4 of staging (your-org/your-model). Rollout started:
  ~ API_KEY (secret, new)
```

A later value of the same secret shows `(secret, new version)`. A plain variable that becomes a
secret shows `(plain -> secret, new)`.

Your model reads the value from the environment:

```python theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
import os

api_key = os.environ["API_KEY"]
```

Do not print or log the value.

## What a write does

A write creates the next revision of the environment at once. Then the rollout replaces the running
instances, and the new instances get the new values. The instances of the earlier revision keep
their values until they stop. A changed plain value, a new secret value, or an unset replaces the
running instances. A write that changes nothing creates no revision.

The command waits until the rollout is ready, for at most 10 minutes. Set `--timeout` to change that
limit, or `--no-wait` to return as soon as Reactor accepts the write. When the wait ends before the
rollout is ready, the command exits with code 8. The write stays. To wait for the rollout later,
run:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
reactor status staging -p your-org/your-model --wait-for ready
```

## Set a plain variable

```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
reactor environment update staging -p your-org/your-model --var LOG_LEVEL=debug
```

`--var NAME=` sets an empty value. A variable that the command does not name keeps its value.
`reactor deploy` takes the same `--var`, `--secret`, and `--unset` flags, and applies them in the
same revision as the image that it builds.

> [!WARNING]
>
> Do not use `--var` on a name that holds a secret. The secret becomes a plain variable, and
> `reactor environment show` and the history then show its value. The output shows `(secret ->
>     plain)`. Change a secret only with `--secret`.

## Other ways to give a secret value

The value never goes on the command line. Besides the hidden prompt, the CLI reads it from standard
input or from a file:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
# Standard input, such as in a CI job
(set +x; printf '%s\r\n' "$API_KEY") | reactor environment update staging -p your-org/your-model --secret API_KEY=@-

# A file
reactor environment update staging -p your-org/your-model --secret API_KEY=@./api-key.txt
```

* For the standard input example, set the shell variable `API_KEY` to the value first. A CI job also
  needs `REACTOR_PROJECTS_ENABLED=1` and `REACTOR_API_KEY` in its environment. See
  [Authentication](https://docs.reactor.inc/deploy/platform/authentication.md).
* `set +x` turns off shell tracing in the subshell while the shell expands the value. With tracing
  on, the shell writes the value to the job log.
* Only one `--secret` can read standard input. To set several secrets in one write, read the others
  from files: repeat `--secret NAME=@path`.
* The `@-` and `@path` forms remove exactly one line ending (LF or CRLF) from the end of the value.
  To keep a line ending at the end of a value, put the value in a file that ends with two.
* The standard input example ends the value with CRLF. The CLI removes that whole line ending, so a
  value that ends with a carriage return stays as it is.
* The hidden prompt needs a terminal. Without one, the command exits with code 1 before it reads any
  value, and names the `@-` and `@path` forms.
* The CLI refuses a value on the command line and sends nothing. The value can still be in your
  shell history, so rotate it at the service that issued it:

```text theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
Error: invalid --secret "API_KEY": a value on the command line is refused and nothing was sent. The value may now be in your shell history, so rotate it at its provider. Use --secret API_KEY, API_KEY=@path or API_KEY=@-
```

## Remove a variable or a secret

`--unset` removes a plain variable or a secret:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
reactor environment update staging -p your-org/your-model --unset OLD_FLAG --unset API_KEY
```

The default output includes these lines:

```text theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
✓ Created revision 5 of staging (your-org/your-model). Rollout started:
  ~ OLD_FLAG (unset)
  ~ API_KEY (unset; was secret API_KEY)
Note: the running instances of revision 4 keep the secret API_KEY until they stop.
```

The note goes to standard error. It shows when the environment has instances before and after the
write.

An unset of a name that the environment does not have removes nothing. When the write changes other
settings, the output adds the line `OLD_FLAG was not set, so it was not removed`. A write that only
unsets such names creates no revision and exits with code 0, so a CI job can run it again. It prints
`Nothing to change: staging (your-org/your-model) already has no OLD_FLAG.`

## After a lost response

When the connection drops before the Reactor API answers, the write can still apply. The CLI does
not send the write again. It prints:

```text theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
Error: staging (your-org/your-model): the response to this write was lost, so its outcome is unknown (<cause>); compare the environment before you send the write again:
  reactor environment show staging -p your-org/your-model
```

Compare the environment with the write before you send it again:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
reactor environment show staging -p your-org/your-model -o json
```

Each secret entry carries a `version_id`, and each new value gets a new one. Note the `version_id`
of each secret before a write. After a lost response, a new `version_id` in a new revision means
that a write applied. Check that no other write, such as one from a CI job, ran in the meantime. A
second send stores another version, creates another revision, and replaces the instances again.

## Read variables and history

```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
reactor environment show staging -p your-org/your-model
reactor environment show staging -p your-org/your-model --revision 3
reactor environment history staging -p your-org/your-model
```

* `show` prints each plain variable with its value, and each secret by its name, such as
  `API_KEY (secret API_KEY)`. `--revision` prints an earlier revision.
* `show -o json` gives each secret as `{"secret": "API_KEY", "version_id": "<UUID>"}`.
* `history` lists the revisions, newest first, with who made each one and when. Its CHANGES column
  names each changed variable as `var.<name>`, and adds `(secret)` for a secret. It shows at most
  three variables for each revision, then `and N more`.
* `history -o json` gives every change, with its value before and after. For a plain variable, that
  is the value. For a secret, it is the name and the `version_id`. The history never holds a secret
  value.

## Roll back

```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
reactor rollback staging -p your-org/your-model --to 3 --dry-run
reactor rollback staging -p your-org/your-model --to 3
```

A rollback deploys the model image and the weights of revision 3 in a new revision. It keeps the
current variables and secrets, the GPU, and the instance count. A rollback to a revision without
weights clears the weights. When the environment already runs that image and those weights, the
rollback prints `Nothing to change` and creates no revision. To restore an earlier secret value, set
it again with `--secret`.

Some older revisions pin weights without a set digest, such as an `hf://` reference. When the
environment runs other weights, the CLI refuses a rollback to such a revision before it sends
anything. To run that image again, set it with `reactor environment update --image`, with weights
that have a set digest.

A rollback to a revision that pins weights can fail with `409 failed_precondition` and one of two
reasons:

| Reason | When |
| - | - |
| `set_objects_off` | Weight set objects are off for your account. |
| `weights_pin_unavailable` | The environment is `production`, and Reactor has not moved `production` to revision-based deploys. |

Until Reactor makes that move, a rollback of `production` can also fail with `release_required`. In
that state, a rollback of `production` that clears the weights keeps the instances on the weights of
the deployed release.

## Names and limits

| Rule | Limit |
| - | - |
| Name | ASCII letters, digits, and `_`. It does not start with a digit, and has at most 255 bytes. Names are case-sensitive. |
| Reserved name | Refused in any letter case. This covers each name that starts with `REACTOR_` or `KUBERNETES_`. It also covers the names that the platform sets, such as `HOST`, `PATH`, `PORT`, and `LD_LIBRARY_PATH`. |
| Secret name | Also not `LOCAL_RANK`, `MASTER_ADDR`, `MASTER_PORT`, `RANK`, or `WORLD_SIZE`, in this letter case. Distributed workers set these names themselves. |
| Secret value | Not empty, valid UTF-8, no NUL byte, and at most 32 KiB. |
| Plain value | Valid UTF-8 and no NUL byte. It can be empty. |
| Names in one environment | No separate limit on the count. The limits below still apply. |
| Plain variables of a revision | Their names and values together, at most 32 KiB. |
| All variables of a revision | The names and values of plain variables and the secret values together, at most 256 KiB. |
| Encoded secret manifest | The encoded record of all variables and secrets of a revision, at most 512 KiB. |
| Secrets in one account | 1,000 by default. An Enterprise account has the limit that Reactor sets for it. The count is the secrets in the newest revision of each environment. Plain variables, earlier revisions, and deleted environments do not count. Ask Reactor for a higher limit. |
| Secret changes in one account | 300 a minute. Each new secret value counts, and so does each removal of a secret, also a change from a secret to a plain variable. |

The CLI refuses a name or a secret value that breaks a rule before it sends the write. It does not
check a plain value, and it replaces an invalid UTF-8 byte in `--var` with the character U+FFFD. So
give each `--var` value as valid UTF-8. A write over a total size or the account count fails with
`409 failed_precondition` and a reason: `plain_variables_too_large`,
`resolved_environment_too_large`, `secret_manifest_too_large`, or `secrets_quota_exceeded`. One
write with more than 300 secret changes fails with `too_many_secret_changes`. Writes over the
per-minute rate fail with `429 quota_exceeded` and a `Retry-After` header.

> [accordion] All reserved names
>
> Every name that starts with `REACTOR_` or `KUBERNETES_`, and `CLOUD_ID`, `COORDINATOR_URL`,
> `DEPLOYMENT`, `EXIT_TIMEOUT_SECONDS`, `GRPC_PORT`, `HOST`, `HOSTNAME`, `ICE_TRANSPORT_POLICY`,
> `JAX_COMPILATION_CACHE_DIR`, `LD_LIBRARY_PATH`, `MALLOC_ARENA_MAX`,
> `MAX_SESSION_DURATION_SECONDS`, `MODEL_NAME`, `NCCL_CROSS_NIC`, `NCCL_DEBUG`, `NCCL_IB_DISABLE`,
> `NODE_NAME`, `NVIDIA_VISIBLE_DEVICES`, `ORPHAN_TIMEOUT_SECONDS`,
> `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`, `OTLP_ENDPOINT`, `PATH`, `POD_IP`, `POD_NAME`,
> `POD_NAMESPACE`, `POD_UID`, `PORT`, `PYTHONHOME`, `PYTHONPATH`, `PYTHONUNBUFFERED`, `REGION_ID`,
> `SIGTERM_GRACE_PERIOD`, `STUN_SERVERS`, `TURN_SERVERS`, `VIRTUAL_ENV`, `WEBRTC_BWE_INITIAL_KBPS`,
> `WEBRTC_BWE_MAX_KBPS`, `WEBRTC_BWE_MIN_KBPS`, `WEBRTC_CLIENT_PING_TIMEOUT_SECONDS`,
> `WEBRTC_PORT_RANGE`, `WEBRTC_SENDER_MAX_KBPS`, `WEBRTC_SENDER_MIN_KBPS`, and
> `WEBRTC_VIDEO_CODECS`.

## How your model reads them

* Plain variables and secrets are in `os.environ` when your model module imports, and in `load()`.
* The runtime sets the secrets in the environment before it imports your model module. See the
  [changelog](https://docs.reactor.inc/deploy/development/changelog.md).
* A secret cannot take a name that the runtime reads for its own configuration. The runtime then
  stops before it starts your model, and names the key.
* A variable or a secret of the environment replaces a value of the same name that the image sets,
  such as one from `build.runtime_env`. After you unset it, new instances see the value of the image
  again. To remove a credential that is in the image, build a new image.

When an instance cannot mount its secrets, it does not start. `reactor status staging` shows the
region as `failed` when no other instance of the revision serves, starts, or is `degraded` there.
`production` shows these states only after Reactor moves it to revision-based deploys.
`reactor environment instances staging` shows the slots of the instance as `failed`, with the reason
`mount_failed`. The message is `A volume of the model's pod cannot be mounted.`

## What an unset does

An unset removes a secret from the new revision at once. It is more like a scheduled deletion of the
secret. Reactor can fully delete a secret only when no instance uses it any more. The instances of
the earlier revision keep the secret until they stop in every Reactor Region.

An unset does not revoke the credential at the service that issued it.

**Retention.** Reactor cannot fully remove a secret value until no current revision of an existing
environment refers to that version of the secret. So Reactor does not promise a date for the
deletion.

**Who can read a secret.** The environment and revision APIs and the CLI never return a secret
value, to you or to Reactor staff. When your model writes a value to its logs, `reactor logs` shows
it.

## Next

> [card] [Data security](https://docs.reactor.inc/deploy/platform/security.md)
>
> How Reactor protects your weights, images, and credentials.

> [card] [Runtime changelog](https://docs.reactor.inc/deploy/development/changelog.md)
>
> The runtime release that reads secrets.


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