Environment Variables
Environment variables override stored configuration values.
Authentication & API
| Variable | Description | Default |
|---|---|---|
PRETORIN_API_KEY | API key for platform access. Overrides api_key in config file. | — |
PRETORIN_PLATFORM_API_BASE_URL | Platform REST API base URL | https://platform.pretorin.com/api/v1/public |
PRETORIN_API_BASE_URL | Backward-compatible alias for PRETORIN_PLATFORM_API_BASE_URL | — |
PRETORIN_MODEL_API_BASE_URL | Model API URL for agent runtime | https://platform.pretorin.com/api/v1/public/model |
Context
| Variable | Description | Default |
|---|---|---|
PRETORIN_SYSTEM_ID | Active system ID. Overrides the system set via pretorin context set. | — |
PRETORIN_FRAMEWORK_ID | Active framework ID. Overrides the framework set via pretorin context set. | — |
Agent Runtime
| Variable | Description | Default |
|---|---|---|
OPENAI_API_KEY | Model key for agent runtime. Used as a fallback when config.api_key (from pretorin login) is unset, and as the preferred key when --base-url points the agent at a non-platform endpoint. | — |
OPENAI_BASE_URL | Base URL for the model API endpoint. Overrides openai_base_url in config file. | — |
OPENAI_MODEL | Model name for the agent runtime. | gpt-4o |
CODEX_HOME | Set by Pretorin, not read from your shell. pretorin agent run forces CODEX_HOME=~/.pretorin/codex/ so the pinned Codex binary uses Pretorin’s managed config.toml and never reads ~/.codex/config.toml. Exporting your own value has no effect. | ~/.pretorin/codex/ |
Environment isolation for pretorin agent run
The Codex subprocess does not inherit your shell environment. Pretorin builds a
fresh environment containing exactly five variables — CODEX_HOME,
OPENAI_API_KEY, OPENAI_BASE_URL, PATH, and HOME — where the two OPENAI_*
values are the resolved model key and model base URL, not whatever you exported.
The Pretorin MCP server that Codex launches (pretorin mcp-serve) is a child of that
process, so it inherits the same five variables. Practical consequences:
PRETORIN_API_KEY,PRETORIN_SYSTEM_ID,PRETORIN_FRAMEWORK_ID, and every otherPRETORIN_*variable do not reach the agent’s tool calls. Insideagent run, the MCP server reads~/.pretorin/config.jsononly. Runpretorin loginandpretorin context setbeforepretorin agent runrather than relying on exported variables — an env-only CI setup authenticates the CLI but leaves the agent’s tools unauthenticated.HOMEis passed through, so~/.pretorin/config.json, the recipe folders, and~/.pretorin/mcp.jsonall resolve normally.- Extra MCP servers that need their own secrets (for example
GITHUB_TOKEN) must declare them in theenvblock of their~/.pretorin/mcp.jsonentry; exporting them in your shell is not enough. See Agent Runtime.
This isolation applies only to pretorin agent run. Every other pretorin command
runs in your shell and honors the variables below normally.
Source Attestation
| Variable | Description | Default |
|---|---|---|
PRETORIN_SOURCE_PROVIDERS | JSON array of source provider configurations. Overrides source_providers in config file. | — |
PRETORIN_SOURCE_MANIFEST | JSON string or file path to a source manifest. Falls back to .pretorin/source-manifest.json in the git repo root, then ~/.pretorin/source-manifest-{system_id}.json, then the source_manifest config key. | — |
Behavior
| Variable | Description | Default |
|---|---|---|
PRETORIN_DISABLE_UPDATE_CHECK | Set to a truthy value (1, true, yes, on) to disable passive update notifications. Any value set — including a falsy one such as 0 or an empty string — overrides the disable_update_check config key, so exporting 0 re-enables checks that config disabled. | — |
PRETORIN_LOG_LEVEL | Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL). An unrecognized value falls back to WARNING. | WARNING |
PRETORIN_MCP_TELEMETRY_DISABLED | Set to any non-empty value to suppress the PRETORIN_TELEMETRY_EVENT JSON lines that pretorin mcp-serve emits on stderr for tool-routing observability. | — |
PRETORIN_MCP_MAX_RESULT_BYTES | Byte budget for a single serialized MCP tool result before the response guard compacts it. Raise it for hosts that tolerate larger tool payloads. A malformed or non-positive value falls back to the default. | 40000 |
Self-Update
pretorin update runs its installer and verification steps in a subprocess whose
environment is derived from your shell, with these adjustments. Except for
PRETORIN_UPDATE_BASE_URL, you do not set any of these yourself — the rest
document what the command does to the environment it passes down.
| Variable | Description | Default |
|---|---|---|
PRETORIN_UPDATE_BASE_URL | Maintainer-only; unsupported for normal use. Redirects the signed self-updater (standalone Linux x86_64 binaries) at a different release host, so the release pipeline and its acceptance runs can be tested against a local fixture instead of the public tap. It relaxes exactly one rule — http is allowed — and tightens another: redirects may not leave the override’s host and port. It does not and cannot defeat verification: the release-signing key is embedded in the binary at build time, so a release served from any base URL is still rejected unless it carries a valid signature from that key. | the public tap |
UV_TOOL_DIR / UV_TOOL_BIN_DIR | Set by Pretorin. When the running CLI is a uv tool install (the venv contains uv-receipt.toml), both are pinned to the directories of that install so the upgrade cannot retarget a different uv tool root. | — |
PIPX_HOME / PIPX_BIN_DIR | Set by Pretorin. Same scoping for a pipx install (the venv contains pipx_metadata.json). | — |
PYTHONPATH / PYTHONHOME | Removed by Pretorin from the update subprocess. Any value you export is dropped so local files such as pip.py or pretorin.py cannot shadow the real packages during self-update. | — |
If neither installer layout is detected, the subprocess inherits your environment
unchanged apart from the PYTHONPATH / PYTHONHOME removal.
Cloud Scanner Recipes
These are standard cloud-provider SDK environment variables. Pretorin’s bundled asset-inventory recipes honor them when scanning AWS/Azure.
| Variable | Description | Default |
|---|---|---|
AWS_REGION | Single AWS region to scan for the asset-inventory-aws-baseline recipe. When unset, the recipe enumerates all regions the account has opted into and scans them concurrently. AWS_DEFAULT_REGION is honored as a fallback. | — |
AWS_DEFAULT_REGION | Fallback region used by the asset-inventory-aws-baseline recipe when AWS_REGION is unset. Standard boto3 variable. | — |
AZURE_SUBSCRIPTION_ID | Subscription ID used by the asset-inventory-azure-baseline recipe. When unset, the recipe falls back to the default subscription from az account show. | — |
Recipe Authoring
| Variable | Description | Default |
|---|---|---|
USER | Fallback author name written into the frontmatter of recipes scaffolded with pretorin recipe new. Used only when git config user.name is unavailable. | unknown |
Precedence
For the API key:
PRETORIN_API_KEYenvironment variable (highest)api_keyin~/.pretorin/config.json
For the platform API URL:
PRETORIN_PLATFORM_API_BASE_URLenvironment variable (highest)PRETORIN_API_BASE_URLenvironment variable (legacy alias)platform_api_base_urlin~/.pretorin/config.jsonapi_base_urlin~/.pretorin/config.json(legacy)https://platform.pretorin.com/api/v1/publicdefault
For the model key (agent runtime):
config.api_key(frompretorin login) — used as bearer key for the platform model proxyOPENAI_API_KEYenvironment variableconfig.openai_api_key
When --base-url is explicitly provided (i.e. pointing the agent at a non-platform endpoint), the order flips to prefer OPENAI_API_KEY first, then falls back to config keys.
For the model name:
OPENAI_MODELenvironment variable (highest)openai_modelin~/.pretorin/config.json- Org AI settings from the platform (cached)
gpt-4odefault
For the source manifest:
PRETORIN_SOURCE_MANIFESTenvironment variable (highest) — JSON string or file path.pretorin/source-manifest.jsonin the git repo root~/.pretorin/source-manifest-{system_id}.jsonsource_manifestkey in~/.pretorin/config.json
CI/CD Example
export PRETORIN_API_KEY=pretorin_your_key_here
export PRETORIN_DISABLE_UPDATE_CHECK=1
export PRETORIN_SYSTEM_ID=your_system_id
pretorin frameworks list
pretorin evidence push
These variables cover the CLI and pretorin mcp-serve. They do not carry into
pretorin agent run, which runs its subprocess in an isolated environment — see
Environment isolation for pretorin agent run.