Environment variables
agentry env vars come in three categories:
- CLI behavior — set in your shell to change how the CLI works.
- Sandbox env — what the AI's code sees inside a sandbox.
- Deployment env — what the production container sees.
Sources for (2) and (3) flow through Bindings and the deployment dashboard. This page documents (1).
CLI environment variables
The CLI honors three env vars, mainly for tests and scripts that keep state out of $HOME. See Configuration for the files they point at.
AGENTRY_CONFIG
Full path to the config file. Default: ~/.agentry/agentry.json.
AGENTRY_CONFIG=/tmp/acct2/agentry.json agentry server lsUseful for running more than one account on the same machine — point each at its own file.
AGENTRY_STATE
Full path to the pinned-sandbox state file. Default: ~/.agentry/state.json.
AGENTRY_APP_URL
Default control-plane URL for agentry init / agentry login — the same value as the --app-url flag, which wins if both are set. Default: https://app.agentry.run.
AGENTRY_APP_URL=https://staging.agentry.run agentry loginPicking the server
There's no env var for the current server. Set it with agentry server use <name>, or pin one MCP session with agentry mcp --server <name> (see the harness guides).
What sandboxes always see
Every sandbox boots with these env vars set, regardless of bindings:
| Variable | Value |
|---|---|
AGENTRY_APP_NAME | The sandbox id. Use it for per-app namespacing (DB name, schema, S3 prefix). |
SANDBOX_ID | The sandbox id. |
AGENTRY_PROFILE | The active profile the sandbox was created under (stamped when you create it through the CLI/harness). |
Plus anything from your bound services (see Bindings).
Note: a sandbox has no pre-set PORT — your app picks its own port and agentry discovers it. PORT is a deployment-only variable (see below).
What deployments always see
Every deployment container boots with these:
| Variable | Value |
|---|---|
AGENTRY_APP_NAME | The deployment's slug. Matches the source sandbox by default. |
AGENTRY_APP_ID | The deployment id. |
PORT | The port your app should listen on. Set at deploy time; default 3000. |
Plus anything from your bindings (carried through from sandbox env), plus anything you set in the deployment's Env tab.
Next
- CLI reference — every command.
- Configuration — the config file shape.
- Bindings — how bound env flows into sandboxes.
- Deployment env — the source-of-truth for production env.