Documentation Index
Fetch the complete documentation index at: https://docs.flowx.ai/llms.txt
Use this file to discover all available pages before exploring further.
The AI Gateway is a core service that owns the Designer AI chat surface. It streams AI assistant responses to the browser over Server-Sent Events (SSE) and routes chat requests to the config-time agents.
Dependencies
Before setting up the AI Gateway, ensure you have the following dependencies in place:- MongoDB for storing conversation context
- Keycloak (or compatible OAuth2 provider) for authentication and authorization
- SpiceDB for fine-grained, workspace-level authorization on AI interactions
- AI Platform — the config-time agents the gateway routes chat requests to
Infrastructure prerequisites
| Component | Description |
|---|---|
| MongoDB | Stores AI chat conversation context |
| Keycloak | Identity provider for service authentication |
| SpiceDB | Authorization service for workspace validation |
| AI Platform | Config-time agents that handle chat requests |
Configuration
Authorization configuration
| Environment Variable | Description | Default Value |
|---|---|---|
SECURITY_TYPE | Security type | oauth2 |
SECURITY_OAUTH2_BASE_SERVER_URL | Base URL of the OAuth2/OIDC server | |
SECURITY_OAUTH2_REALM | OAuth2 realm name | |
SECURITY_OAUTH2_CLIENT_CLIENT_ID | Client ID for token introspection | |
SECURITY_OAUTH2_CLIENT_CLIENT_SECRET | Client secret for token introspection | |
SECURITY_OAUTH2_SERVICE_ACCOUNT_ADMIN_CLIENT_ID | Service account client ID | flowx-ai-gateway-sa |
SECURITY_OAUTH2_SERVICE_ACCOUNT_ADMIN_CLIENT_SECRET | Service account client secret |
MongoDB configuration
| Environment Variable | Description | Default Value |
|---|---|---|
SPRING_DATA_MONGODB_URI | MongoDB connection URI | - |
CAS lib configuration (SpiceDB)
| Environment Variable | Description | Default Value |
|---|---|---|
FLOWX_SPICEDB_HOST | SpiceDB hostname | spicedb |
FLOWX_SPICEDB_PORT | SpiceDB gRPC port | 50051 |
FLOWX_SPICEDB_TOKEN | SpiceDB authentication token | - |
FLOWX_LIB_CASCLIENT_RUNTIME_IMPLEMENTATION | Runtime authorization backend used by the CAS client. Keep the default unless instructed by FlowX. | CUSTOM |
Logging configuration
| Environment Variable | Description | Default Value |
|---|---|---|
LOGGING_LEVEL_ROOT | Root logging level | INFO |
LOGGING_LEVEL_APP | Application-specific log level | INFO |
Secrets management
| Secret Name | Description |
|---|---|
SPRING_DATA_MONGODB_URI | MongoDB connection URI (contains credentials) |
SECURITY_OAUTH2_SERVICE_ACCOUNT_ADMIN_CLIENT_SECRET | Keycloak service account secret |
FLOWX_SPICEDB_TOKEN | SpiceDB authentication token |
Ingress and CORS
The AI Gateway is exposed on the admin host because the Designer connects to it directly from the browser. Because it streams chat responses over SSE, the ingress must allow long-lived connections — the FlowX deploy chart raises the default proxy read/send timeouts for this service so streams are not cut mid-flight.CORS configuration
| Environment Variable | Description | Default Value |
|---|---|---|
APPLICATION_CORS_ALLOW_ORIGIN | Comma-separated list of origins allowed to call this service from the browser. Must include every Designer domain that uses AI chat. Supports wildcard subdomains (https://*.yourcompany.com). | - |
application.yaml with safe defaults. For the complete route reference and Gateway API HTTPRoute configuration, see the ingress configuration guide.
Deployment
Helm values example
The AI Gateway requires ingress to be enabled because the Designer connects to it from the browser to open AI chat streams.
Verify your setup
The AI Gateway pod is running and healthy:
kubectl get pods -l app=ai-gatewayThe health endpoint returns HTTP 200:
curl http://ai-gateway:8080/actuator/healthSpiceDB connection is established — check pod logs for successful CAS client initialization
AI chat opens in the Designer and streams a response without the connection dropping
Troubleshooting
AI chat stream drops mid-response
AI chat stream drops mid-response
Solutions:
- Confirm the ingress proxy read/send timeouts are raised for the AI Gateway route (SSE needs long-lived connections)
- Check that no intermediate proxy buffers or closes the SSE stream
- Review pod logs for upstream errors from the config-time agents
AI chat returns a CORS error in the browser
AI chat returns a CORS error in the browser
Solutions:
- Add the Designer origin to
APPLICATION_CORS_ALLOW_ORIGIN - Verify the request reaches the AI Gateway on the admin host
SpiceDB connection failures
SpiceDB connection failures
Solutions:
- Verify SpiceDB is running and reachable at the configured host and port
- Check that the SpiceDB token is correct
- Ensure network policies allow gRPC traffic to SpiceDB on port
50051
Related resources
AI Platform setup
Config-time agents and AI infrastructure
SpiceDB Configuration
Fine-grained authorization setup
IAM Configuration
Identity and access management setup
Ingress configuration
Routing and CORS reference

