Compare the modes
The mode is selected once for the deployment policy and applies to every allowed coding agent.
How gateway mode works
The Control API matches the signed-in governance user to a LiteLLM user by exact, case-insensitive email. The deployment provisions one managed key per user according to provisioner policy. The shipped LiteLLM provisioners useblue:<email> as the base key alias and add a numeric suffix if that alias is occupied. The Control API stores the resulting server-side virtual key only in PostgreSQL.
When the client fetches policy, the Control API requires its OAuth token’s sid, verifies the active backing Better Auth session, and injects the inference proxy URL plus a session-bound inference JWT into the global gateway block. Each new Blue launch receives a fresh JWT limited to gateway:infer and to gateway.inference_jwt.token_ttl_seconds (12 hours by default), never outliving the backing session. Fetching policy does not extend that session — the dashboard owns its lifetime. The JWT is never persisted by the Control API, and the client never writes it to its config cache. The wrapper writes agent-specific routing for allowed agents. The inference proxy validates the JWT, resolves its Blue user and OAuth session through the M2M channel, and substitutes the server-side virtual key.
Gateway routing applies when an allowed agent is launched through
blue. Starting the native agent command directly uses its native configuration and credentials.blue shows a countdown in the status row and offers to quit and reload the agent, which mints a fresh token. It never restarts on its own, because that would end an in-flight turn.
If the browser session ends — you sign out of the dashboard, or it simply expires — the CLI’s next policy fetch gets a 401 and blue says so directly: a Session expired — sign in banner, a prompt to stop the agent and sign in, and blue doctor reporting session : EXPIRED. Logging back in from a live browser session restores gateway access; JWTs minted before the logout stay rejected.
Signing back in after blue logout reuses the same browser session, so gateway access resumes without a new browser sign-in.
How governance-only mode works
With no top-levelgateway block, Blue can still manage models, approval behavior, MCP servers, packages, and session-upload policy. It does not set gateway base URLs or inference tokens. Native agents own authentication and send inference to their normal providers or locally configured endpoints.
For an entirely governance-only deployment:
- Omit the top-level
gatewaysection fromblue.yaml. - Do not start the Compose
gatewayprofile. - Configure provider credentials using each agent’s native setup.
/direct to switch the local client to native provider credentials. Blue removes gateway routing and inference tokens from its managed agent profile while continuing to apply models, approval behavior, MCP servers, packages, and session-upload policy. If an agent is running, Blue offers to quit and reload it; keeping the current session delays the runtime change until the next Blue restart. Run /direct again to restore organization gateway routing.
The selection is persisted as force_governance_only under [mode] in blue.toml. A client can only disable gateway routing offered by the service; it cannot enable gateway mode when the service has not declared it.
Enable gateway mode
Gateway mode requires an organization-operated LiteLLM deployment, one Blue configuration section, and the Blue gateway services. Thelitellm adapter is the first supported integration. Contributors adding another type should follow Gateway adapter architecture for the client, proxy, provisioner, and verification contracts.
1
Bring your LiteLLM gateway
Run your LiteLLM gateway with provider credentials and make it reachable from the Blue services. Create users whose emails match their governance identities; Blue creates and maintains each user’s managed key.
2
Configure gateway mode
Add one top-level
gateway section to blue.yaml. Its type enables routing for every allowed coding agent; the remaining settings connect the server runtime.blue.yaml:
HARNESS_PROXY_OAUTH_TOKEN_URL, HARNESS_PROXY_OAUTH_CLIENT_ID,
HARNESS_PROXY_OAUTH_CLIENT_SECRET, and HARNESS_PROXY_OAUTH_RESOURCE (the
Control API audience). The same HARNESS_PROXY_OAUTH_CLIENT_SECRET is given to
the dashboard as HARNESS_INFERENCE_PROXY_CLIENT_ID / secret so it can seed the
confidential client.
The internal transport is explicit. mtls is the default and recommended mode:
it encrypts resolved gateway credentials and requires the proxy to present a
trusted workload certificate. Mounted certificates rotate without restarting;
invalid rotations retain the last-known-good configuration. The Control API
also pins the token’s sub, client_id, and azp claims to the configured
proxy client id.
insecure-http is available only as a deliberate trusted-network tradeoff.
OAuth M2M and NetworkPolicy isolation remain mandatory, but virtual keys are
plaintext on the wire and there is no client-certificate check. A VPC or an API
gateway at ingress does not encrypt this east-west hop. Account for compromised
workloads or nodes, packet capture, service misrouting, and policy enforcement
gaps before selecting it.
Start the inference proxy and Control API, then verify that the user exists in the gateway. The dashboard Gateway page shows runtime readiness and the user’s single managed key without exposing its credential.
Users can provision or reconcile the key on that page or from the CLI:
Disable or change routing
Remove the top-levelgateway section to return all agents to governance-only behavior, remove the Gateway dashboard page, and stop gateway personalization.
Changing provisioner configuration reconciles the managed credential and revokes a superseded gateway identifier. Run blue apply or let the daemon reconcile after policy changes.
