Skip to main content

Network and exposure

Domains​

Breign needs two public addresses, served over HTTPS:

AddressComponentExample
The appBreign APPhttps://breign.example.com
The APIBreign APIhttps://api.breign.example.com

Users' browsers also reach the object storage directly (see Object storage). The other components (Document API, Scrapping API, Guards API, database, vector database) stay on your private network.

"Public" means reachable by your users: on an intranet-only deployment, these addresses can be internal, as long as browsers, the CLI, Breign Mate and execution nodes reach them. Webhooks from external systems (GitLab, automations) and remote MCP clients need to reach the API too.

Configure the addresses in:

  • Breign API: SERVER__HOST (its own URL) and SERVER__APP_HOST (the app URL);
  • Breign APP: BETTER_AUTH_URL (its own URL), NEXT_PUBLIC_BRAIN_API_ENDPOINT, BRAIN_API_ENDPOINT and NEXT_PUBLIC_BRAIN_WS_ENDPOINT (wss:// + the API host);
  • Breign API: AUTHENTICATION__TRUSTED_ORIGINS, which must contain the app URL.

Flows​

Inbound​

Everything inbound goes to the app and the API, on port 443.

Route on the APIUsed by
All REST routes (/agents, /conversations, /organizations…), /api/docsThe app, the CLI, Mate, your integrations
/rp/auth/*Sign-in (SSO callbacks), Breign as an OAuth provider
/auth/*Sign-in of the CLI and Breign Mate
/oauth/callback, /tools/:id/oauth/callbackOAuth 2 connection of agents' tools (MCP, OpenAPI)
/organizations/:org/mcp, /mcp/builderMCP clients (Claude, Cursor, Mate…) calling Breign agents
/organizations/:org/ai-gateway/v1/*The AI Gateway (OpenAI-compatible)
/ws/mate (WebSocket)Execution nodes (CLI, Mate, node containers)
/node-sessions/:id/*Execution nodes, during an agent turn
/apps/*/sockets, /agents/*/sockets (WebSocket)Avatar apps
/webhooks/gitlab/:id, /webhooks/automations/:idGitLab and automation webhooks

Don't filter the API by path unless you know which features you use: the app relies on most routes.

Outbound​

FromToWhy
Breign APPBreign API (public URL), database, Resend, MCP serversPages, sign-in, e-mails, listing the tools of MCP servers
Breign APIDatabase, object storage, vector databaseData
Breign APIAI providersAgents, embeddings, transcription
Breign APIMCP servers and APIs used as tools, GitLabAgents' tools, automations
Breign APIScrapping API, Guards APIOptional features
Breign APIResendE-mails
Document APIDatabase, object storage, OCR providerParsing
Scrapping APIWebsites to crawl, database, object storage, Breign APIWebsite knowledge sources
Execution nodesBreign API (HTTPS and WebSocket), GitHub (to download fx), your Git serversAgent turns on nodes

Breign does not use an outbound HTTP proxy setting of its own. If your network requires a proxy, allow these flows directly, or test Node.js's NODE_USE_ENV_PROXY=1 with HTTPS_PROXY / NO_PROXY on Breign API (not all clients honour it).

Reverse proxy​

Whatever you use in front of the app and the API (ingress controller, load balancer, Nginx, Traefik, Caddy, Application Gateway…), check these settings for the API:

  • WebSockets: allow the Upgrade and Connection headers, and keep idle connections open (execution nodes stay connected for hours).
  • Streaming (SSE): the AI Gateway streams its answers. Turn off response buffering (proxy_buffering off with Nginx; the API also sends X-Accel-Buffering: no).
  • Timeouts: allow at least 5 minutes of read timeout. Model generations, tool calls and MCP long polling (up to 50 seconds) last longer than the usual 30–60 seconds.
  • Request size: allow at least 32 MB (execution nodes send whole conversations to the AI Gateway; file uploads go straight to the storage, not through the API).
  • Forwarded headers: pass X-Forwarded-For and X-Forwarded-Proto.

The API doesn't need sticky sessions, except for avatar apps (see Architecture).

Example with Nginx:

location / {
proxy_pass http://breign-api:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
client_max_body_size 32m;
}

Object storage​

Browsers upload knowledge files and attachments directly to the storage, through presigned URLs created by the API, and download avatars and logos from the public bucket. So:

  • the storage address configured in Breign API must be reachable by users' browsers, over HTTPS;
  • the bucket's CORS rules must allow PUT, POST and GET from the app's domain;
  • the public bucket must be readable without authentication;
  • Breign APP must be allowed to display images from it (IMAGES_STORAGE_ENDPOINT and IMAGES_STORAGE_PATH).

With the Mistral OCR "document" mode, Mistral downloads the document itself from a presigned URL: the storage must then be reachable from the internet.

Example CORS rule for an S3-compatible storage:

[
{
"AllowedOrigins": ["https://breign.example.com"],
"AllowedMethods": ["GET", "PUT", "POST"],
"AllowedHeaders": ["*"],
"ExposeHeaders": ["ETag"],
"MaxAgeSeconds": 3600
}
]

Certificates​

The app and the API need certificates trusted by your users' browsers and by the CLI and Mate. If your internal services (database, storage, MCP servers, AI endpoint) use certificates from a company CA, mount that CA into Breign API, Document API and Scrapping API under /usr/local/share/ca-certificates/: it is added to the trusted authorities when the container starts.