Skip to content

Configuration ​

All application configuration is managed through the central getConfig() function in src/lib/core/config.ts. Environment variables are the default source, but the abstraction supports swapping to database-backed configuration.

Rule: Never read process.env directly in application code. Always use getConfig().

Environment Variables Reference ​

Required ​

VariableDescriptionDefault
JWT_SECRETSecret for JWT signing (min 32 chars)—
PROVIDER_ENCRYPTION_SECRETKey that encrypts provider credentials at rest (min 32 chars, must differ from JWT_SECRET)—

Both secrets are checked at startup; see Validation.

Database ​

VariableDescriptionDefault
DB_PROVIDERDatabase backend: sqlite, mongodb or postgres (Enterprise: the community build refuses it at start-up, see PostgreSQL)sqlite
SQLITE_DATA_DIRData directory for SQLite files./data
MONGODB_URIMongoDB connection string (required when DB_PROVIDER=mongodb)—
MAIN_DB_NAMEMain database nameconsole_main
MONGODB_MIN_POOL_SIZEMin connection pool size2
MONGODB_MAX_POOL_SIZEMax connection pool size10
MONGODB_CONNECT_TIMEOUT_MSConnection timeout10000
MONGODB_SOCKET_TIMEOUT_MSSocket timeout45000
MONGODB_SERVER_SELECTION_TIMEOUT_MSServer selection timeout30000
MONGODB_SINGLE_DATABASEKeep tenant collections in MAIN_DB_NAME instead of a separate tenant_<slug> database per tenant. A second tenant is refused in this mode.true when DEPLOYMENT_MODE is onprem and DB_PROVIDER=mongodb, otherwise false
DB_TENANT_SCOPE_MISMATCHWhat a switch to another tenant does inside code that already runs in a tenant scope (the scope's tenant keeps serving its queries): warn allows it and logs a rate-limited warning, error refuses the switch.warn
TENANT_SCOPE_STRICTSet to 1 to make a tenant query outside a tenant scope throw instead of logging a warning (recommended for development and CI).off

PostgreSQL (Enterprise) ​

Only with DB_PROVIDER=postgres. One database and one schema hold every workspace; row-level security keeps tenants apart. An invalid value stops start-up. See PostgreSQL.

VariableDescriptionDefault
DATABASE_URLConnection string of the application role: not the owner of the tables and without BYPASSRLS, for example postgresql://app:password@host:5432/cognipeer.—
DATABASE_MIGRATION_URLThe role that owns the schema and runs the migrations. Empty uses DATABASE_URL (development only).(empty)
PG_APP_ROLEThe role the migrations grant table access to. Empty uses the user of DATABASE_URL.(empty)
PG_POOL_MAXConnections per process. Size it against the server's max_connections and the number of replicas.10
PG_STATEMENT_TIMEOUT_MSLimit per statement, and on every wait for a writer lock, in milliseconds (digits only). 0 turns it off. The migrations at start-up always run without it.60000
PG_SSLrequire (verify the certificate and host), no-verify or disable. When set it alone decides TLS: sslmode, ssl and sslrootcert in the URLs are ignored and start-up warns. A private CA with require: NODE_EXTRA_CA_CERTS.(unset: the URLs decide)
PG_MAX_LIFETIME_SRecycle a connection after this many seconds. 0 = never.0

Set DEPLOYMENT_MODE to onprem for a self-hosted PostgreSQL install: it defaults to saas for MongoDB and PostgreSQL.

Deployment mode ​

VariableDescriptionDefault
DEPLOYMENT_MODEsaas for the hosted multi-tenant service, onprem for an installation you run yourself.onprem when DB_PROVIDER=sqlite, otherwise saas

Only the exact values saas and onprem are read; anything else is ignored and the default applies. The default follows the database because SQLite is the self-hosted choice, so an installation that uses MongoDB starts in saas mode unless you set DEPLOYMENT_MODE=onprem. The Docker Compose file in the repository sets it to onprem.

The mode alone decides whether plan limits apply: saas always enforces them and onprem never measures them. PLAN_LIMITS_MODE and PLAN_LIMITS_DEFAULT_ENFORCEMENT are no longer read, and a plan's own enforcement setting is ignored.

What the mode changes:

Areasaasonprem
Endpoints of providers (model, embedding, image, speech, moderation, decision and file providers, the hosts of a GridFS connection string included)A private, loopback or link-local endpoint is refused. The one exception is a private network the operator has opened for the organization with PROVIDER_PRIVATE_NETWORKS; neither OUTBOUND_HTTP_BLOCK_PRIVATE_NETWORK nor OUTBOUND_HTTP_ALLOWED_HOSTS changes anything here.Private and loopback endpoints are allowed, unless OUTBOUND_HTTP_BLOCK_PRIVATE_NETWORK is set to true explicitly. The saas rule then applies, with PROVIDER_PRIVATE_NETWORKS to open networks and OUTBOUND_HTTP_ALLOWED_HOSTS to list the hosts that stay allowed.
Options of a MongoDB GridFS connection stringCertificate files (tlsCAFile, tlsCertificateKeyFile, tlsCRLFile) are refused, and so are the sign-in methods that use the identity of the server.Available (the sign-in methods unless private networks are blocked explicitly).
MONGODB_SINGLE_DATABASEDefaults to false: one database per tenant.Defaults to true with MongoDB: one database for the whole installation.
Modules for self-hosted installations (for example LDAP)Not available (404).Available; they still need the module in the licence package.
IAM engine statisticsThis tenant's own counters.Also the process-wide figures of the engine.
Plan limits (seats, quotas and rates of the workspace's plan)Always enforced.Never measured or enforced.
Support entry pointsShown only when the Support hand-off is fully configured (SUPPORT_BASE_URL, SUPPORT_CRM_API_URL and SUPPORT_HANDOFF_SECRET).Also shown when only SUPPORT_BASE_URL is set; the link then opens the Support login.

Skip TLS verification and plain http:// endpoints of storage providers (S3-compatible storage, Amazon S3 with a custom endpoint, Azure Blob) do not depend on the mode: both are the provider's own choice on every deployment, and the address rules above still apply to them.

On an installation you run yourself, set DEPLOYMENT_MODE=onprem to use storage on your internal network (a MinIO on a private address, Azurite). On a hosted deployment the operator opens that network for your organization instead, as described under Provider private networks. See Files for the rules per provider.

Changing the mode of an existing MongoDB installation

DEPLOYMENT_MODE=onprem also changes the default of MONGODB_SINGLE_DATABASE to true. An installation that has run in saas mode keeps tenant data in per-tenant databases (tenant_<slug>); after the switch Cognipeer would look for that data in the main database. Set MONGODB_SINGLE_DATABASE=false together with DEPLOYMENT_MODE=onprem to keep the data where it is.

Authentication ​

VariableDescriptionDefault
JWT_EXPIRES_INJWT token expiry. A number of seconds (604800) or a duration string (30m, 12h, 7d, 2 weeks). Validated at startup — production refuses to boot on a value it cannot parse.7d
PROVIDER_ENCRYPTION_SECRETKey that encrypts provider credentials at rest. Required: min 32 chars, must differ from JWT_SECRET.—
AUTH_LOGIN_ACCOUNT_MAX_ATTEMPTSFailed sign-ins one account may have from one client address in 15 minutes. 0 turns the per-account limit off.20
AUTH_PASSWORD_CHANGE_ENDS_SESSIONSChanging or resetting a password ends the sessions issued before it. false keeps them valid until they expire; a startup warning is logged.true
AUTH_LOGIN_TENANT_SCANLegacy: a sign-in for an address the user directory does not know is also looked up in every tenant database, and a found account is added to the directory. A startup warning is logged while it is on. false turns it off.true

Production refuses to start unless PROVIDER_ENCRYPTION_SECRET is valid, and in production credentials are never encrypted with JWT_SECRET. Outside production, an unset PROVIDER_ENCRYPTION_SECRET is reported as a configuration error and new credentials are encrypted with JWT_SECRET instead. Decryption also tries JWT_SECRET, so credentials that an earlier version saved under it stay readable and are encrypted under PROVIDER_ENCRYPTION_SECRET the next time they are saved.

Registration ​

VariableDescriptionDefault
REGISTRATION_MODEopen (anyone can sign up), beta (signup requires a beta access code), or disabled (public signup off)open
BOOTSTRAP_ORG_NAMEOn-prem bootstrap: organization name to create on first boot when no organization exists—
BOOTSTRAP_ADMIN_EMAILOn-prem bootstrap: owner user email—
BOOTSTRAP_ADMIN_PASSWORDOn-prem bootstrap: owner user password (must satisfy the password policy)—
BOOTSTRAP_ADMIN_NAMEOn-prem bootstrap: owner display nameAdministrator

With REGISTRATION_MODE=beta, seed single-use access codes into the main database with npm run seed:beta-codes -- --count 10 (or pass explicit codes; --list shows all codes and their status). The signup form then requires a valid unused code, and each code is consumed on successful registration.

For on-prem deployments, set REGISTRATION_MODE=disabled together with the three BOOTSTRAP_* variables: the server creates exactly one organization owned by the given user on first boot and public signup stays off.

Gateway (Resilience) ​

VariableDescriptionDefault
GATEWAY_REQUEST_TIMEOUT_MSRequest timeout for provider calls120000
GATEWAY_RETRY_ENABLEDEnable automatic retriestrue
GATEWAY_RETRY_MAX_ATTEMPTSMaximum retry attempts3
GATEWAY_RETRY_INITIAL_DELAY_MSInitial retry delay (exponential)200
GATEWAY_CIRCUIT_BREAKER_ENABLEDEnable circuit breakertrue
GATEWAY_CIRCUIT_BREAKER_THRESHOLDFailures before opening circuit5
GATEWAY_CIRCUIT_BREAKER_RESET_MSTime before half-open test30000

Cache ​

VariableDescriptionDefault
CACHE_PROVIDERCache backend: none, memory, redismemory
CACHE_TTL_SECONDSDefault cache TTL300
REDIS_URLRedis connection URL (required when provider=redis)—
REDIS_KEY_PREFIXKey prefix for Redis cacheconsole:

Rate Limiting ​

VariableDescriptionDefault
RATE_LIMIT_PROVIDERProvider: mongodb, memory, redis. memory and redis require the same CACHE_PROVIDER.mongodb
RATE_LIMIT_SYNC_INTERVAL_MSSync interval for distributed counters5000
RATE_LIMIT_MAX_TRACKED_KEYSCounters the in-process limiter (login and other auth endpoints, public MCP endpoints) keeps at once. When it is full, counters whose window has ended are dropped, then the ones counted least recently. A whole number from 1; any other value (0, a negative or non-numeric one, 1e5, 100,000) uses the default.100000
CLIENT_API_IP_RATE_LIMIT_PER_MINUTERequests one client address may make per minute to /api/client/* and /api/public/*, counted before authentication; over it the API answers 429. IPv6 addresses are counted per /64. The address follows TRUSTED_PROXIES, so set that first behind a proxy. 0 turns it off.0
QUOTA_POLICY_CACHE_TTL_SECONDSHow long the license and quota policies behind a limit check are cached; editing a policy through the API clears the cache at once. 0 turns the cache off, so every guarded request reads them from the database.30

Sign-in, registration, password reset and session issuance are limited per client address (request.ip, which follows TRUSTED_PROXIES). A forwarded value that is not an IP address, such as an empty or unusually long one, is limited together with every other such value instead of getting a counter of its own. A trailing port (203.0.113.9:51234, [2001:db8::1]:443) is ignored.

Service Switches ​

VariableDescriptionDefault
CONSOLE_DISABLED_SERVICESComma-separated service ids switched off for the whole deployment (e.g. browser,crawler).(empty)
CONSOLE_ENABLED_SERVICESComma-separated service ids to keep on; every other switchable service is off.(empty)

Both empty = every service on. An unknown id refuses to start in production. Service ids, dependencies and what a switched-off service does: Turning services off.

Guardrails ​

VariableDescriptionDefault
GUARDRAIL_DEFAULT_FAIL_MODEFail mode of a new guardrail created without one. auto: guardrails that run PII or prompt-shield checks fail closed, all others fail open. open: every new guardrail fails open. Guardrails that already exist keep their own setting.auto

See Guardrails.

Egress proxy ​

On a network that reaches the internet only through a corporate (forward) proxy, set the standard proxy variables on every Cognipeer process:

VariableDescriptionDefault
HTTPS_PROXYProxy for every outbound request: http://host:port, or http://user:password@host:port with special characters in the password percent-encoded. The managed browser and the crawler use it for http:// and https:// sites alike.(unset: direct)
HTTP_PROXYUsed when HTTPS_PROXY is not set.(unset)
NO_PROXYComma-separated hosts reached directly, without the proxy: localhost, 127.0.0.1, the cluster's services, internal hosts.(unset)

The managed browser and the crawler's Playwright engine launch Chromium with the proxy and with NO_PROXY as its bypass list. fetch() (model providers, webhooks and the other plain HTTP calls) goes through undici's environment proxy agent, installed at startup. The crawler's axios engine and local MCP servers (stdio) read the variables themselves.

  • Spelling. Use HTTPS_PROXY or https_proxy (likewise for the other two). A variable spelled any other way, such as HTTPS_Proxy, is adopted at startup with a warning in the log, but tools outside Cognipeer do not read it.
  • http:// for most proxies. The scheme says how Cognipeer talks to the proxy, not to the sites behind it: HTTPS sites are tunnelled through an http:// proxy with CONNECT. Use https:// only for a proxy that itself speaks TLS; otherwise every connection to it fails.
  • NO_PROXY is read differently by different clients. For the browser and the crawler a plain entry (corp.example) covers the domain and its subdomains, .corp.example its subdomains only, and CIDR ranges (10.0.0.0/8) match addresses. Node's fetch() reads a plain entry as that exact host and ignores CIDR ranges, so write internal domains in the leading-dot form (.svc.cluster.local).
  • TLS inspection. A proxy that re-signs certificates with a corporate CA needs NODE_EXTRA_CA_CERTS for Node and BROWSER_IGNORE_CERTIFICATE_ERRORS for the browser, which cannot read it.

To check the whole path, run this inside the Cognipeer container with the sites the browser cannot reach:

bash
npm run diagnose:egress-proxy -- https://www.example.com https://other.example.com

It prints the proxy configuration it found, whether each URL goes through the proxy, what the server's DNS answers, what the proxy answers when asked for the host (403: its policy does not allow the host; 407: it wants credentials), and the outcome of a real browser navigation with every request that failed. When a navigation times out, the error names the hosts the page was still waiting on: behind an allow-listing proxy those are usually third-party hosts (CDNs, fonts, analytics) the firewall does not let through.

Browser Runtime ​

VariableDescriptionDefault
BROWSER_BLOCK_PRIVATE_NETWORKBlocks localhost, link-local, private, and reserved network egress from managed browser sessions.true
BROWSER_IGNORE_CERTIFICATE_ERRORSIgnores certificate errors in the managed browser and the crawler's Playwright engine, for a TLS-inspecting proxy whose CA Chromium cannot trust. Turns certificate checks off for every page.false
BROWSER_CHROMIUM_EXTRA_ARGSExtra Chromium flags, comma-separated, appended to every launch.(empty)
BROWSER_DEFAULT_MAX_CONCURRENTDefault number of concurrent browser sessions per tenant.10
BROWSER_DEFAULT_ARTIFACT_BUCKETDefault artifact bucket key.browser-artifacts
BROWSER_ACTION_CONCURRENCYBrowser actions executed at once per node.4
BROWSER_VIEWPORT_HEIGHTDefault viewport height of a managed browser session, in pixels.800

See Browser for how a session uses them.

Outbound HTTP (SSRF Guard) ​

Services that fetch tenant-supplied URLs (tools, MCP servers, custom reranker endpoints, connected external agents, inference-monitoring pollers) route through a shared guard that blocks requests resolving to loopback, private, link-local, CGNAT, or cloud-metadata address space, and re-validates every redirect hop.

VariableDescriptionDefault
OUTBOUND_HTTP_BLOCK_PRIVATE_NETWORKBlock outbound requests to private/loopback address space from tenant-configured integrations.true
OUTBOUND_HTTP_ALLOWED_HOSTSComma-separated hostnames exempt from the block. Use a leading dot to match subdomains (e.g. .svc.cluster.local).(empty)
OUTBOUND_HTTP_DEFAULT_TIMEOUT_MSDefault timeout for guarded outbound requests.30000
PROVIDER_PRIVATE_NETWORKSPrivate ranges that provider endpoints may reach, per organization. Entries are separated by ;; each is <tenantId>=<cidr>[,<cidr>...], and * in place of a tenant ID opens the ranges for every organization. IPv4 and IPv6 CIDRs are accepted (a bare address means one host); host names are not. Whitespace is ignored and two entries for one organization merge. An entry or range that cannot be read opens nothing and is logged as an error at startup. Example: "64f0c0ffee1234567890abcd=10.50.0.0/16,fd12:3456::/48;*=100.64.10.0/24". See Provider private networks.(empty: nothing is opened)
PROVIDER_PRIVATE_NETWORKS_DENYComma-separated CIDRs that stay refused even inside an opened range. Set it to the cluster's pod and service ranges and to any other internal range. An entry that cannot be read closes every opened network until it is fixed.(empty)
PROVIDER_RUNTIME_GUARDwarn or enforce. What happens when a provider call made at request time (model, embedding, image, speech, moderation, OCR and web search) targets an address the provider rules refuse. warn keeps the path the call took before the setting existed and logs a warning (once per host every 10 minutes); enforce refuses the call. Endpoints are always checked when a provider is saved.warn
CRAWLER_ALLOW_PRIVATE_NETWORK_OPT_INWhether a crawler's allowPrivateNetwork setting takes effect. When off, the setting is ignored and the crawler follows the private-network block. Turning it on for a saas deployment logs a startup warning.true for onprem, false for saas
CRAWLER_RESOLVED_PRIVATE_POLICYWhat the crawler does with a host name that resolves to a private address (and with internal-only names such as .svc or .cluster.local): refuse blocks the request, warn allows it and logs a warning per host at most every 10 minutes.warn for onprem, refuse for saas

Self-hosted deployments that legitimately call in-network services (e.g. a vLLM server on a private IP) should list those hosts in OUTBOUND_HTTP_ALLOWED_HOSTS rather than disabling the guard globally.

Endpoints that a person types into a provider (model, embedding, image, speech, moderation, decision and file providers) follow the deployment mode instead of that global default. In saas mode the block is always on and the allow-list does not apply; networks opened with PROVIDER_PRIVATE_NETWORKS are the exception. In onprem mode private addresses are allowed unless OUTBOUND_HTTP_BLOCK_PRIVATE_NETWORK is set to true explicitly; only then do OUTBOUND_HTTP_ALLOWED_HOSTS entries matter for providers. For file providers the check runs when the provider is saved or tested and each time its storage client is built, and the client's connections are checked when they are opened. See Providers and Files.

Provider private networks ​

Provider endpoints (model, embedding, image, speech, moderation, decision and file providers) are checked by a guard of their own. On SaaS it always refuses private, loopback and link-local addresses; on a self-hosted installation it does so only when OUTBOUND_HTTP_BLOCK_PRIVATE_NETWORK is explicitly true. A customer's own store or model server often sits on a private address of the customer's network, which the operator has connected to the deployment with a VPN or a peering. PROVIDER_PRIVATE_NETWORKS opens those networks for chosen organizations, and PROVIDER_PRIVATE_NETWORKS_DENY keeps ranges closed inside them:

bash
PROVIDER_PRIVATE_NETWORKS="64f0c0ffee1234567890abcd=10.50.0.0/16,fd12:3456::/48;*=100.64.10.0/24"
PROVIDER_PRIVATE_NETWORKS_DENY="10.244.0.0/16,10.96.0.0/12"
  • A private address is allowed for an organization only when it lies inside one of its ranges (or a * range) and is not one of the addresses that are never opened. A name is resolved and every address it answers with has to pass. Public addresses are decided as before. For a file provider the rule applies again each time its storage client is built and a connection is opened.
  • An entry or a range that cannot be read opens nothing and is logged as an error at startup; the readable ranges of the same entry still apply. A deny list with an entry that cannot be read opens nothing for anyone until it is fixed, because what it was meant to keep out is unknown.
  • Both settings are read once, when Cognipeer starts, on every Cognipeer process (a worker node included, see Cluster): restart every replica after changing them. The startup log has one line with the counts (organizations with ranges of their own, opened ranges, ranges opened for every organization, deny ranges), an error line that lists the entries that cannot be read, and a warning for an opened range that overlaps an address that is never opened.
  • They apply wherever the provider guard blocks private targets: always on SaaS and, on a self-hosted installation, only with OUTBOUND_HTTP_BLOCK_PRIVATE_NETWORK=true (hosts in OUTBOUND_HTTP_ALLOWED_HOSTS keep passing there). Webhooks, tools, MCP servers, alert channels, browser sessions, the crawler, OCR webhooks and imports are not covered: they follow the OUTBOUND_HTTP_* settings above.
  • Never opened, whatever the entries say: loopback, link-local (which holds the cloud metadata services), multicast and reserved addresses, the IPv6 forms that carry an IPv4 address, Cognipeer's own addresses and the ranges in PROVIDER_PRIVATE_NETWORKS_DENY. The names localhost and *.localhost stay refused as well.

Private networks on SaaS describes the procedure, the complete list of addresses that are never opened, how to find a tenant ID, and how mongodb+srv:// connection strings are checked.

Networking (Reverse Proxy Trust) ​

Fastify's request.ip — the value the auth rate limiter, quota keys and the audit log all key on — is resolved through this trust boundary. It decides which immediate peer is allowed to set X-Forwarded-For and have it believed; a request from anywhere else always resolves to the raw socket address, never a header.

VariableDescriptionDefault
TRUSTED_PROXIESComma-separated list of the IP addresses or CIDR ranges of your reverse proxies or load balancers (for example 10.0.0.0/8,192.168.1.5). Only a request that comes from one of them has its X-Forwarded-For believed.(empty: every hop is trusted)
IAM_VALIDATE_REQUESTSSet to 1 to validate every authorization request against the engine's schema (diagnostics; adds about 0.1 ms per decision).off

There is no switch for the authorization engine itself: it decides every request. See IAM.

TRUSTED_PROXIES takes addresses and ranges, not a hop count. A single whole number (1, 2) is not a number of hops: the list then trusts no proxy at all, X-Forwarded-For is ignored and every request resolves to the address of the connection that reached Cognipeer, which behind a proxy is the proxy itself.

The empty default trusts every hop (X-Forwarded-For is believed unconditionally) — this preserves behavior for existing deployments, but means any caller who can reach the process directly can forge their own client IP. With NODE_ENV=production and the variable unset, Cognipeer logs a startup warning saying so. Set TRUSTED_PROXIES to your actual proxy's address as soon as you put one in front of Cognipeer; on-prem installs behind nginx/an ingress controller should set this explicitly rather than rely on the default. If your proxy sets only X-Real-IP (not X-Forwarded-For), configure it to also set X-Forwarded-For — this app no longer reads X-Real-IP directly.

Token IP allowlists and the ip condition of access policies are stricter than the rest. With TRUSTED_PROXIES set they use the address resolved through the listed proxies. With it unset they use the direct connection address and ignore forwarded headers altogether, so a caller cannot claim an allowed address; behind a proxy every caller then looks like the proxy and an allowlist never matches until the proxy is listed. See Authentication.

MCP Gateway Limits ​

Limits on the MCP gateway: what a failed tool call and a server's request log keep, the pool of stdio subprocesses, the SSE transport, and the public (unauthenticated) endpoints. Secret values the server holds (its upstream credential, stdio environment values, runtime headers) are masked as [REDACTED] in the error text before it is cut to length or stored.

VariableDescriptionDefault
MCP_ERROR_MESSAGE_MAX_CHARSLongest error message a failed tool call hands back to its caller (minimum 256).8192
MCP_LAST_ERROR_MAX_CHARSLongest lastError message stored on an MCP server record (minimum 64).2048
MCP_LAST_ERROR_THROTTLE_MSAn identical lastError is not written again within this window. 0 writes every time.60000
MCP_LOG_TOOL_NAME_MAX_CHARSLongest tool name stored in an MCP request-log row (minimum 16).200
MCP_LOG_USER_AGENT_MAX_CHARSLongest caller user-agent stored with an MCP request-log row (minimum 16).300
MCP_UPSTREAM_TIMEOUT_MSLongest a call to the upstream of an OpenAPI or remote MCP server may take, headers and body together (minimum 1000).90000
MCP_UPSTREAM_MAX_RESPONSE_BYTESLargest response body read from that upstream; a bigger one fails the call (minimum 65536).8388608
MCP_ALLOWED_ORIGINSComma-separated browser origins that may call the MCP endpoints besides the app's own (APP_URL): exact origins or *.example.com wildcards. A request whose Origin header is not allowed gets 403; a request without one (server-side MCP clients) is not affected.(empty)
MCP_SERVER_INFO_NAMEserverInfo.name the gateway answers initialize with.cognipeer-mcp-gateway
MCP_INVOKE_CONCURRENCYConcurrent MCP tool invocations per node when calls are routed through the job queue.4
MCP_STDIO_ENABLEDAllow stdio (npx/uvx) MCP servers to run as subprocesses of the gateway. Set false, 0, no or off to disable.true
MCP_STDIO_MAX_CONCURRENTStdio (npx/uvx) MCP subprocesses running at once, all tenants together.8
MCP_STDIO_MAX_CONCURRENT_PER_TENANTOne tenant's share of them; a call over it is refused with an error saying so. 0 leaves only the process-wide limit, which suits an installation with a single tenant.half of MCP_STDIO_MAX_CONCURRENT, at least 1

SSE streams ​

The legacy SSE transport keeps one open stream per client (GET …/sse), fed by POST …/message?sessionId=…. A session belongs to the caller that opened it: a message naming a session that does not exist, or that another token (or the public endpoint) opened, is answered 404. A stream over a limit is answered 429 or 503 with a Retry-After header and a JSON body. 0 turns a limit off.

VariableDescriptionDefault
MCP_SSE_MAX_SESSIONSOpen streams per process. Streams on public endpoints stop at 75% of it, so API-token callers keep room.2000
MCP_SSE_MAX_SESSIONS_PER_IPOpen streams one client address may hold on the public endpoints.50
MCP_SSE_IDLE_TIMEOUT_MSA stream that has received no message for this long is closed. The keep-alive comments the gateway sends do not count.1800000
MCP_SSE_MAX_BUFFERED_BYTESA stream whose unsent output (a client that stopped reading) exceeds this is closed.8388608
MCP_SSE_KEEPALIVE_MSInterval of the comment frame that keeps a quiet stream open through proxies.25000

The endpoint event carries the path of the message URL (/api/…/message?sessionId=…), never an absolute URL. MCP clients resolve it against the URL they opened the stream on, so it does not depend on APP_URL or on the request's Host and X-Forwarded-* headers, and a client may reach the gateway under any hostname.

With several replicas and a Redis relay, a message for a stream on a public endpoint may reach a different replica than the one holding the stream: the response is relayed to that replica, provided the stream was opened on the same endpoint by an anonymous caller. Streams opened with an API token stay on the replica that holds them, so route their POST …/message calls to the same replica (session affinity) or use the streamable HTTP transport instead.

Public endpoints ​

Servers whose access mode is public answer at /api/public/mcp/… without a token. Those routes accept JSON bodies only (415 otherwise), answer a request over its rate with 429 and a Retry-After, and report a failed tool call without the upstream's text: Tool execution failed or Upstream request failed (status N), followed by the id of the request-log row that holds the detail. Invalid arguments and unknown tool names are reported as such (JSON-RPC -32602). Calls are also logged with the caller's address and user agent, and with smaller payloads than token calls.

VariableDescriptionDefault
MCP_PUBLIC_RATE_LIMIT_PER_MINUTERequests per client address and endpoint per minute (and ten times that per address across all public endpoints). 0 turns these limits off.300
MCP_PUBLIC_ENDPOINT_RATE_LIMIT_PER_MINUTERequests per endpoint per minute from all callers together, whatever address they appear to come from. Unset, it is twenty times MCP_PUBLIC_RATE_LIMIT_PER_MINUTE. 0 turns it off.6000
MCP_PUBLIC_BODY_LIMIT_BYTESLargest request body a public POST may carry (minimum 1024).1048576
MCP_PUBLIC_MAX_INFLIGHT_PER_TENANTTool calls one tenant may have running at once through its public endpoints; a call over it gets 503. 0 turns the cap off.100
MCP_PUBLIC_LOG_PAYLOAD_LIMIT_BYTESLargest request or response payload a public call stores in the request log (minimum 256).16384
MCP_PUBLIC_MAX_ARGUMENT_CHARSLongest string a public tool call may carry in its arguments, at any depth; a longer one fails the call (minimum 256).32768

The client address is the one Fastify resolves; when the gateway runs behind a reverse proxy, list the proxy in TRUSTED_PROXIES so the address cannot be supplied by the caller. The per-endpoint rate (MCP_PUBLIC_ENDPOINT_RATE_LIMIT_PER_MINUTE) does not depend on the address. An endpoint used by many people behind one corporate gateway may need MCP_PUBLIC_RATE_LIMIT_PER_MINUTE raised, since everyone behind an address shares that address's rate. The counters are kept under the server's stored ids and per process; with RATE_LIMIT_PROVIDER=redis the per-endpoint limits are shared by all replicas.

Cluster & Queue ​

VariableDescriptionDefault
NODE_ROLENode role: main, worker, or allall
NODE_NAMEUnique node name (used in the cluster registry)<hostname>-<pid>
NODE_URLPublic URL of this node (informational)(empty)
NODE_TAGSComma-separated tags of this node(empty)
NODE_HEARTBEAT_MSHow often the node writes its heartbeat10000
NODE_OFFLINE_AFTER_MSA node is marked offline after this gap without a heartbeat30000
CLUSTER_DEFAULT_NODE_NAMEDefault node for new instance assignmentsFirst online node
QUEUE_PROVIDERQueue backend: auto, memory, bullmqauto (bullmq when Redis is configured)
QUEUE_REDIS_URLRedis URL for BullMQFalls back to REDIS_URL
QUEUE_PREFIXBullMQ key prefixconsole:q:
QUEUE_DEFAULT_ATTEMPTSDefault retry attempts per job3
QUEUE_DEFAULT_BACKOFF_MSDefault backoff between retries1000
CRAWLER_RESTART_ORPHANED_RUNSRe-queue crawl runs that were in flight when the process stopped (each run a bounded number of times). false fails them for a manual re-run instead.true

See Cluster for the full topology / assignment model.

Job concurrency ​

Jobs a node works on at once, per job type. Each is a whole number from 1; restart to change.

VariableDescriptionDefault
AGENT_CHAT_CONCURRENCYInteractive agent chat turns4
AGENT_RUN_CONCURRENCYAgent background runs, default class4
AGENT_DEFERRED_CONCURRENCYAgent deferred runshalf of AGENT_RUN_CONCURRENCY, at least 1
AGENT_RUN_CALLBACK_CONCURRENCYAgent run callback deliveries4
WEBHOOK_CONCURRENCYOutgoing webhook deliveries8
MCP_INVOKE_CONCURRENCYMCP tool invocations routed through the queue4
CRAWLER_RUN_CONCURRENCYCrawl runs2
RAG_INGEST_CONCURRENCYKnowledge Engine documents indexed in the background2
RAG_REINDEX_CONCURRENCYKnowledge Engine re-index jobs1
VECTOR_MIGRATION_CONCURRENCYVector index migration jobs2
EVALUATION_RUN_CONCURRENCYEvaluation runs2
DATASET_GEN_CONCURRENCYDataset generation jobs2
ANALYSIS_RUN_CONCURRENCYAnalysis runs2
REDTEAM_SCAN_CONCURRENCYRed-team scans2
BATCH_ITEM_CONCURRENCYBatch items4
SNAPSHOT_JOB_CONCURRENCYSnapshot jobs2

BROWSER_ACTION_CONCURRENCY is in Browser Runtime. Enterprise modules have job variables of their own on their module pages.

Portal Address ​

Enterprise portals open at /p/{portalKey} on the Cognipeer host. With one of these settings they get an address of their own, and /p links are sent on to it. Nothing changes while all three are empty. See Portal address.

VariableDescriptionDefault
PORTAL_BASE_DOMAINWildcard mode: each workspace's portals at https://<workspace slug>.<base>/{portalKey}, with the portal chooser at /. Needs a wildcard DNS record and certificate for *.<base>. Must not contain the Cognipeer host (APP_URL).(empty)
PORTAL_HOSTOne fixed host without a wildcard, for example assistant.example.com. Must not be the Cognipeer host.(empty)
PORTAL_HOST_TENANTThe slug of the workspace PORTAL_HOST serves. Empty: the workspace of the person's session, as /p does. Needs PORTAL_HOST.(empty)

An invalid value stops Cognipeer from starting when NODE_ENV=production. People still sign in on the Cognipeer host (password, LDAP and SSO are unchanged, so identity providers need no new redirect URI), and signing out of a portal also ends the Cognipeer session. Portal links use the scheme and port of APP_URL, so production needs an https APP_URL.

Channels ​

Slack and Microsoft Teams channels for agents (Enterprise). See Slack and Microsoft Teams channels. The Teams messaging endpoint is built from APP_URL (the older NEXT_PUBLIC_APP_URL is read too), and the channels service switch turns the feature off.

VariableDescriptionDefault
CHANNELS_INBOUND_CONCURRENCYIncoming messages each node handles at the same time (1 to 64). Restart to change.8
CHANNELS_TEAMS_EXTRA_SERVICE_HOSTSComma-separated extra hostnames Cognipeer may send Teams replies to, for Microsoft clouds not in the built-in list. Exact host names only.(empty)

Entity Health & Alerting ​

Health views, alert rules and reports for agents, models, knowledge bases, MCP servers and tools read 5-minute rollups that every node buffers in memory and flushes to the database. See Monitoring for how alert rules use them and Agent Tracing for how a session's status is decided.

VariableDescriptionDefault
ENTITY_METRICS_FLUSH_MSHow often buffered rollup increments are written to the database (minimum 1000). Alert evaluation only reads data older than this, so a longer interval delays alerts by the same amount30000
ENTITY_METRICS_RETENTION_DAYSRollup buckets older than this many days are expired (database TTL plus an hourly purge, minimum 1). Health ranges and baselines cannot look further back than this45
ENTITY_METRICS_MAX_BUFFERED_ROWSCap on distinct rollup rows buffered per process (minimum 100); new rows beyond the cap are dropped and counted, existing rows keep accumulating50000
ENTITY_METRICS_MAX_BUFFERED_ROWS_PER_TENANTCap on distinct rollup rows one tenant may hold in the buffer (minimum 100), so a single tenant cannot use up the share of the others; the effective cap is the lower of this and ENTITY_METRICS_MAX_BUFFERED_ROWS. Excess new rows are dropped and counted per tenant10000
TRACING_STALE_SESSION_MINUTESA traced session still in_progress this many minutes after its last activity is marked abandoned (minimum 5). An abandoned session is not an error360
TRACING_FINALIZER_INTERVAL_MSHow often stale traced sessions are swept (minimum 10000)300000
ALERT_CHANNEL_TIMEOUT_MSPer-channel timeout when delivering an alert notification: webhook, Slack, Teams and PagerDuty (minimum 1000)10000
ALERT_DEFAULT_RULES_ON_CREATENew projects and the Default Project of a new workspace get the five default alert rules (the default set of the rule templates, each a threshold rule on the error rate of every entity of its module). false turns that default off; a project can still add them from Alerts → Templates, and a create request that sends defaultAlertRules: true still gets themtrue

OTLP sessions are closed earlier than the stale window: one that has been quiet for 10 minutes (or the stale window, whichever is shorter) is finalized as success or error instead of abandoned. The 10 minutes are fixed.

Agent Runs ​

VariableDescriptionDefault
AGENT_STATE_MAX_BYTESCap on one stored conversation state document (the turn snapshot plus, while a run waits for an approval or an answer, the paused copy), as stored: compressed and base64 (100000 to 15000000). The default suits Cosmos DB for MongoDB RU (2 MB document limit); MongoDB and Cosmos vCore (16 MB) can go up to 15 MB. A state over the cap is trimmed, tool outputs first. A pause that still does not fit ends the run as failed1500000

Operator settings for background runs, triggers and reminders, read once at start-up. What each one does is explained in Background runs and Reminders.

VariableDescriptionDefault
AGENT_SYNC_TIMEOUT_MSHow long a synchronous call waits for its run; after that the call answers 202 and the run keeps going (minimum 5000). Keep it below the shortest infrastructure timeout in the deployment600000
AGENT_BACKGROUND_MAX_DURATION_MSLongest wall-clock time any run may take (minimum 10000)1800000
AGENT_RUN_MAX_ACTIVE_PER_TENANTDefault-class runs queued or running per tenant, every mode; 0 = no cap250
AGENT_RUN_MAX_ACTIVE_PER_PROJECTThe same per project; 0 = off0
AGENT_DEFERRED_MAX_RUNNING_PER_TENANTDeferred (low priority) runs executing at once per tenant2
AGENT_DEFERRED_MAX_QUEUED_PER_TENANTDeferred runs queued or scheduled per tenant; over it a new run is refused with 42910000
AGENT_DEFERRED_MAX_WAIT_MSA deferred or scheduled run that has not started this long after it was due fails as expired (minimum 60000)86400000
AGENT_RUN_DRAIN_TIMEOUT_MSOn shutdown, how long to wait for local runs before marking the rest interrupted; kept below SHUTDOWN_TIMEOUT_MS minus 3 seconds10000
AGENT_RUN_REQUEUE_AFTER_MSA queued run that no worker picked up is published again after this long (minimum 10000)120000
AGENT_RUN_HEARTBEAT_INTERVAL_MSHow often a running run records that it is alive (minimum 1000)15000
AGENT_RUN_HEARTBEAT_STALE_MSA running run whose heartbeat is older than this is declared lost (at least three heartbeat intervals)45000
AGENT_RUN_RETENTION_DAYSHow long run records are kept30
AGENT_SESSION_EVENT_RETENTION_DAYSHow long a session's event log is kept30
AGENT_TRIGGER_TICK_MSHow often the trigger scheduler looks for due slots (minimum 5000)30000
AGENT_TRIGGER_MISFIRE_GRACE_MSA missed trigger slot older than this is skipped, a younger one fires once to catch up3600000
AGENT_WEBHOOK_BODY_LIMIT_BYTESLargest incoming webhook-trigger body (16384 to 26214400); a larger one gets 4135242880
AGENT_WEBHOOK_RATE_LIMIT_PER_MINUTERuns one webhook trigger may start per minute; 0 = off. Counted per node unless RATE_LIMIT_PROVIDER=redis60
AGENT_REMINDERS_ENABLEDfalse: agents cannot set reminders and due reminders do not runtrue
AGENT_REMINDER_MIN_DELAY_SECONDSShortest reminder delay any agent may use (minimum 30)60
AGENT_REMINDER_MAX_HORIZON_HOURSFurthest ahead any agent may set a reminder (1 to 720)168
AGENT_REMINDER_MAX_ACTIVE_PER_SESSIONScheduled reminders one session may hold at once10
AGENT_REMINDER_MAX_FIRES_PER_SESSIONReminders one session may ever create (a repeating one counts once)100
AGENT_REMINDER_SERIES_ENABLEDfalse: no agent may set repeating reminders; waiting series end at their next occurrencetrue
AGENT_REMINDER_SERIES_MAX_ACTIVE_PER_USERCeiling for the running repeating reminders of one person and one agent (1 to 100; an agent defaults to 5)20
AGENT_REMINDER_SERIES_MAX_DAYSCeiling for how long a series may run (1 to 366)90
AGENT_REMINDER_SERIES_MAX_OCCURRENCESCeiling for the occurrence count of a series (1 to 1000)90
AGENT_REMINDER_SERIES_MAX_PER_MONTHCeiling for the occurrences of one series in 30 days (1 to 744; an agent defaults to 62)744
AGENT_DURABLE_RUNSDurable runs: a background run's turn is checkpointed and an orphaned run continues on another node. false turns it offtrue
AGENT_CHECKPOINT_INTERVAL_MSLongest time between two checkpoints of a durable run's turn (minimum 1000)10000
AGENT_RUN_MAX_RECOVERIESTimes an orphaned durable run is continued elsewhere before it fails with worker_lost (0 to 10)2

Concurrency settings (AGENT_RUN_CONCURRENCY, AGENT_DEFERRED_CONCURRENCY, AGENT_RUN_CALLBACK_CONCURRENCY, AGENT_CHAT_CONCURRENCY) are listed under Job concurrency.

Agent Canvas ​

Platform-wide limits of the Canvas feature (the enterprise canvas module). They are not changeable per agent.

VariableDescriptionDefault
AGENT_CANVAS_ENABLEDfalse: no agent is offered the canvas tools. Stored canvases stay readabletrue
AGENT_CANVAS_MAX_CONTENT_BYTESLargest canvas version, in UTF-8 bytes (1024 to 4194304)262144
AGENT_CANVAS_MAX_PER_CONVERSATIONCanvases one conversation may make20
AGENT_CANVAS_MAX_VERSIONSVersions kept per canvas besides version 1; older ones are pruned (minimum 2)100
AGENT_CANVAS_MAX_BYTES_PER_OWNERBytes of all versions of one person's canvases (minimum 65536)52428800
AGENT_CANVAS_MAX_EDITS_PER_CALLFind/replace pairs in one canvas_edit call (1 to 100)20
AGENT_CANVAS_STATE_INLINE_BYTESThe open canvas's content is put in each turn's context up to this size (0 to 262144)24576
AGENT_CANVAS_READ_CHUNK_BYTESBytes canvas_read returns per call (4096 to 1048576)65536

Outgoing Webhooks ​

Delivery of webhook subscriptions (see Webhooks). A failed delivery is retried on the schedule below; a 3xx answer or a blocked address disables the endpoint at once.

VariableDescriptionDefault
WEBHOOK_TIMEOUT_MSTimeout of one delivery attempt (minimum 1000)10000
WEBHOOK_RETRY_SCHEDULE_SECONDSComma-separated seconds to wait before retry 1, 2, and so on. Unreadable input keeps the default60,300,1800,7200,21600,43200,86400
WEBHOOK_AUTO_DISABLE_HOURSAn endpoint that has failed continuously for longer than this is disabled72
WEBHOOK_DELIVERY_RETENTION_DAYSSettled delivery records older than this are deleted30
WEBHOOK_CONCURRENCYDeliveries sent at once per node8

Knowledge Engine Ingest ​

Used when a client posts an ingest with async: true: the document is stored as pending and chunked and embedded by a job instead of inside the request.

VariableDescriptionDefault
RAG_INGEST_CONCURRENCYDocuments indexed at once per node2
RAG_INGEST_BOOT_RESUME_MAXPending documents re-published per start-up sweep500

MCP OAuth ​

Defaults for MCP servers whose upstream authentication is OAuth 2.0: one shared connection or each person's own. See OAuth 2.0 for a remote server.

VariableDescriptionDefault
MCP_OAUTH_DEFAULT_CONNECTION_MODEThe connection mode of an OAuth server that has none set: tenant (one shared account) or user (each person's own)tenant
MCP_OAUTH_TENANT_FALLBACKtrue allows "the person's own, else the shared connection" (user_then_tenant)false
MCP_OAUTH_UNATTENDED_RUNSWhat a per-person server does in a trigger, schedule or flow run, where nobody can sign in: deny or accountable_userdeny
MCP_OAUTH_PERSON_CHANNELSWhat a per-person server does when called from a channel, the API or an MCP client: own (the person's own connection) or denyown
MCP_OAUTH_NOTIFY_REFUSEDE-mail the person when a call needed their connection (once a day per server)true
MCP_OAUTH_AUTHORIZE_TIMEOUT_SECONDSHow long a paused agent turn waits for the person to connect (minimum 60)900

MCP Request Logging ​

VariableDescriptionDefault
MCP_LOG_CLIENT_METAStore the params._meta an MCP host sends with a tool call in the request-log row, under _client.meta. Bounded, sensitive values masked, coordinates never stored. false stores nothingtrue
MCP_LOG_CLIENT_META_MAX_BYTESLargest serialized _meta kept per request-log row. Keys beyond it are dropped and the row is marked _truncated (minimum 256)2048

See MCP Servers.

Data Retention ​

One policy ages out every log the console writes. The engine runs in every edition. It starts in dry run, so nothing is deleted until you set RETENTION_DRY_RUN=false. See Data retention before you do.

VariableDescriptionDefault
RETENTION_ENGINE_ENABLEDScheduled sweeps. With false only the scheduled sweeps stop; Clean now still workstrue
RETENTION_DRY_RUNSweeps only count and record what they would delete or redact. Turn off after checking npm run retention:inventorytrue
RETENTION_INTERVAL_SECONDSHow often the cluster-wide tick queues the sweeps (minimum 60)3600
RETENTION_BUDGET_SECONDSHow long one sweep slice may run before it queues its continuation (10 to 840)240
RETENTION_BATCH_SIZERows per delete or redact batch (50 to 5000)500
RETENTION_SHORTEN_DELAY_HOURSHow long a shortened duration waits before it applies (0 to 168; 0 is immediate)24
RETENTION_AUDIT_MIN_DAYSFloor for the audit class, for every workspace and every purge (minimum 30)365
RETENTION_RECORDS_DAYSHow long destruction records are kept (minimum 1095)1095
RETENTION_ENFORCE_CLASSESComma-separated classes to enforce even while RETENTION_DRY_RUN is on (for example content). Malformed or unknown classes stop start-upunset
RETENTION_ENFORCE_TENANTSPilot workspaces, on top of the above: slug:class,class;slug2:class. A malformed value stops start-upunset
RETENTION_PLAN_DOWNGRADE_GRACE_DAYSGrace for a lower plan cap, and for a new or lower gateway or agent-file cap (0 to 90)14
RETENTION_<CLASS>_DAYSDeployment default for one data class: CONTENT, TELEMETRY, TRACE, JOBS, METRICS, ALERTS, AUDIT, USAGE, RESULTS, CONVERSATIONS. Unset or 0 uses the class default (for CONVERSATIONS: kept until the user deletes it); the value is then clamped to the class range. For example the TELEMETRY class is RETENTION_TELEMETRY_DAYS (default 90, range 30 to 400)class default
RETENTION_<CLASS>_MAX_DAYSOptional deployment cap for one class (same class names, for example RETENTION_TELEMETRY_MAX_DAYS=180). It lowers the ceiling (the class maximum on SaaS, 3650 days on-premises) for every workspace and setting, and never overrides a class floorunset

The tracing retention sweep and its interval variable no longer exist. Traces age out only under the retention policy (the trace class), and a trace session stays until the daily rollups cover its day. The quota policy maxTracingRetentionDays is retired: setting it answers 400 retired_limit.

Logging ​

VariableDescriptionDefault
LOG_LEVELLog level: error, warn, info, debugdebug (dev) / info (prod)
LOG_FORMATOutput format: json, prettypretty (dev) / json (prod)
LOG_REQUEST_BODYLog request bodiesfalse
LOG_RESPONSE_BODYLog response bodiesfalse

CORS ​

VariableDescriptionDefault
CORS_ENABLEDEnable CORS for client APIfalse
CORS_ALLOWED_ORIGINSComma-separated allowed origins—
CORS_MAX_AGEPreflight cache duration (seconds)86400

SMTP (Email) ​

VariableDescriptionDefault
SMTP_HOSTSMTP server hostsmtp.gmail.com
SMTP_PORTSMTP server port587
SMTP_SECUREUse TLSfalse
SMTP_USERSMTP username—
SMTP_PASSSMTP password—
SMTP_FROMFrom addressFalls back to SMTP_USER
SENDGRID_API_KEYSendGrid API key; used through SendGrid SMTP when SMTP_* credentials are absent—
SENDGRID_FROM_EMAILVerified SendGrid sender address—

Invitation emails go through SendGrid when it is configured; if you use it for outbound mail, check that invited users receive the password-setup email through the provider you intend.

Application ​

VariableDescriptionDefault
APP_URLServer-side public application URL, used in emails and generated links. Preferred over NEXT_PUBLIC_APP_URL.http://localhost:3000
NEXT_PUBLIC_APP_URLLegacy fallback for APP_URLhttp://localhost:3000
SHUTDOWN_TIMEOUT_MSGraceful shutdown timeout15000
DOCS_BASE_URLRoot of the docs site that the Documentation panel and every docs link in Cognipeer open. Set it to a copy of this site that people's browsers can reach when they cannot reach the public one (an installation without internet access). Read at start-up, no rebuild needed. When the site does not answer, the panel shows a notice and a link instead of an empty frame.https://docs.cognipeer.com
NEXT_BODY_SIZE_LIMITLargest request body the server accepts by default: a whole number with an optional b, kb, mb or gb unit (10mb). A value that does not read this way uses 10mb.10mb
TRACING_MAX_BODY_SIZE_MBMax tracing payload size10
HEALTH_ENDPOINT_ENABLEDEnable health endpointstrue
HF_ENDPOINTHugging Face Hub API used by GPU Fleet model search and suggestions. Set a mirror or proxy for installs that cannot reach the public Hub (an http(s) URL; anything else keeps the default). A host you set here may be on the private network.https://huggingface.co
AUTHZ_STRICT_REGISTRATIONFor developers: 1 makes the API refuse to build when a route declares no authorization. Always on under NODE_ENV=test; otherwise an undeclared route is logged at start-up and refused at request time.off
PROVIDER_RUNTIME_CACHE_TTL_SECONDSRuntime pool entry TTL. 0 turns expiry off (entries are still replaced when a provider's configuration changes).300
PROVIDER_RUNTIME_DISPOSE_GRACE_SECONDSHow long an evicted runtime keeps its connections open before they are closed, so a request that still holds it can finish. 0 closes immediately. See Runtime Pool.300

Files ​

VariableDescriptionDefault
FILE_UPLOAD_MAX_MBLargest single file an upload may carry, in MB. An upload request body may be that size as base64 plus 64 KiB. Stored files are read back (download, preview, zip) up to the larger of twice this value and 100 MB.50
FILE_UPLOAD_ALLOWED_MIME_TYPESComma-separated allow-list of content types; image/* style wildcards work. An upload of another type is refused with 415. Empty allows any type.(empty)

See Files for the other limits of the Document Store.

Document extraction (OCR) ​

These apply only where a Knowledge Engine module, an agent, an upload or a crawler turns OCR on; with OCR off nothing here is used. See OCR jobs.

VariableDescriptionDefault
OCR_DEFAULT_LANGUAGESLanguages (ISO 639-1) the local engine reads when a setting names none. The bundled data covers tr and entr,en
OCR_MAX_PAGESPages read by OCR per document when a setting names no limit100
OCR_MAX_PAGES_LIMITThe largest page limit a setting may ask for500
OCR_MODEL_CONCURRENCYConcurrent calls to an OCR or vision model inside one document4
OCR_LOCAL_CONCURRENCYPages recognised in parallel inside one document by the local engine1
OCR_LOCAL_MAX_DOCSDocuments the local engine reads at once per node1
OCR_CALL_TIMEOUT_MSOne OCR call (a page, an image or a whole-document request)180000
OCR_DOCUMENT_TIMEOUT_MSA whole document read by a job. When it is reached the document keeps its native text and a warning is recorded900000
OCR_INLINE_TIMEOUT_MSA whole document read while the request waits120000
OCR_TESSDATA_DIRDirectory with <lang>.traineddata.gz files for the local engine. Empty uses the bundled Turkish and English data(empty)
OCR_ITEM_CONCURRENCYItems of an OCR job processed at once per node5

License ​

VariableDescriptionDefault
LICENSE_GRACE_DAYSDays past its expiry a license package still activates, with a warning14
OFFLINE_LICENSE_PUBLIC_KEYPublic key (PEM) that verifies an offline license. Use \n escapes for a multi-line value in an environment variable. Takes precedence over the path(empty)
OFFLINE_LICENSE_PUBLIC_KEY_PATHFile that holds that public key(empty)
OFFLINE_LICENSE_ISSUERIssuer an offline license must namecognipeer
OFFLINE_LICENSE_AUDIENCEAudience an offline license must namecognipeer-console

Licenses are activated per workspace under Settings → License; there is no license variable. See Licensing.

Enterprise modules ​

The variables of the persistent sandbox (SANDBOX_*) are on Agent Sandbox. The ones below belong to modules that are part of a licence package.

JavaScript sandbox ​

Limits of the platform's isolated JavaScript executions (V8 isolates).

VariableDescriptionDefault
JS_SANDBOX_DEFAULT_MAX_CONCURRENTDefault concurrent executions per workspace5
JS_SANDBOX_DEFAULT_TIMEOUT_MSDefault execution timeout5000
JS_SANDBOX_MAX_TIMEOUT_MSLongest execution timeout that can be asked for30000
JS_SANDBOX_MEMORY_LIMIT_MBV8 isolate memory limit64
JS_SANDBOX_MAX_CODE_SIZE_BYTESLargest submitted code65536
JS_SANDBOX_MAX_RESULT_SIZE_BYTESLargest serialized result524288
JS_SANDBOX_MAX_LOG_ENTRIESMost console log entries captured100
JS_SANDBOX_CHILD_PROCESS_TIMEOUT_BUFFER_MSHow long after the timeout the parent kills the worker process1000

Realtime voice (Enterprise, realtime module) ​

The ones already described on Realtime (REALTIME_PUBLIC_URL, REALTIME_MAX_SESSIONS, REALTIME_MAX_FRAME_BYTES, REALTIME_MAX_PENDING_INPUT_BYTES, REALTIME_MAX_SOCKET_BUFFER_BYTES) are not repeated.

VariableDescriptionDefault
REALTIME_STREAM_TOKEN_SECRETKey the Twilio media-stream tokens are encrypted and signed withderived from JWT_SECRET
REALTIME_OUTBOUND_CALLS_PER_MINUTEOutbound calls per workspace per minute (0 = unlimited). Counted through RATE_LIMIT_PROVIDER, so it holds across nodes; a counter that cannot be read refuses the call (503)30
REALTIME_CALL_BLOCKED_PREFIXESDestinations outbound calls may not dial (empty = none blocked)+1900,+979,+870,+881,+882,+883
REALTIME_CALL_ALLOWED_PREFIXESWhen set, outbound calls may only dial these prefixes, for example +90,+44(empty)
REALTIME_MODELS_DIRWhere the bundled turn-detection ONNX models live (Docker image: /app/models/realtime)./models/realtime
REALTIME_SILERO_VAD_PATHExplicit Silero VAD .onnx file, used as is(empty)
REALTIME_SMART_TURN_PATHExplicit Smart Turn .onnx file for the selected variant, used as is(empty)
REALTIME_SMART_TURN_VARIANTint8 (quantized, smaller) or fp32 (unquantized; CPU cost depends on the hardware)int8
REALTIME_PREWARM_MODELS1 loads the models when the server starts (lowest first-call latency). Otherwise the first session loads them(unset)
REALTIME_MODEL_LOAD_TIMEOUT_MSA session waits this long for the models, then starts degraded and swaps them in when they land5000
REALTIME_ONNX_WORKERSInference worker threads. Unset: starts with 2 and grows on demand up to max(2, cores - 2), at most 8; N fixes the pool; 0 runs in the main process(unset)
REALTIME_SMART_TURN_THREADSONNX threads per Smart Turn call (1 to 8)1
REALTIME_MAX_AUDIO_BYTESLargest buffered input audio per manual commit26214400
REALTIME_MAX_HISTORYConversation messages kept per session; the oldest drop first200
REALTIME_SESSION_RETENTION_DAYSDelete sessions and their turns older than this many days (0 = keep)0
REALTIME_RETENTION_INTERVAL_SECONDSHow often that retention sweep runs3600

Config Source Abstraction ​

The config module uses a ConfigSource interface, making it easy to swap between ENV-based and database-backed configuration:

typescript
interface ConfigSource {
  readonly name: string;
  get(key: string): string | undefined;
}

The default EnvConfigSource reads from process.env. You can replace it:

typescript
import { setConfigSource } from '@/lib/core/config';

setConfigSource(myDatabaseConfigSource);

Validation ​

At startup, critical configuration is validated:

typescript
const cfg = getConfig();
const errors = validateConfig(cfg);
// Checks: MONGODB_URI required, JWT_SECRET required (min 32 chars),
// PROVIDER_ENCRYPTION_SECRET required (min 32 chars, different from JWT_SECRET),
// REDIS_URL required when CACHE_PROVIDER=redis, etc.

Every error is logged. In production the server then refuses to start, so a misconfigured value (for example a missing or invalid JWT_SECRET, PROVIDER_ENCRYPTION_SECRET or JWT_EXPIRES_IN, or an invalid service switch or portal address) fails loudly at deploy time instead of serving requests under a forgeable session token or a setting that silently did not apply. In any other environment it keeps running and logs a warning that some features may not work, which lets Kubernetes secrets be injected after the first start.

Example .env.local ​

SQLite mode (default, zero dependencies) ​

bash
# Required
JWT_SECRET=your-secret-key-must-be-at-least-32-chars
PROVIDER_ENCRYPTION_SECRET=another-secret-key-of-at-least-32-chars

# Database (SQLite is the default — no MongoDB needed)
# DB_PROVIDER=sqlite
# SQLITE_DATA_DIR=./data

# Cache
CACHE_PROVIDER=memory

# Logging
LOG_LEVEL=debug
LOG_FORMAT=pretty

# CORS (for client SDKs)
CORS_ENABLED=true
CORS_ALLOWED_ORIGINS=http://localhost:3001,http://localhost:5173

MongoDB mode ​

bash
# Required
JWT_SECRET=your-secret-key-must-be-at-least-32-chars
PROVIDER_ENCRYPTION_SECRET=another-secret-key-of-at-least-32-chars

# Database
DB_PROVIDER=mongodb
MONGODB_URI=mongodb://localhost:27017

# Cache
CACHE_PROVIDER=memory
# REDIS_URL=redis://localhost:6379

# Logging
LOG_LEVEL=debug
LOG_FORMAT=pretty

# CORS (for client SDKs)
CORS_ENABLED=true
CORS_ALLOWED_ORIGINS=http://localhost:3001,http://localhost:5173

# SMTP (optional)
# SMTP_HOST=smtp.gmail.com
# SMTP_USER=your@email.com
# SMTP_PASS=your-app-password

Studio · Pulse · Console · Agent SDK and more — the Cognipeer documentation hub