Skip to content

Environment Variables

NimbleBrain reads environment variables for model provider keys, server binding, public-origin resolution, rate limiting, MCP session limits, the Composio aggregator, and observability. This page lists every supported variable with its purpose, default, and precedence.

A provider’s API key can be supplied here or in nimblebrain.json under providers.<name>.apiKey. When the config field is omitted, the AI SDK falls back to the standard provider env var below. With no providers block in nimblebrain.json, each variable that is set configures its provider; with one, a variable configures nothing for a provider the block does not name (providers).

Variable Required Default Description
ANTHROPIC_API_KEY For Anthropic models — Anthropic API key. Also settable via providers.anthropic.apiKey.
OPENAI_API_KEY For OpenAI models — OpenAI API key. Also settable via providers.openai.apiKey.
GOOGLE_GENERATIVE_AI_API_KEY For Google models — Google Gemini API key (the AI SDK’s standard Google var). Also settable via providers.google.apiKey.
GREENPT_API_KEY For GreenPT models — GreenPT API key. Also settable via providers.greenpt.apiKey.
NEBIUS_API_KEY For Nebius models — Nebius Token Factory API key. Also settable via providers.nebius.apiKey.
XAI_API_KEY For xAI models — xAI (Grok) API key. Also settable via providers.xai.apiKey.

Set by npx nimblebrain when you choose a local model, and passed through by the release’s docker-compose.yml. With NB_LOCAL_MODEL_URL set, the runtime builds providers.local and points the default and fast slots at the model, unless nimblebrain.json sets them itself. A hosted provider stays configured beside it only when its key is set.

Variable Required Default Description
NB_LOCAL_MODEL_URL No — The model server’s OpenAI-compatible endpoint, e.g. http://host.docker.internal:11434/v1.
NB_LOCAL_MODEL With NB_LOCAL_MODEL_URL — The model’s id on that server. The runtime refuses to start without it.
NB_LOCAL_MODEL_CONTEXT No 32768 The context window the server allocates, in tokens.
Variable Required Default Description
NB_WORK_DIR No ~/.nimblebrain Working directory for runtime state (conversations, logs, workspaces). Does not drive config-file discovery — see config resolution.
PORT No 27247 HTTP server port. Wins over the --port CLI flag when both are set.
NB_HOST No 127.0.0.1 Address the HTTP server listens on. The default accepts connections from this machine only; 0.0.0.0 listens on every IPv4 interface (the Docker image sets it), and :: on IPv6 as well. Wins over http.host in nimblebrain.json.
NB_HOST_LOOPBACK No — A hostname that reaches the host machine from inside a container (the release Compose file sets it to host.docker.internal). Ignored, with a warning, unless instance.json uses the dev adapter, so it has no effect on a deployed instance. On a local install it lets manage_connectors add a server by its loopback URL (direct-url), admits plain http to localhost, 127.0.0.1 and ::1 as allowInsecureRemotes does, and dials such a URL at this host with the URL’s own Host header. The stored URL is kept as typed; private ranges and cloud-metadata hosts stay refused.
ALLOWED_ORIGINS No — Comma-separated additional CORS origins. The canonical origins (platform host, custom domain) are already trusted; this is for extra origins. Under the dev adapter, also the hosts the server answers besides loopback.
NB_CHAT_RATE_LIMIT No 20 Chat requests per minute per identity.
NB_TOOL_RATE_LIMIT No 600 Tool calls per minute per identity.
NB_MCP_RATE_LIMIT No 300 /mcp JSON-RPC requests per minute per identity.
NB_TIMEZONE No Pacific/Honolulu Default IANA timezone for time-aware features (e.g. task schedules) when an identity has no timezone preference.
NB_MAX_PARALLEL_TOOL_CALLS_PER_SOURCE No 6 Most tool calls the agent dispatches to any one source at a time. Only consecutive read-only calls run together (any other call runs alone, in the model’s order), so the cap applies within such a run of reads. A run of reads touching several connectors still fans out across them — only the depth against a single source is capped — so this bounds how loud the runtime can be toward one server, not overall throughput. Raise it for fast local servers; lower it for a fragile upstream. Zero, negative, fractional-below-1, and unparseable values fall back to the default: removing the bound is never the intended reading. Read once at startup. Scoped per source per agent run, which is a ceiling rather than a guarantee: concurrent runs each get their own budget, so the worst case against one server is roughly concurrent runs x this value, not this value. Size it with that multiple in mind.
NB_CONNECTOR_START_CONCURRENCY No 4 How many connectors the boot loop starts in parallel, across every workspace. The default keeps peak memory and CPU bounded on a small pod while capturing most of the serial→parallel win; raise it when a deployment has many fast connectors and boot time matters, set it to 1 for a sequential start. Values below 1 and unparseable values fall back to the default. Read once at startup.
NB_CONNECTION_REVALIDATE_INTERVAL_SECONDS No 300 Sweep interval for the connection-revalidation monitor, which re-checks connectors whose upstream credential can lapse without a transport 401 (e.g. Composio). Provider-agnostic. Blank, non-positive, or unparseable values fall back to the default. Capped at 1789569 (~20.7 days), the largest interval the runtime can schedule; a higher value logs a warning and uses the cap. To stop the sweep entirely set connectors.providers.composio.monitorEnabled: false rather than a very large interval.

Each rate limit is a token bucket: an identity may spend its whole minute’s allowance at once, then earns it back steadily over the minute. A caller a little over the rate is slowed to the rate rather than refused until the minute ends. A refused request gets 429 with Retry-After naming the seconds until the next request is admitted.

The platform builds every outward-facing URL (OAuth callbacks, post-login landing) from a single canonical public origin. Resolution order: NB_PUBLIC_ORIGIN → derived from NB_PLATFORM_HOST / NB_CUSTOM_DOMAIN → http://localhost:27247 (dev).

Variable Required Default Description
NB_PUBLIC_ORIGIN Recommended (production) derived, else http://localhost:27247 Canonical public origin (scheme + host, no path). The explicit operator override — trusted as given. Used to build the OAuth callback ${NB_PUBLIC_ORIGIN}/v1/mcp-auth/callback and the WorkOS / Composio callbacks. Must be a bare https origin (or http on a loopback host in dev); a value with a path/query throws at startup.
NB_PLATFORM_HOST No — Platform subdomain host (no scheme). Used to derive the canonical origin when NB_PUBLIC_ORIGIN is unset. Chart-forwarded in production.
NB_CUSTOM_DOMAIN No — Custom domain host. When set and canonical, becomes the derived public origin (custom domain wins).
NB_CUSTOM_DOMAIN_CANONICAL No true "true" / "false" only — anything else throws. When "false", the custom domain is served but the platform host stays canonical.
NB_WEB_URL No falls back to the canonical origin User-facing SPA origin for post-OAuth browser returns. Only needed when the API and SPA are served from different origins (e.g. dev: API on :27247, SPA on :27246).
Variable Required Default Description
NB_CURATED_CATALOG_DIR No in-image catalog The connector catalog — a directory of ServerDetail YAML/JSON files (the intended use, hence the name), or a single such file. Every *.yaml/*.yml/*.json in it is read in sorted filename order and re-read on each lookup, so editing a mounted ConfigMap takes effect without a restart. Replaces src/connectors/catalog/curated/ wholesale. This is where auth: static and brokered (composio, smithery) entries belong; the in-image catalog is NimbleBrain’s catalog of DCR connectors, taken when the image was built. See Connectors Catalog.
Variable Required Default Description
WORKOS_API_KEY When auth.adapter: "workos" and no apiKey in instance.json — WorkOS API key. Also settable via instance.json → auth.apiKey.

Required only when the connectors catalog contains any auth: composio entries (Gmail, Outlook, …). See the Composio operator guide for end-to-end setup.

The provider’s settings live in nimblebrain.json under connectors.providers.composio.

COMPOSIO_API_KEY is the one value with two sources — it is also declarable as connectors.providers.composio.apiKey, though the environment remains the better posture for a secret (why). NB_TENANT_ID is env-only.

Variable Required Default Description
COMPOSIO_API_KEY When the catalog has auth: composio entries — (fallback for …composio.apiKey) Platform-wide Composio API key — the broker credential, and the gate on registering the provider at all. Read once at startup. Without it, the Composio integration reports “not configured” and installs of auth: composio entries fail.
NB_TENANT_ID When multi-tenant pods share a Composio account — Per-pod tenant identifier prepended to the wsId so two tenants never collide in Composio’s namespace. Required in bouncer (multi-tenant) mode — startup fails without it. Single-tenant deployments can omit it.

Required only when the connectors catalog contains any auth: smithery entries. Smithery brokers the connection and hosts the MCP session; the platform stores no upstream credential.

A credential and a namespace must both resolve — a Smithery namespace is globally unique and account-owned, so there is no safe default. Setting only the key logs a warning and leaves the integration disabled.

SMITHERY_API_KEY is a fallback for connectors.providers.smithery.apiKey, because an installed connector’s transport names the smithery credential provider rather than an env var. Every other Smithery setting lives in that block only.

Variable Required Default Description
SMITHERY_API_KEY When the catalog has auth: smithery entries — Platform-wide Smithery API key, from smithery.ai/account/api-keys. Read once at startup. Fallback for connectors.providers.smithery.apiKey.
NB_TENANT_ID When multi-tenant pods share a Smithery account — Prepended to the workspace id so two tenants never collide in the namespace. Same variable as the Composio prefix above.

Vendor-neutral. Trace ids always exist for log correlation; export only happens when an OTLP endpoint is configured, so local dev and OSS checkouts need no infrastructure.

Variable Required Default Description
OTEL_EXPORTER_OTLP_ENDPOINT No — (no export) OTLP collector base URL. Unset means spans are still created (for log correlation) but nothing is exported.
NB_SERVICE_NAME No — Overrides the service name stamped on spans and structured logs.
NB_TENANT_ID No — Boot-time resource attribute stamped on spans/logs as tenant_id. (Same var as the Composio multi-tenant prefix above.)
NB_LOG_FORMAT No pretty Set to json for structured JSON logs auto-enriched with service, tenant_id, correlation_id (the active trace id), and identity. Set by the chart in production.
NB_DEBUG No — Namespace-scoped hot-path debug logging (e.g. NB_DEBUG=mcp,sse). Read once at process start.

Optional, additive error capture on top of OpenTelemetry. Off unless NB_SENTRY_ENABLED=true (the SDK is loaded only then — never inferred from DSN presence), initialized as an out-of-kernel preload that does not take over OTel tracing. NB_SENTRY_* are our own knobs (mirroring the web client), not Sentry’s auto-read SENTRY_*. Per-tenant via the chart (runtime.config.sentry.enabled). See Observability → Error reporting.

Variable Required Default Description
NB_SENTRY_ENABLED No false Explicit on/off switch. Must be true to enable; never inferred from the DSN.
NB_SENTRY_DSN No — Project DSN (required when enabled).
NB_SENTRY_ENV No — Environment tag (e.g. staging, production); one project discriminated by this tag.
NB_SENTRY_TRACES_SAMPLE_RATE No 0 Sentry performance tracing. 0 = errors only (recommended; leaves tracing to OTel).

Release is taken from the runtime’s existing NB_VERSION → NB_BUILD_SHA (no separate Sentry release var).

Variable Required Default Description
DO_NOT_TRACK No — Set to 1 to turn anonymous usage telemetry off. No one is asked.
POSTHOG_API_KEY No — Where telemetry goes. Unset ⇒ nowhere, so no one is asked and nothing is sent.
NB_TELEMETRY_ID No — The install’s anonymous ID (a UUID). npx nimblebrain sets it so its own events and the runtime’s count as one install. Unset ⇒ a random ID kept in .telemetry-id.
NB_TELEMETRY_CONSENT No — on or off: an answer a person gave an installer before the runtime first ran. An answer recorded in the runtime wins over it.

The web UI is a static build, so it cannot read pod env from JS. Instead Caddy serves /config.js dynamically from these NB_* values (set window.__NB_CONFIG__), which the client reads on boot. This lets one image be configured per tenant via Helm with no rebuild and no writable filesystem. All values are public client keys — never secrets. Unset ⇒ the corresponding feature is disabled (the OSS/self-host default).

Variable Required Default Description
NB_SENTRY_DSN No — Sentry DSN (public). Unset ⇒ client crash tracking off.
NB_SENTRY_ENABLED No false Set true to enable Sentry for this deployment (also requires a DSN).
NB_SENTRY_ENV No — Sentry environment label (e.g. staging, production).
NB_SENTRY_TRACES_SAMPLE_RATE No 0 Performance-trace sample rate, 0–1.
NB_POSTHOG_KEY No — PostHog write-only key for web analytics.
NB_POSTHOG_ENABLED No false Set true to allow web analytics (also requires a key). The client still sends nothing until the runtime reports a yes.
NB_IMG_SRC No — Extra image hosts for the UI’s img-src, space-separated (https://cdn.example.com). Set it when brand logos, favicon or catalog icons are on a host other than your own origin and static.nimblebrain.ai. Sent as a response header, not in /config.js. See Web UI headers.
NB_NOINDEX No false Set true to send X-Robots-Tag: noindex, nofollow on every response, so a private deployment stays out of search and AI crawler indexes even for a crawler that ignores robots.txt. Serve a Disallow: / robots.txt in front of it as well.

Sentry tags every event with tenant_id (from NB_TENANT_ID), workspace_id, and an opaque user.id — never email, display name, prompts, or tool content. For local development, the same values can be supplied to bun run dev as VITE_* fallbacks (see .env.example).

The canonical public origin of the deployment. Every OAuth callback URL the platform hands to a vendor is built from it:

${NB_PUBLIC_ORIGIN}/v1/mcp-auth/callback

Each OAuth app registered with a vendor (Asana, HubSpot, Gmail, …) must list this exact URL in its redirect_uri allow-list. A mismatch surfaces as a vendor-side redirect_uri does not match error at the moment a user clicks Connect.

Terminal window
export NB_PUBLIC_ORIGIN=https://nimblebrain.acme.com

The value must be a bare origin — scheme + host with no path, query, or fragment. A malformed value (a pasted full callback URL, an http origin on a non-loopback host) throws at startup rather than minting broken callbacks at first click.

In dev (bun run dev) the default http://localhost:27247 is correct without setting the variable. In production, set this explicitly (or supply NB_PLATFORM_HOST / NB_CUSTOM_DOMAIN for the chart to derive it). Pointing it at localhost, an internal cluster service name, or a stale staging URL produces confusing OAuth failures that look like vendor outages.

Sets the working directory where NimbleBrain stores runtime state.

Terminal window
export NB_WORK_DIR=/data/nimblebrain

The working directory contains workspaces/<wsId>/ (which holds each workspace’s conversations, files, and tasks), users/<userId>/, logs/, and cache/.

NB_WORK_DIR sets the workDir runtime value (where state lives). It does not select which nimblebrain.json is loaded — config-file discovery is driven by --config, a project-local .nimblebrain/, and the command’s default workdir. See config resolution.

Adds origins to the CORS allowlist beyond the canonical ones (platform host and custom domain, which are trusted automatically).

Terminal window
export ALLOWED_ORIGINS=https://app.example.com,https://admin.example.com

Separate multiple origins with commas. Whitespace around each origin is trimmed.

Under the dev adapter, which has no sign-in, the server answers only requests addressed to a loopback or configured host, and a host named here counts as configured. List the origin you open a dev instance at when it is a hostname, such as a LAN name: ALLOWED_ORIGINS=http://nimblebrain.lan:27246. See Security.

The same list decides which browser origins may call /mcp/<workspaceId> and the /v1 tool-call routes the web UI uses. See browser origins.

DO_NOT_TRACK=1 turns anonymous telemetry off and stops anyone from being asked (see Telemetry for who decides otherwise):

Terminal window
export DO_NOT_TRACK=1

DO_NOT_TRACK follows the Console Do Not Track standard. You can also disable telemetry via telemetry.enabled: false in nimblebrain.json.

When the same setting can be configured in multiple places, this is the resolution order (highest priority first):

Setting Env var CLI flag Config file Default
Working directory NB_WORK_DIR (beats all) --workdir workDir ~/.nimblebrain
Port PORT (beats --port) --port http.port 27247
Listen address NB_HOST — http.host 127.0.0.1
Public origin NB_PUBLIC_ORIGIN — derived from host facts http://localhost:27247
Anthropic key ANTHROPIC_API_KEY — providers.anthropic.apiKey —
Telemetry DO_NOT_TRACK — telemetry.enabled Enabled

A typical production setup:

Terminal window
export ANTHROPIC_API_KEY=sk-ant-api03-...
export NB_PUBLIC_ORIGIN=https://app.example.com
export NB_WORK_DIR=/data/nimblebrain
# Outside the Docker image, when a proxy on another host connects
# (the default 127.0.0.1 accepts this machine only).
# export NB_HOST=0.0.0.0
export DO_NOT_TRACK=1
# Composio connectors (only if the catalog uses auth: composio).
# Per-toolkit ac_… ids are not env vars — declare them in nimblebrain.json
# under connectors.providers.composio.authConfigs.
export COMPOSIO_API_KEY=...
# Observability
export NB_LOG_FORMAT=json
export OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318

Authentication is configured separately in instance.json, not via environment variables.