Skip to content

Environment variables

agentry env vars come in three categories:

  1. CLI behavior — set in your shell to change how the CLI works.
  2. Sandbox env — what the AI's code sees inside a sandbox.
  3. 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.

bash
AGENTRY_CONFIG=/tmp/acct2/agentry.json agentry server ls

Useful 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.

bash
AGENTRY_APP_URL=https://staging.agentry.run agentry login

Picking 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:

VariableValue
AGENTRY_APP_NAMEThe sandbox id. Use it for per-app namespacing (DB name, schema, S3 prefix).
SANDBOX_IDThe sandbox id.
AGENTRY_PROFILEThe 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:

VariableValue
AGENTRY_APP_NAMEThe deployment's slug. Matches the source sandbox by default.
AGENTRY_APP_IDThe deployment id.
PORTThe 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

agentry — run AI-built apps on your own hardware.