Skip to main content

Agent Gateway

The Agent Gateway is the entry point for AI traffic on a cluster. An account has one Agent Gateway on every cluster (data plane) that runs agents — at most one per cluster. A gateway:

  • routes calls from agents on its cluster to language models, MCP servers and other agents on the same cluster,
  • authenticates every inbound call with a CodeNOW token and checks that the caller belongs to the account,
  • exposes the CodeNOW MCP server and the MCP servers of its own cluster's infrastructure tools to agents and to your own MCP clients,
  • records LLM traffic, which you can inspect in its Logs and Analytics.

The gateway of a cluster is reachable at https://agent-gateway.<data plane host>/.

note

Technical names that you may meet literally — the ai_gateway permission resource, the AI_GATEWAY_URL and AI_GATEWAY_REFRESH_TOKEN environment variables, or the <account>-ai-agents client — are kept for compatibility. They all refer to the Agent Gateway.

Gateways and clusters​

A gateway belongs to exactly one cluster and is identified by that cluster's data plane — there is no separate gateway object to create or name in CodeNOW. Because every environment runs on exactly one cluster, the gateway an agent uses always follows from the environment it is deployed to. Environments on different clusters can have the same name (twins); each twin uses the gateway of its own cluster.

WhatWhere it is registered
A deployed agent (with an exposed A2A endpoint)The gateway of its environment's cluster
MCP servers of the infrastructure tools of a cluster (for example Grafana)Only the gateway of that same cluster
The CodeNOW MCP serverEvery gateway of the account

Consequences:

  • No gateway on the cluster → no agents there. When deploying an agent swarm, environments whose cluster has no gateway are listed but disabled (— No Agent Gateway on its cluster), and a deployment to them is refused (see Deploy & Undeploy).
  • Agent-to-agent (A2A) calls work only within one cluster. An agent can call agents deployed to environments on the same cluster; calls between clusters are not supported.
  • Infra MCP servers are local. Only the infrastructure MCP servers of a gateway's own cluster are registered in it, so agents use those of their own cluster.
  • Models are configured per gateway. Language models and their keys are configured manually on each gateway, so the models available may differ between clusters.

Installing a gateway on a cluster is part of the cluster (data plane) installation and is done by your CodeNOW administrator — the person who manages the CodeNOW installation, not an account Owner or Admin. CodeNOW detects an installed or uninstalled gateway automatically. Uninstalling a gateway cannot be prevented by CodeNOW — see Uninstalling a Gateway for what happens and how to recover.

Gateways overview​

The Gateways card on the AI › Agent Gateways › Permissions page (One Agent Gateway per cluster; agents use the gateway of their cluster.) lists the account's gateways, one row per cluster:

ColumnContent
ClusterThe cluster (data plane) of the gateway
StateInstalled, Uninstalled, or Uninstalled, N agents unreachable (1 agent unreachable) when agents are still deployed on a cluster whose gateway was removed
URLThe gateway URL; — when uninstalled
Agent Gateway Permissions page with the Gateways card

When there is no gateway you may view or manage, as far as the portal knows, the card says No Agent Gateway to show: none may be installed, or the gateways could not be loaded. Agents can be deployed only to environments on a cluster with a gateway. A permission manager who may view no gateway but may manage the permissions of some sees The state of the Agent Gateways is not available to you. You can still manage their permissions below. The page is available to account Owners and Admins and to holders of the Agent Gateway Permission Manager account permission (directly or through a team); they see the Permissions link in the navigation even when no gateway is installed; for everyone else it is hidden. Older links to the former Account Settings › AGENT GATEWAY tab open this page.

Accounts with a single gateway

When the account has exactly one gateway and it is installed, there is no Gateways card for those who may view it, no Scope select (unless a link asks for that gateway's scope) and no per-gateway Permissions in the navigation, and local clients offer no gateway choice. The Scope select and the per-gateway Permissions follow the gateways whose permissions you may manage; the card follows the gateways you may view. The card is shown with an empty list, with two or more listed gateways (even if some are uninstalled), and when the only listed gateway is uninstalled. When the list of gateways cannot be loaded, there is no card. When the gateways whose permissions you may manage cannot be determined, the page shows the warning The permissions of single Agent Gateways could not be loaded. These are the account-wide permissions, for every gateway. with Try again; the account-wide permissions can still be edited below it.

Enabling the Agent Gateway​

The Agent Gateway is enabled or disabled for the whole account — one setting covers all its gateways. The current state is shown as an Enabled / Disabled chip on the AI › Agent Gateways › Permissions page; it cannot be changed in the portal. The setting is off by default — to have it switched on, contact your CodeNOW administrator.

Agents can be created only when both conditions hold:

  1. the Agent Gateway is enabled for the account, and
  2. a gateway is installed on at least one of the account's clusters.

Otherwise the UI disables Create New Agent Swarm and the creation of agents, with the reason in a tooltip (The AI feature is disabled for this account. Contact your CodeNOW administrator to activate it.), and, while the setting is off, the Create Agent page shows Agent Gateway is turned off for this account. Contact your CodeNOW administrator to turn it on. When no gateway is installed, the tooltip and the Create Agent page read No Agent Gateway is installed on any cluster of this account. Contact your CodeNOW administrator., and when the state cannot be checked, Could not verify whether the AI feature is available for this account. Please try again later. Through the API, creating an agent fails with one of these messages:

SituationMessage
The setting is offAI feature is disabled for this account. Agent components cannot be created.
No gateway on any data planeAgent Gateway is not installed on any data plane of this account. Agent components cannot be created.
The installation cannot be checked right nowCannot verify that the Agent Gateway is installed (customer-cluster unavailable). Try again later.

Deploying is checked separately, per environment: an agent swarm can be deployed only to environments whose cluster has a gateway.

A dry run of an agent template needs a gateway on the account's primary cluster. Otherwise it is refused and nothing is started:

SituationMessage
No gateway (422)Agent Gateway is not installed on the account's primary cluster - an agent template dry run needs it
No enabled primary cluster (422)The account has no enabled primary cluster - an agent template dry run needs one with an Agent Gateway
The gateway or the list of clusters cannot be checked right now (503)Cannot verify that the dry-run cluster has an Agent Gateway (customer-cluster unavailable). Try again later.

The 503 message means an outage only. Other errors, for example a denied access to the list of clusters, are returned as they are.

MCP servers available through a gateway​

When a gateway is installed, CodeNOW registers MCP servers in it automatically and keeps the registration up to date:

  • the CodeNOW MCP server (see MCP Server) — on every gateway, and
  • the MCP servers of the infrastructure tools running on the gateway's own cluster.

The registration of a gateway is refreshed whenever its cluster reports a change (an MCP server added or removed, the gateway installed or uninstalled) or its data plane is deleted. Each refresh runs as a Synchronize Agent Gateway job for that one gateway, visible to account owners and admins in the job list. The job detail shows the gateway's data plane with the Reason (Registrations updated / Registrations deleted) and the Result (n registered · n removed · n skipped), and offers Retry.

Calls through the gateway carry the caller's own token to the MCP server, so the MCP server applies the caller's own CodeNOW permissions.

MCP endpoints​

Each gateway exposes MCP servers on two endpoints:

EndpointMCP servers
https://agent-gateway.<data plane host>/mcp/codenowManaged by CodeNOW — the CodeNOW MCP server and the Grafana MCP server of this cluster
https://agent-gateway.<data plane host>/mcp/externalMCP servers your organization registers in this gateway itself, outside the CodeNOW portal

Registering your own MCP servers​

Account administrators can register their own MCP servers in a gateway by adding gateway manifests. These servers are available on the /mcp/external endpoint of that gateway only.

CodeNOW keeps the gateways' manifests in the account's managed-components GitOps repository, the same repository that holds the account's managed services, environments and custom domains. By default, CodeNOW creates it as the project customer-managed-components in the group <account ID>-codenow-cd on CodeNOW's SCM:

https://<CodeNOW SCM host>/codenow/<account ID>-codenow-cd/customer-managed-components.git

The repository is not shown in the CodeNOW portal. If you cannot find it at this path — for example because your account's technical repositories were provisioned outside CodeNOW and have a different name and location — or you need access to it, ask your CodeNOW administrator.

Each gateway has its own folder, agent-gateway/<data plane>/, synchronized to that gateway only. Your organization's MCP servers are registered from a folder of your own, synchronized separately from the folders that CodeNOW owns. For now, add complete Agent Gateway manifests there — the backend, route and policy resources for each of your MCP servers. Registering external MCP servers from the CodeNOW portal is planned for a later release.

The folders owned by CodeNOW are, for each gateway:

FolderContent
agent-gateway/<data plane>/codenow-mcp/The CodeNOW-managed MCP servers of this gateway (/mcp/codenow) — rewritten by every synchronization; anything else in the folder is deleted
agent-gateway/<data plane>/deployed-agents/<environment>/<agent swarm>/Gateway registrations of agents deployed to environments on this cluster (<agent>.yaml) — written on deploy, deleted on undeploy

Everything else under agent-gateway/<data plane>/ — for example the gateway's model configuration or your own MCP servers — is never touched by CodeNOW. Every object CodeNOW generates carries the label app.kubernetes.io/managed-by: codenow.

To keep CodeNOW from overwriting or removing your MCP servers:

  • Never put your manifests into codenow-mcp/ or deployed-agents/ of any gateway folder. These folders are owned by CodeNOW; every synchronization rewrites codenow-mcp/ and deletes anything else in it, and deploying or undeploying agents writes and deletes files in deployed-agents/.
  • Do not use the reserved resource names: names starting with codenow-mcp, and names following the agent pattern <agent swarm>-<environment>-<agent>. Give your resources a prefix of your own, for example ext-.

Permissions​

Access to a gateway's console (Logs, Analytics) is controlled by permissions on the Agent Gateway resource. A level can be granted in two scopes:

ScopeApplies to
Account-wideAll gateways of the account, including gateways installed later
Per gatewayOne gateway, chosen by its cluster

A user has a level on a gateway when they hold it account-wide or for that gateway. For example, Viewer account-wide plus Admin on the prod gateway means Viewer on every gateway and Admin on prod. Permissions granted before multiple gateways were introduced are account-wide.

The permissions control access to the gateway console; the account-wide Admin level also allows managing local client profiles. They do not apply to calls to models, MCP servers or agents through a gateway — neither from agents nor from local clients. Who may call an agent is a separate check, set by the agent's allowed callers. For general information about permissions see Common Features — Permissions.

LevelWhat it allows
ViewerRead-only access to the gateway console (Logs, Analytics)
AdminManage the gateway console

Levels can be granted to users and teams, never to service accounts or to all users. They are managed on the AI › Agent Gateways › Permissions page (Add identity), whether the Agent Gateway is enabled or not. Grants are made per identity — there is no row for all users. When you may manage the permissions of more than one gateway — you do not need a level on them — the Scope select above the permissions card chooses what you edit: All gateways (account-wide) (first) or one of those gateways, named by its cluster — the card then edits grants for all Agent Gateways or for the Agent Gateway on <cluster>. The chosen scope is kept in the page URL (?gateway=<data plane>), so you can share a link to one gateway's permissions. If such a link cannot be opened, the page shows The Agent Gateways could not be loaded., This Agent Gateway was not found. It may not be installed, or the gateways could not be loaded. or, for a gateway that is not among those you may manage, This Agent Gateway is not available to you., with Try again and Open account-wide permissions. Account Owners and Admins can also add an Agent Gateway row in the permission editors of a user or a team (Choose Action › Add Permission or the PERMISSIONS tab) — there it is offered as the account-wide instance and one instance per gateway. If the gateways cannot be read, only the account-wide instance can be chosen (The Agent Gateways could not be loaded. Only account-wide access can be granted now; it covers every gateway.). Agent Gateway Permission Managers who are not account Owners or Admins cannot open user details and grant levels on the Permissions page. The levels, with their scope, also appear in the permission lists of individual users and teams.

Scope select with the account-wide scope and the gateways

Who may grant these levels:

  • account Owner and Admin — they hold both levels on every gateway implicitly, without a grant;
  • holders of the account permission Agent Gateway Permission Manager (ai_gateway-permissions-manager), in both scopes. It can be granted to a user or a team, never to a service account or to all users. Being an Agent Gateway admin — account-wide or on one gateway — does not by itself allow granting levels to others. A permission manager needs no level on a gateway to grant levels on it, and gets no Logs or Analytics from this permission.

Service accounts have no Agent Gateway rights: they cannot be given a level — account-wide or per gateway — or the Agent Gateway Permission Manager account permission, and they get none from their owner or team. Levels granted to service accounts earlier no longer count; they are still listed on the gateway's Permissions page, where they can only be removed. The portal does not offer service accounts when adding a permission here; a service account with an earlier level is listed with Service accounts can’t have Agent Gateway permissions. This does not affect deployed agents, which need no Agent Gateway permission, or service accounts as allowed callers of an agent.

Per-gateway levels stay in place when their gateway is uninstalled and apply again when a gateway is installed on the same cluster.

Changes take effect at the next sign-in or token refresh.

Logs and Analytics​

The main navigation has an AI section with Agent Swarms and a collapsible Agent Gateways item. It starts with Permissions (account-wide; shown to those who may manage them) and then lists the clusters you may see by name. When there is nothing to show in it and you may not manage permissions, the item says so (No Agent Gateway available, or Agent Gateways unavailable when the gateways cannot be listed).

Agent Gateways in the main navigation, with one gateway uninstalled
ClusterWhat you see
With an installed gateway you may viewExpands to Logs and Analytics — and, when you may manage the permissions of several gateways, including this one, to the gateway's own Permissions
With a gateway you may not view, but whose permissions you may manageExpands to Permissions only, when you may manage the permissions of several gateways. When it is the only one, the cluster is disabled (No Agent Gateway available) — use the account-wide Permissions. An uninstalled gateway counts here only while agents are still deployed on its cluster; otherwise the cluster is disabled (No Agent Gateway available)
Without a listed gatewayDisabled, with the tooltip No Agent Gateway available (also when you may neither view its gateway nor manage its permissions)
With an uninstalled gateway you may viewDisabled, Agent Gateway uninstalled or Agent Gateway uninstalled, N agents unreachable (1 agent)
Gateways cannot be listed and none is known on the clusterThe tooltip Agent Gateways unavailable

Logs and Analytics open the console of that gateway in a new tab (https://agent-gateway.<data plane host>/ui/llm/logs and /ui/llm/analytics). Each gateway records only the traffic that went through it — the agents on its cluster and the local clients set up against it.

A gateway's Logs and Analytics are enabled only for users with the Viewer or Admin level on that gateway (account-wide or for that gateway) and for account Owners and Admins; otherwise they are disabled. When no gateway is visible to you, the portal does not tell whether none is installed or you lack a level on it — ask an account Owner or Admin. When a gateway is installed or removed, reload the page to update the links.

Signing in to a gateway​

The gateways use CodeNOW single sign-on. Each gateway has its own public OAuth 2.0 client, <account>-<dataplane>-agent-gateway, in the codenow realm (no client secret). A token issued for one gateway's client is meant for that gateway.

Browser (gateway console)​

Signing in to a gateway console uses the authorization code flow with PKCE (S256), which the client requires. Allowed redirect URIs are https://agent-gateway.<data plane host>/*.

CLIs and agents without a browser — device authorization​

Command-line tools and other clients that cannot open a browser use the OAuth 2.0 Device Authorization Grant, enabled on the same client:

  1. Request a device code:

    curl -X POST \
    https://<IAM host>/auth/realms/codenow/protocol/openid-connect/auth/device \
    -d client_id=<account>-<dataplane>-agent-gateway
  2. Open the returned verification_uri_complete (or verification_uri and enter the user_code) in any browser and sign in to CodeNOW.

  3. Poll the token endpoint until the sign-in completes:

    curl -X POST \
    https://<IAM host>/auth/realms/codenow/protocol/openid-connect/token \
    -d grant_type=urn:ietf:params:oauth:grant-type:device_code \
    -d client_id=<account>-<dataplane>-agent-gateway \
    -d device_code=<device_code>

To configure a local AI client such as Claude Code or Codex, you do not have to do this by hand — use the setup guide in AI › Local clients, where you choose the gateway and whose scripts run this flow for you.

Use the returned access token as Authorization: Bearer <token> for calls to the gateway (for example https://agent-gateway.<data plane host>/mcp/codenow) and refresh it with the refresh token before it expires.

<account> is the account's ID and <dataplane> the data plane (cluster) name.

Agents​

Deployed agents do not sign in interactively — CodeNOW gives each agent the token of its service account, and the agent calls the gateway of its cluster with it. The token itself is issued for the whole account, not for a single gateway. Agent admin consoles sign users in through the <account>-ai-agents client (one for all gateways), which also requires PKCE. See Agent Runtime.