Skip to main content

Environment Variables

This page lists the environment variables read by each Breign service. Values in the "Default" column apply when the variable is not set. Values marked "example" must be adapted to your setup.

Breign API​

Breign API reads its configuration with the config module: each variable below overrides a key in config/default.json. The Docker image sets NODE_ENV=production, which also applies config/production.json. This is why a few defaults differ in the image.

Variables whose value is written as JSON (true, false, lists) are parsed as JSON: write true, not "true". A configuration key with no dedicated variable can be overridden with NODE_CONFIG. It holds a JSON object that is merged into the configuration (for example NODE_CONFIG='{"services":{"mails":{"from":"breign@example.com"}}}').

Development defaults

Secrets have public default values, meant for local development (AUTHENTICATION__API_KEY, AUTHENTICATION__AUTH_SECRET, AUTHENTICATION__JWT__PRIVATE_KEY, ENCRYPTION__SECRET, SERVICES__DOCUMENTS_SERVICE__API_KEY…). Replace all of them in a deployment.

Server and logs​

VariableDescriptionDefault
PORTPort the HTTP server listens on.8080
SERVER__HOSTFull public URL of the API. Used to build callback URLs (OAuth, webhooks, file links, MCP) and the OAuth audience.http://localhost:8080
SERVER__HOSTNAMEAddress the server listens on. With the default value, the API can only be reached from its own machine. In a container, set 0.0.0.0.localhost
SERVER__APP_HOSTPublic URL of Breign APP. Used for the OAuth sign-in and consent pages, for browser sign-in from the CLI and Mate, and for links sent by email. If it stays local while SERVER__HOST is not, a warning is logged at startup.http://localhost:3000
LOGGER__LEVELMinimum log level (error, warn, info, http, verbose, debug, silly). Logs are written as JSON to standard output. At debug level, logs also contain fragments of the responses streamed while the agent uses its tools, whatever the value of LOGGER__SENSITIVE. Use info if your logs must not contain conversation content.debug in the Docker image (info outside the image)
LOGGER__SENSITIVEAllows content (conversation messages, prompts, tool arguments) to be written to the logs. JSON value true or false. Only has an effect with LOGGER__LEVEL=debug. Keep it false on any environment that handles real data.false in the Docker image (true outside the image)

Database​

VariableDescriptionDefault
SERVICES__PERSISTENCE__TYPEDatabase to use: mongodb or pg (PostgreSQL). With pg, migrations (npm run migrate) must run before startup.mongodb
SERVICES__PG__URIPostgreSQL connection URI (if SERVICES__PERSISTENCE__TYPE=pg).postgresql://admin:password@localhost:5432/postgres
SERVICES__MONGODB__URIMongoDB connection URI (if SERVICES__PERSISTENCE__TYPE=mongodb).mongodb://127.0.0.1:27017/ai-brain-dev
SERVICES__MONGODB__DATABASEMongoDB database name. Replaces the old SERVICES__MONGODB__DBNAME variable, which is no longer read.ai-brain-dev

File storage​

VariableDescriptionDefault
SERVICES__FILES__PROVIDERFile storage: MINIO (any S3-compatible storage), GOOGLE (Google Cloud Storage, using the environment's service account credentials) or AZURE (Azure Blob Storage).GOOGLE in the Docker image (MINIO outside the image)
SERVICES__FILES__BUCKET_NAMEBucket (or Azure container) for private files: knowledge, attachments, workspaces.Required
SERVICES__FILES__PUBLIC_BUCKET_NAMEBucket (or Azure container) for public files: avatars, logos, agent images.Required
SERVICES__FILES__ENDPOINTS3 storage host, without protocol (MINIO).localhost
SERVICES__FILES__PORTS3 storage port (MINIO).9000
SERVICES__FILES__USE_SSLConnect to the S3 storage over HTTPS (MINIO).false
SERVICES__FILES__REGIONS3 storage region (MINIO).eu-west-1
SERVICES__FILES__ACCESS_KEY_IDS3 access key ID (MINIO).Development key, must be replaced
SERVICES__FILES__SECRET_ACCESS_KEYS3 secret access key (MINIO).Development key, must be replaced
SERVICES__FILES__AZURE_ACCOUNT_NAMEAzure storage account name (AZURE).β€”
SERVICES__FILES__AZURE_ACCOUNT_KEYAzure storage account key (AZURE).β€”
SERVICES__FILES__LOGOS_PUBLIC_BASE_URLBase URL of the tool preset logos (tool library). Only read by the migration that creates these presets.Breign CDN URL
SERVICES__FILES__LOGOS_BUCKET_NAMENot read in the current version.β€”

Knowledge bases (vector databases)​

VariableDescriptionDefault
SERVICES__QDRANT__HOSTFull Qdrant URL, including protocol and port (for example https://qdrant.example.com:6333), for Qdrant knowledge bases. The protocol decides whether TLS is used.http://localhost:6333
SERVICES__QDRANT__API_KEYQdrant API key. Empty: no authentication.β€”
SERVICES__QDRANT__PORT, SERVICES__QDRANT__USE_TLSNot read in the current version: the port and TLS come from SERVICES__QDRANT__HOST.β€”
SERVICES__WEAVIATE__HOSTWeaviate host, without protocol (for example weaviate.example.com), for Weaviate knowledge bases.localhost:8090
SERVICES__WEAVIATE__SCHEMEProtocol used to connect to Weaviate: https or http.http
SERVICES__WEAVIATE__AUTHENTICATIONWeaviate authentication: API_KEY or NONE.NONE
SERVICES__WEAVIATE__API_KEYWeaviate API key (if API_KEY).β€”
SERVICES__WEAVIATE__VECTORIZERWeaviate vectorizer module for knowledge bases that do not use a Breign embedding model: text2vec-ollama or text2vec-openai.β€”
SERVICES__WEAVIATE__VECTORIZER_API_KEYKey that Weaviate sends to the vectorizer service (x-api-key and X-OpenAI-Api-Key headers), with text2vec-ollama.β€”
SERVICES__WEAVIATE__OLLAMA__HOSTOllama URL that Weaviate uses to vectorize (with text2vec-ollama).β€”
SERVICES__WEAVIATE__OLLAMA__VECTORIZER_MODELDefault embedding model for Weaviate knowledge bases. With Ollama, the model must be downloaded on the instance.text-embedding-3-large
SERVICES__OLLAMA__VECTORIZER_MODEL_DIMENSIONSVector dimension of this model. Replaces the old SERVICES__WEAVIATE__OLLAMA__VECTORIZER_DIMENSIONS variable, which is no longer read.3072
SERVICES__EMBEDDING__BATCH_SIZENumber of texts sent per request to the embedding model when indexing into a Qdrant knowledge base. Batches are sent one after the other: a transient error (for example a 429) only retries its own batch. Weaviate knowledge bases vectorize on their own and are not affected.96
SERVICES__EMBEDDING__MAX_ATTEMPTSNumber of attempts for an embedding batch before indexing of the document fails. The document is then retried according to SERVICES__PARSING_ORDERS__RETRY_DELAYS_MS.4
SERVICES__EMBEDDING__RETRY_BASE_DELAY_MSDelay, in milliseconds, before the second attempt of an embedding batch. It doubles on each following attempt.1000
KNOWLEDGE__MAX_IMAGES_PER_TOOL_CALLMaximum number of images, extracted from documents by Breign Document API, sent to the model for a single knowledge search result. 0 = no images. Images are only sent to models that accept images, and never when anonymization is on.5
CONVERSATION_KNOWLEDGE__DEFAULT_TOKEN_THRESHOLDSize, in tokens, above which documents attached to a conversation are indexed and searched instead of being placed whole in the context, when the agent does not set its own threshold.100000
UPLOAD__CONVERSATION_ATTACHMENT_MAX_BYTESMaximum size, in bytes, of a conversation attachment.15728640 (15 MB)

Document parsing​

Breign API and Breign Document API share a work queue in the database. Breign API does not call Breign Document API.

VariableDescriptionDefault
SERVICES__DOCUMENTS_SERVICE__API_KEYKey that Breign Document API sends to Breign API in its parsing callbacks (x-api-key header). It must equal the API_KEY of Breign Document API. Only used for documents submitted through POST /parsing with a callback_url. Replace it with a secret value in every deployment: the default value is accepted as is.TO_DEFINE
SERVICES__PARSING_ORDERS__GLOBAL_LIMITMaximum number of parsed documents being indexed at the same time by Breign API, across all instances (knowledge files and conversation attachments).8
SERVICES__PARSING_ORDERS__PER_ORGANIZATION_LIMITSame limit, per organization. Documents without an organization are not subject to it.4
SERVICES__PARSING_ORDERS__LEASE_MSTime, in milliseconds, after which a document being processed by an instance that stopped responding is put back in the queue, or marked as failed if it has no attempts left. Also applies to documents held by Breign Document API: keep it consistent with its PARSING_LEASE_SECONDS.300000
SERVICES__PARSING_ORDERS__LEASE_HEARTBEAT_MSInterval, in milliseconds, at which an instance indexing a document reports that it is still active. Must stay well below SERVICES__PARSING_ORDERS__LEASE_MS.60000
SERVICES__PARSING_ORDERS__MAX_ATTEMPTSNumber of indexing attempts for a document before it is marked as failed.3
SERVICES__PARSING_ORDERS__RETRY_DELAYS_MSDelays, in milliseconds, before each new indexing attempt (JSON list; the last delay is repeated).[60000, 300000, 900000]
SERVICES__PARSING_ORDERS__RELEASE_BATCH_SIZEMaximum number of documents put back in the queue on each maintenance pass (every 5 minutes, on each instance).100

External services​

VariableDescriptionDefault
SERVICES__SCRAPPING__ENDPOINTURL of Breign Scrapping API (internal network), used to import web pages into knowledge.http://localhost:8001
SERVICES__SCRAPPING__API_KEYKey sent as x-api-key to Breign Scrapping API.TO_DEFINE
SERVICES__MAILS__PROVIDEREmail sending: resend (Resend) or in-memory (no email is sent). Any other value prevents startup.resend
SERVICES__MAILS__API_KEYResend API key.β€”
SERVICES__OPENAI__API_KEYServer-wide OpenAI key. Used by default for OpenAI text-to-speech in applications when the application does not provide its own key. Agents use the AI engines configured in each organization, not this key.β€”
SERVICES__OPENAI__ORGANIZATIONOpenAI organization associated with SERVICES__OPENAI__API_KEY.β€”
SERVICES__ELEVEN_LABS__API_KEYServer-wide ElevenLabs key. Used by default for ElevenLabs text-to-speech in applications.β€”

Authentication and security​

VariableDescriptionDefault
AUTHENTICATION__API_KEYSystem (super administrator) API key of Breign API, sent as x-api-key. Breign APP uses it (BRAIN_API_KEY).Required
AUTHENTICATION__AUTH_SECRETAuthentication secret (sessions, encryption of the JWKS keys stored in the database). Generate it for example with openssl rand -base64 32.Required
AUTHENTICATION__TRUSTED_ORIGINSJSON list (as text) of the origins allowed to call the authentication endpoints, for example ["https://app.example.com"].["https://api.breign.eu"]
AUTHENTICATION__JWT__ISSUERIssuer and audience of the JWTs signed by the API (application instance tokens and JWT sign-in).localhost
AUTHENTICATION__JWT__PRIVATE_KEYEd25519 private key (PEM, PKCS#8) that signs these JWTs.Development key, must be replaced
AUTHENTICATION__JWT__PUBLIC_KEYMatching Ed25519 public key (PEM) that verifies them.Development key, must be replaced
AUTHENTICATION__OAUTH_PROVIDER__ENABLEDMakes Breign an OAuth 2 / OpenID Connect provider for third-party applications (JSON value true or false). Migrations must run before you enable it.false
AUTHENTICATION__OAUTH_PROVIDER__RESOURCEIdentifier (audience) of the API that OAuth applications pass as resource. Empty: SERVER__HOST.β€”
ENCRYPTION__SECRETSecret used to encrypt AI engine API keys and secrets stored in the database. Breign Document API must have exactly the same value to read the organizations' OCR configuration. Changing it makes the secrets already stored unreadable.SUPER_SECRET_TO_CHANGE_RANDOM
MATE__SESSION_TOKEN_SECRETSecret that signs the session tokens given to execution nodes (CLI, Breign Mate) so that an agent turn can call back the API. Empty: key derived from ENCRYPTION__SECRET.β€”
MATE__DISK_HARD_LIMIT_PERCENTAbove this disk usage of its working disk (JSON number), an execution node gets no new environment; turns resuming an existing environment still run.90
GIT__OAUTH_REDIRECT_URLBreign APP page where GitLab or GitHub sends members back when they connect their Git account: https://<app>/git/oauth/callback. Empty: members can't connect an account.β€”

Features​

JSON values true or false.

VariableDescriptionDefault
FEATURES__PROJECTSProjects, tickets and inbox. When disabled, their routes return 404.true
FEATURES__TICKET_AGENTSAgents working on their tickets on their own (wake-ups, work sessions). Requires FEATURES__PROJECTS.true
FEATURES__EXECUTION_NODESExecution nodes (Breign CLI, Breign Mate) that run agents on user or organization machines.true
FEATURES__EXTERNAL_TRIGGERSAutomations triggered from outside: GitLab mentions and webhooks.true
FEATURES__FLEETSAgent fleet installation wizard.false

Agent tools​

VariableDescriptionDefault
SERVICES__MEMORY__ENABLEDEnables the agents' long-term memory tool on the whole server (JSON value). Each agent must also enable it.true
SERVICES__MEMORY__MAX_CONTENT_LENGTHMaximum size, in characters, of a memory file.8000
SERVICES__MEMORY__MAX_FILESMaximum number of memory files per memory space.20
SERVICES__BASH__MAX_EXECUTION_TIME_MSMaximum duration of a sandbox command (bash tool), in milliseconds.10000
SERVICES__BASH__MAX_OUTPUT_CHARSMaximum number of output characters of a command returned to the model.20000
SERVICES__BASH__SESSION_IDLE_MSIdle time, in milliseconds, after which a bash session is freed from memory.600000
SERVICES__BASH__MAX_SESSIONSMaximum number of bash sessions kept in memory per process.50
SERVICES__BASH__WORKSPACE__MAX_FILE_BYTESMaximum size, in bytes, of a workspace file.1048576
SERVICES__BASH__WORKSPACE__MAX_TOTAL_BYTESMaximum total size, in bytes, of a saved workspace.20971520
SERVICES__BASH__WORKSPACE__MAX_FILESMaximum number of files saved per workspace.200
SERVICES__BASH__WORKSPACE__MAX_FS_BYTESMaximum size, in bytes, of the in-memory file system of a bash session.33554432
SERVICES__BASH__PYTHON__ALLOWEDAllows Python in the sandbox (JSON value). Each agent must also enable it, and the user approves each command.false
SERVICES__BASH__JAVASCRIPT__ALLOWEDAllows JavaScript (js-exec) in the sandbox, under the same conditions.false
SERVICES__BASH__NETWORK__ALLOWEDAllows network access (curl) from the sandbox (JSON value). Each agent must also enable it, and the user approves the addresses.false
SERVICES__CODE_MODE__ALLOWEDAllows code mode on the server (JSON value true or false). Without it, an agent's "Code mode" option has no effect.false
SERVICES__CODE_MODE__MAX_WORKERSMaximum number of code mode programs running at the same time per API process, across all conversations. Beyond that, the program fails.4
SERVICES__CODE_MODE__EXECUTION_POLICY__TIMEOUT_MSMaximum duration of a code mode program, in milliseconds.30000
SERVICES__CODE_MODE__EXECUTION_POLICY__MEMORY_LIMIT_BYTESMaximum memory of a program, in bytes.67108864
SERVICES__CODE_MODE__EXECUTION_POLICY__MAX_SOURCE_BYTESMaximum size of a program's code, in bytes.262144
SERVICES__CODE_MODE__EXECUTION_POLICY__MAX_RESULT_BYTESMaximum size of a program's result, in bytes.262144
SERVICES__CODE_MODE__EXECUTION_POLICY__MAX_CONSOLE_OUTPUT_BYTESMaximum size of a program's console output, in bytes.65536
SERVICES__CODE_MODE__EXECUTION_POLICY__MAX_TOOL_INPUT_BYTESMaximum size of the parameters of a tool call made by a program, in bytes.262144
SERVICES__CODE_MODE__EXECUTION_POLICY__MAX_TOOL_OUTPUT_BYTESMaximum size of a tool response received by a program, in bytes.1048576
SERVICES__CODE_MODE__EXECUTION_POLICY__MAX_BRIDGE_REQUESTSMaximum number of tool calls per program.256
SERVICES__CODE_MODE__EXECUTION_POLICY__MAX_IN_FLIGHT_BRIDGE_REQUESTSMaximum number of concurrent tool calls in a program. Beyond that, the program fails.32
SERVICES__OPENAPI_TOOLS__ALLOW_PRIVATE_NETWORKSAllows OpenAPI tools to call private network addresses (JSON value). When disabled, an address entered in an organization cannot reach your internal services.false
SERVICES__OPENAPI_TOOLS__FETCH_TIMEOUT_MSMaximum time, in milliseconds, to download an OpenAPI definition.10000
SERVICES__OPENAPI_TOOLS__CALL_TIMEOUT_MSMaximum time, in milliseconds, of an OpenAPI tool call.30000
SERVICES__OPENAPI_TOOLS__MAX_DEFINITION_BYTESMaximum size, in bytes, of an OpenAPI definition.2097152
SERVICES__OPENAPI_TOOLS__MAX_RESPONSE_BYTESMaximum size, in bytes, of an OpenAPI tool call response.1048576
SERVICES__MCP__PROTOCOL_NEGOTIATIONMCP protocol version requested from MCP servers: auto (negotiation), legacy, or a specific version to enforce (for example 2025-06-18).auto
SERVICES__MCP__CALL_LOGS_RETENTION_DAYSRetention period, in days, of MCP tool call logs.7
SERVICES__LOCAL_AGENTS__MCP__ENABLEDEnables the MCP server through which local agents (Claude Code, etc.) query Breign agents (JSON value).true
SERVICES__LOCAL_AGENTS__MCP__DEFAULT_WAIT_SECONDSTime, in seconds, that a call to this MCP server waits for the agent's answer before returning (the local agent fetches the answer later).25
SERVICES__LOCAL_AGENTS__MCP__MAX_WAIT_SECONDSMaximum wait, in seconds, that a caller can request.50
SERVICES__HUMAN_ESCALATION__QUESTION_TTL_HOURSValidity, in hours, of a question an agent asks a human, when the agent does not set its own (between 1 and 168).24
SERVICES__AI_GATEWAY__OPENCODE__AUTH_COMMANDCommand (JSON array) published in the organization's OpenCode manifest. OpenCode runs it to get the Breign API key. By default, it reads the BREIGN_API_KEY variable on the user's machine.Command that reads BREIGN_API_KEY

Automations, scheduled tasks and tickets​

VariableDescriptionDefault
SERVICES__SCHEDULED_TASKS_QUEUE__DRIVERHow scheduled tasks run: disabled (none), local (run by Breign API itself), redis or pubsub (published to a queue read by the task service).disabled
SERVICES__SCHEDULED_TASKS_QUEUE__TOPIC_NAMEQueue name (Redis key or Pub/Sub topic) with redis or pubsub.scheduled-task-triggers-dev
SERVICES__SCHEDULED_TASKS_QUEUE__LOCAL__CONCURRENCYNumber of tasks run at the same time per instance with local.4
SERVICES__SCHEDULED_TASKS_QUEUE__LOCAL__HEARTBEAT_MSInterval, in milliseconds, at which an instance reports that a running task is still active (local).30000
SERVICES__SCHEDULED_TASKS_QUEUE__LOCAL__ALLOW_PRIVATE_CALLBACK_HOSTSAllows callback URLs of scheduled tasks and automation webhooks to point to private networks (JSON value).false
SERVICES__REDIS__URLRedis URL, with SERVICES__SCHEDULED_TASKS_QUEUE__DRIVER=redis.redis://127.0.0.1:6379
SERVICES__PUBSUB__CREDENTIALS_TYPEGoogle Pub/Sub credentials: instance (the environment's service account) or local (gcp-service-account.json file).instance
SERVICES__PUBSUB__API_ENDPOINTPub/Sub API endpoint.europe-west1-pubsub.googleapis.com:443
SERVICES__EXTERNAL_TRIGGERS__PUBLIC_BASE_URLPublic API address used in the webhook URLs to register in GitLab or an external system. Empty: SERVER__HOST.β€”
SERVICES__EXTERNAL_TRIGGERS__INGRESS_MAX_PER_MINUTEGitLab webhooks accepted per integration per minute. Beyond that, they are ignored.600
SERVICES__EXTERNAL_TRIGGERS__MAX_CONCURRENT_PER_PROCESSConcurrent automation runs per API instance.4
SERVICES__EXTERNAL_TRIGGERS__PER_AGENT_CONCURRENCYConcurrent runs per agent.1
SERVICES__EXTERNAL_TRIGGERS__PER_ORG_CONCURRENCYConcurrent runs per organization.3
SERVICES__EXTERNAL_TRIGGERS__LEASE_MSTime, in milliseconds, after which a run whose instance stopped responding is put back in the queue.600000
SERVICES__EXTERNAL_TRIGGERS__LEASE_HEARTBEAT_MSInterval, in milliseconds, at which an instance reports that a run is still active.30000
SERVICES__EXTERNAL_TRIGGERS__MAX_ATTEMPTSNumber of attempts for a run.3
SERVICES__EXTERNAL_TRIGGERS__RETRY_DELAYS_MSDelays, in milliseconds, before each new attempt (JSON list).[30000, 120000, 600000]
SERVICES__EXTERNAL_TRIGGERS__MAX_QUEUE_AGE_MSMaximum age, in milliseconds, of a queued trigger. Beyond that, it is dropped with a short "request expired" reply.7200000
SERVICES__EXTERNAL_TRIGGERS__MAX_RUNS_PER_HOUR_PER_BOTRuns per hour per GitLab bot account.60
SERVICES__EXTERNAL_TRIGGERS__MAX_RUNS_PER_THREAD_PER_HOURRuns per hour in a single discussion thread (protects against loops).5
SERVICES__EXTERNAL_TRIGGERS__GITLAB_TIMEOUT_MSMaximum time, in milliseconds, of a GitLab API call.10000
SERVICES__EXTERNAL_TRIGGERS__RETENTION_DAYSRetention period, in days, of the trigger history.30
SERVICES__EXTERNAL_TRIGGERS__ALLOW_PRIVATE_NETWORKSAllows a GitLab instance on a private network (JSON value).false
SERVICES__EXTERNAL_TRIGGERS__WEBHOOK__MAX_BODY_BYTESMaximum size, in bytes, of an automation webhook body. Beyond that, the response is 413.1048576
SERVICES__EXTERNAL_TRIGGERS__WEBHOOK__STORED_BODY_BYTESSize, in bytes, of the body kept and passed to the agent. Beyond that, only the beginning is kept.65536
SERVICES__EXTERNAL_TRIGGERS__WEBHOOK__INGRESS_MAX_PER_MINUTECalls accepted per webhook per minute. Beyond that, the response is 429.120
SERVICES__EXTERNAL_TRIGGERS__WEBHOOK__MAX_RUNS_PER_HOUR_PER_ENDPOINTRuns per hour per webhook.120
SERVICES__EXTERNAL_TRIGGERS__WEBHOOK__SIGNATURE_TOLERANCE_MSMaximum difference, in milliseconds, between the X-Breign-Timestamp header of a signed webhook and the server clock.300000
SERVICES__TICKET_WORK__DEBOUNCE_MSDelay, in milliseconds, that groups close events on a ticket into a single agent wake-up.15000
SERVICES__TICKET_WORK__LEASE_MSTime, in milliseconds, after which a wake-up whose instance stopped responding is put back in the queue.600000
SERVICES__TICKET_WORK__LEASE_HEARTBEAT_MSInterval, in milliseconds, at which an instance reports that a wake-up is still running.60000
SERVICES__TICKET_WORK__MAX_ATTEMPTSNumber of attempts for a wake-up.3
SERVICES__TICKET_WORK__RETRY_DELAYS_MSDelays, in milliseconds, before each new attempt (JSON list).[60000, 300000, 900000]
SERVICES__TICKET_WORK__BUSY_RETRY_MSDelay, in milliseconds, before retrying when the agent is still working or waiting for an answer.60000
SERVICES__TICKET_WORK__MAX_RUNS_PER_HOURRuns per hour, per ticket and per agent (protects against runaway loops).12
SERVICES__TICKET_WORK__RELEASE_BATCH_SIZEMaximum number of wake-ups put back in the queue on each maintenance pass.50

WebSockets​

VariableDescriptionDefault
SOCKETS__REPLAY__MAX_MESSAGES_PER_DEVICENumber of WebSocket messages kept per device, to be replayed after a reconnection.500
SOCKETS__REPLAY__MAX_DEVICESNumber of devices whose messages are kept in memory. The least recent ones are dropped first.500
SOCKETS__REPLAY__IDLE_TTL_MSTime, in milliseconds, after which the messages of an idle device are dropped.1800000

Proxy configuration​

If your infrastructure requires a proxy, Node.js must use it. Set NODE_USE_ENV_PROXY=1: Node.js then uses the following variables for all HTTP and HTTPS requests made by Breign API (Breign APP works the same way).

VariableDescriptionExample
NODE_USE_ENV_PROXYTells Node.js to use HTTP_PROXY, HTTPS_PROXY and NO_PROXY to configure the global proxy.1
HTTP_PROXY or http_proxyProxy URL for HTTP requests. If both are set, http_proxy wins.http://proxy.example.com:3128
HTTPS_PROXY or https_proxyProxy URL for HTTPS requests. If both are set, https_proxy wins.http://proxy.example.com:3128
NO_PROXY or no_proxyComma-separated hosts reached without going through the proxy. If both are set, no_proxy wins.localhost,127.0.0.1,.example.com

The Breign API Docker image also sets NODE_OPTIONS=--use-system-ca: Node.js trusts the system certificate authorities, so you can add an internal authority to the image.

Breign APP​

In the Docker image, four NEXT_PUBLIC_* variables (NEXT_PUBLIC_BRAIN_API_ENDPOINT, NEXT_PUBLIC_BRAIN_WS_ENDPOINT, NEXT_PUBLIC_SSO_PROVIDER_ID, NEXT_PUBLIC_TEMPLATE_APP) are replaced when the container starts, so you can set them at launch. If one of them is not set at launch, it becomes an empty string and the default value from the code no longer applies: set all of them. Outside Docker (next build, Vercel), all NEXT_PUBLIC_* variables must be present at build time.

VariableDescriptionRequiredDefault / example
BETTER_AUTH_SECRETAuthentication secret: signs sessions, cookies and tokens. Generate it for example with openssl rand -base64 32.Yesβ€”
BETTER_AUTH_URLPublic URL of the application: base of the authentication callbacks, passkey domain, links and logo in emails.Yeshttps://app.example.com
AUTHENTICATION__TRUSTED_ORIGINSOrigins allowed by the authentication in addition to BETTER_AUTH_URL (JSON array).No["https://admin.example.com"]
PERSISTENCE_TYPEDatabase for authentication and application-specific data: pg or mongodb. Must be the same database as Breign API. Any other value makes startup fail.Yespg
PG_URIPostgreSQL connection URI.If PERSISTENCE_TYPE=pgpostgresql://user:password@db.example.com:5432/breign
MONGODB_URIMongoDB connection URI. The database used is the one given in the URI.If PERSISTENCE_TYPE=mongodbmongodb://user:password@mongo.example.com:27017/breign
BRAIN_API_ENDPOINTBreign API URL for calls made by the application server.Yeshttps://api.example.com
NEXT_PUBLIC_BRAIN_API_ENDPOINTPublic Breign API URL, used by the browser and, in priority, by the application server. Also used to display the URLs of the MCP servers and the AI Gateway.Yeshttps://api.example.com
NEXT_PUBLIC_BRAIN_WS_ENDPOINTBreign API WebSocket URL, used by an agent's application simulator.Yeswss://api.example.com
BRAIN_API_KEYSystem API key of Breign API (the value of its AUTHENTICATION__API_KEY). The application does not start without it.Yesβ€”
NEXT_PUBLIC_SSO_PROVIDER_IDSSO provider ID. When set, the sign-in page redirects straight to this SSO and passkeys are disabled by default. Empty (or false): no SSO.Nomy-idp
PASSKEYS_ENABLEDEnables (true) or disables (false) passkey sign-in. Without a value: enabled, unless NEXT_PUBLIC_SSO_PROVIDER_ID is set.Noβ€”
RESEND_API_KEYResend API key for emails (sign-in code, adding a passkey). CONSOLE writes the emails to the logs instead of sending them.YesCONSOLE (development)
NEXT_PUBLIC_TEMPLATE_APPInterface theme and brand: BREIGN or SKAI. Dark mode only exists with BREIGN.Yes (Docker)BREIGN
FEATURE_PROJECTSShows projects, tickets and the inbox. false hides them. Must match FEATURES__PROJECTS in Breign API.Noenabled
FEATURE_TICKET_AGENTSShows agents working on tickets on their own (only if projects are shown). false hides it. Must match FEATURES__TICKET_AGENTS in Breign API.Noenabled
FEATURE_FLEETSShows the fleet installation wizard (true). Must match FEATURES__FLEETS in Breign API.Nodisabled
MCP_PROTOCOL_NEGOTIATIONMCP protocol version requested when the application calls an MCP server: auto, legacy or a specific version (for example 2025-06-18).Noauto
IMAGES_STORAGE_ENDPOINTDocker image only: hostname of the image storage allowed for optimized image display (avatars, logos).If images come from your own storagestorage.example.com
IMAGES_STORAGE_PATHDocker image only: path allowed on this host.With IMAGES_STORAGE_ENDPOINT/my-bucket/**
IMAGES_ALLOW_LOCAL_IPDocker image only: true allows loading images from a private IP address (for example a storage behind a private endpoint).Nofalse
PORT / HOSTNAMEPort and interface the server listens on.No3000 / 0.0.0.0

The MONGODB_DBNAME, WEAVIATE_SCHEME, WEAVIATE_HOST, WEAVIATE_AUTH and WEAVIATE_API_KEY variables are no longer read. You can remove them.

Breign Document API​

Breign Document API no longer receives documents from Breign API through an HTTP call. Breign API puts each document to parse in a queue shared in the database (document_parsing table or document-api-parsing collection), and Breign Document API polls this queue continuously. Both services must therefore point to the same database. POST /parsing is still available: it puts a document in the same queue. If the call provides a callback_url, Breign Document API calls that URL once the document is parsed or has failed for good, with the API_KEY_NAME: API_KEY header. A document dropped by queue maintenance (instance gone and no attempts left) does not trigger a callback.

Conversion to Markdown runs in a pool of worker processes (MAX_CONCURRENT_PARSINGS processes). Downloading, OCR, writing the result and callbacks stay in the main process. Images in PDF, Word and PowerPoint files are extracted and stored next to the Markdown, which references them.

Files are stored either in S3-compatible storage (MinIO, S3…) or in Azure Blob Storage through its native API, depending on FILE_STORAGE__ADAPTER.

VariableDescriptionRequiredValue
API_KEYAPI key required in the API_KEY_NAME header of calls to Breign Document API. It is also sent in parsing callbacks: for Breign API to accept them, it must equal SERVICES__DOCUMENTS_SERVICE__API_KEY in Breign API.Yesbreign-document-api-key
API_KEY_NAMEName of the HTTP header used to send the API key, in both directions. Breign API reads the callback key from x-api-key (case-insensitive).Yesx-api-Key
ENCRYPTION__SECRETSecret that decrypts the AI engine keys stored by Breign API, read to apply each organization's OCR configuration. Must equal exactly the ENCRYPTION__SECRET of Breign API. Without it, the service refuses to start.Yesvalue of ENCRYPTION__SECRET in Breign API
MODEEnvironment marker (prod or dev): it is only validated and shown at startup. No behavior depends on it.Noprod (default)
LOG_LEVELMinimum log level (DEBUG, INFO, WARNING, ERROR…), also applied to worker processes.NoINFO (default)
FILE_STORAGE__ADAPTERFile storage: minio (any S3 API: MinIO, S3…) or azure_blob (native Azure Blob Storage API). Any other value prevents startup.Nominio (default)
MINIO_ENDPOINTS3/MinIO storage host, without protocol or port: the URL is built as MINIO_PROTOCOL://MINIO_ENDPOINT[:MINIO_PORT].If FILE_STORAGE__ADAPTER=miniofiles.company.eu
MINIO_PORTStorage port. Left out of the URL if empty.No443
MINIO_PROTOCOLProtocol of the storage URL (http or https).Nohttps (default: http)
MINIO_USE_SSLuse_ssl option of the S3 client (true or false). The URL protocol is still the one from MINIO_PROTOCOL.Nofalse (default)
S3_CLIENT_SSLTLS verification of the storage: empty = system certificate authorities, false = verification disabled, otherwise path to a CA bundle.Noempty (default)
MINIO_BUCKET_NAMESingle bucket (or, with FILE_STORAGE__ADAPTER=azure_blob, Azure container) of the service: it reads the original documents from it and writes the Markdown (.md, _ocr.md) and extracted images to it.Yesbreign-files
MINIO_ACCESS_KEYMinIO access key.If FILE_STORAGE__ADAPTER=miniobreign-minio-user
MINIO_SECRET_KEYMinIO secret key.If FILE_STORAGE__ADAPTER=miniominio-secret-key
FILE_STORAGE__AZURE_ACCOUNT_NAMEAzure storage account name.If FILE_STORAGE__ADAPTER=azure_blobbreignstorage
FILE_STORAGE__AZURE_ACCOUNT_KEYAzure storage account access key. Also used to sign the read-only SAS URLs of the MISTRAL_OCR_DOCUMENT OCR mode.If FILE_STORAGE__ADAPTER=azure_blobazure-account-key
FILE_STORAGE__AZURE_ENDPOINTBlob service URL. Only set it for Azurite or another Azure cloud.Noempty (default: https://<account>.blob.core.windows.net)
SERVICES__PERSISTENCE__TYPEDatabase that holds the parsing queue (mongodb or pg). Must be the same database as Breign API: the two services exchange documents to parse through it, and the service reads the organizations' OCR configuration from it. Any other value prevents startup.Nomongodb (default)
MONGODB_URIConnection URI of the Breign API MongoDB database.If SERVICES__PERSISTENCE__TYPE=mongodbmongodb://user:password@localhost:27017/breign
MONGO_DB_NAMEName of the Breign API MongoDB database (parsing queue and organizations' OCR configuration).If SERVICES__PERSISTENCE__TYPE=mongodbbreign
MONGO_COLLECTION_NAME_PARSINGName of the MongoDB collection of the parsing queue, shared with Breign API. Must be document-api-parsing, the name used by Breign API.If SERVICES__PERSISTENCE__TYPE=mongodbdocument-api-parsing
PG_URIPostgreSQL connection URI (document_parsing table, shared with Breign API). The pool opens up to 2 Γ— MAX_CONCURRENT_PARSINGS + 5 connections: the service refuses to start if this number exceeds PostgreSQL's max_connections.If SERVICES__PERSISTENCE__TYPE=pgpostgresql://user:password@localhost:5432/breign
MAX_CONCURRENT_PARSINGSNumber of documents processed at the same time by one instance, and number of worker processes that convert them. An instance never takes more documents from the queue than it has free slots. 0 = computed at startup: one process per CPU, within the memory limit (memory Γ· PARSE_WORKER_MEMORY_MB βˆ’ 1, at least 1), container limits (cgroup v2) included. The chosen value is shown in the startup logs.No0 (default)
PARSE_WORKER_MEMORY_MBMemory, in MB, counted for one worker process in the automatic computation of MAX_CONCURRENT_PARSINGS. This is not a limit enforced on the process.No1600 (default)
PARSE_WORKER_MAX_TASKSNumber of documents after which a worker process is replaced by a new one, to free memory fragmented by large documents. 0 = never replaced.No50 (default)
PARSE_TIMEOUT_SECONDSMaximum conversion time of a document, in seconds. Beyond that, the worker process is killed and the document fails with no retry. A process that dies during conversion (usually from lack of memory) produces the same permanent error.No300 (default)
PARSE_IN_PROCESSESfalse converts in threads of the main process, for debugging: no parallelism, and a document that exceeds PARSE_TIMEOUT_SECONDS is marked as failed but its conversion keeps running. Keep it true in production.Notrue (default)
MAX_FILE_SIZE_MBMaximum size of a document, in MB. A larger document fails as soon as it is downloaded, with no retry. 0 = no limit.No100 (default)
PARSING_GLOBAL_LIMITMaximum number of documents being parsed, across all instances. Only useful below number of instances Γ— MAX_CONCURRENT_PARSINGS.No10 (default)
PARSING_PER_ORGANIZATION_LIMITSame limit, per organization.No5 (default)
PARSING_LEASE_SECONDSTime, in seconds, after which a document whose instance stopped responding is put back in the queue, or marked as failed if it has no attempts left. At least 3 Γ— PARSING_LEASE_HEARTBEAT_SECONDS. Keep it consistent with SERVICES__PARSING_ORDERS__LEASE_MS in Breign API.No300 (default)
PARSING_LEASE_HEARTBEAT_SECONDSInterval, in seconds, at which an instance parsing a document reports that it is still active.No60 (default)
PARSING_MAX_ATTEMPTSMaximum number of parsing attempts for a document: a transient failure is retried up to this limit, then the document is marked as failed. Exceeding PARSE_TIMEOUT_SECONDS, a dead worker process and a document that is too large are never retried.No3 (default)
PARSING_RETRY_DELAYS_SECONDSDelays, in seconds, before each new attempt (JSON list; the last delay is repeated).No[60, 300, 900] (default)
PARSING_RELEASE_BATCH_SIZEMaximum number of documents put back in the queue on each maintenance pass.No100 (default)
PARSING_MAINTENANCE_INTERVAL_SECONDSInterval, in seconds, between two queue maintenance passes.No60 (default)
ENABLE_TABLE_EXTRACTIONRuns the tables produced by the conversion through a header / value classification done by OpenAI. Excel and CSV files are then read directly through this path. Requires OPENAI_API_KEY.Nofalse (default)
OPENAI_API_KEYOpenAI key used only by table extraction. OCR does not use it: OCR is configured per organization in Breign API.If ENABLE_TABLE_EXTRACTION=trueopenai-api-key
PDF_CHUNK_SIZENumber of pages per chunk when a long PDF is converted in chunks, to limit memory. 0 disables chunking.No20 (default)
PDF_CHUNKING_THRESHOLD_PAGESA PDF is only split into chunks if it has more pages than this threshold.No50 (default)
PDF_DROP_ROTATED_TEXTRemoves rotated text (margin banners, vertical labels) from mostly upright PDF pages. Otherwise this text comes out one character per line.Notrue (default)
ENABLE_HEADING_DETECTIONRebuilds the heading hierarchy (#, ##…) of PDFs, which the conversion alone does not produce.Nofalse (default)
HEADING_MAX_LEVELDeepest heading level produced (1 to 6).No3 (default)
HEADING_DETECT_NUMBERINGInfers a heading's level from its numbering (3.2.1 Title).Notrue (default)
HEADING_DETECT_FONT_SIZEOtherwise, infers a heading's level from its font size.Notrue (default)
IMAGE_MAX_PER_DOCUMENTMaximum number of distinct images extracted and stored per document (1 to 500). Images are stored in <document>_images/ and referenced in the Markdown. Beyond the limit, an image only keeps an empty reference.No100 (default)
OCR_DPIRendering resolution of pages sent to OCR (72 to 400).No150 (default)
OCR_IMAGE_FORMATFormat of page images sent to OCR (JPEG or PNG).NoJPEG (default)
OCR_IMAGE_QUALITYJPEG quality of page images (1 to 100), ignored for PNG.No80 (default)
OCR_MAX_IMAGE_EDGELongest side of a page image, in pixels (at least 256): the image is scaled down to fit.No2000 (default)
OCR_MAX_PAGESMaximum number of pages of a document sent to OCR. Beyond that, the document fails. 0 = no limit.No0 (default)
OCR_PAGE_CONCURRENCYNumber of pages of a single document sent at the same time to the OCR provider.No4 (default)
OCR_PAGE_TIMEOUT_SECONDSTimeout of an OCR request for one page, in seconds.No120 (default)
OCR_PAGE_RETRIESExtra attempts for a page after a first failure.No2 (default)
OCR_TIMEOUT_SECONDSMaximum OCR time for a document, in seconds. Beyond that, OCR is retried within the limit of PARSING_MAX_ATTEMPTS.No1800 (default)
OCR_FAIL_ON_PAGE_ERRORtrue makes the document fail as soon as a page cannot be read. false marks the page as failed and continues.Nofalse (default)
OCR_PRESIGNED_URL_TTL_SECONDSMISTRAL_OCR_DOCUMENT OCR mode only: validity, in seconds (at least 60), of the presigned URL (SAS URL with Azure) sent to the provider. The provider must be able to reach the storage from the Internet.No900 (default)

The OCR mode, model and provider key are not environment variables. They are configured per organization in Breign API and read from the database for each document. An organization with no configuration has no OCR.

A numeric or boolean variable that is set but empty (for example MINIO_USE_SSL=) prevents the service from starting.

Breign Scrapping API​

The service does not authenticate the calls it receives (POST /scrape, GET /status/{knowledge_id}). It must only be reachable by Breign API, on the internal network. In the other direction, the spider calls Breign API with BRAIN_API_URI and BRAIN_API_KEY.

VariableDescriptionRequiredValue
BRAIN_API_URIBase URL of Breign API, without a trailing /. The spider calls it to index each scraped page. At the end of a crawl, it calls it again to set the site's date and to delete pages that disappeared during a resync.Yeshttps://api.example.com
BRAIN_API_KEYKey the spider sends as x-api-key to Breign API. The end-of-crawl sync requires organization administrator rights: use a key that grants them, for example the value of AUTHENTICATION__API_KEY in Breign API. Without these rights, the last-update date and the deletion of missing pages are not applied.Yesbreign-....
BRAIN_API_URLOnly used for an end-of-job notification (POST {BRAIN_API_URL}scrape/notify) that has no matching route in Breign API.Nohttp://localhost:8000/ (default)
FILESTORAGE_ENDPOINTMinIO/S3 storage host, with the port if needed and without protocol: the connection always uses http://. The value is also saved in the upload URL (postUrl) of sites and pages.Yesfiles.company.eu:9000
BUCKET_NAMEName of the bucket where scraped pages are stored. The bucket is created if it does not exist.Yesbreign-files
MINIO_ACCESS_KEYMinIO access key. Without it, no page is uploaded to the storage.Yesbreign-minio-user
MINIO_SECRET_KEYMinIO secret key.Yesminio-secret-key
PERSISTENCE_TYPEBreign API database where the service reads knowledge bases and writes sites and pages: pg, or mongodb (any value other than pg selects MongoDB). Must be the same database as Breign API.Nopg (default)
PG_URIPostgreSQL connection URI, with the async driver postgresql+asyncpg:// (a postgresql:// URI fails).If PERSISTENCE_TYPE=pgpostgresql+asyncpg://user:password@localhost:5432/breign
MONGO_URIMongoDB connection URI. The database used is the one in MONGO_DB_NAME, not the one in the URI. Replaces MONGODB_URI, which this service never read.If PERSISTENCE_TYPE=mongodbmongodb://user:password@localhost:27017
MONGO_DB_NAMEName of the Breign API MongoDB database.If PERSISTENCE_TYPE=mongodbbreign (default: ai-brain-local)