ON-PREM CHOREO CLOUD BOTH

What you will learn

  • Name the parts of the API Platform Gateway and what each one does
  • Match the on-prem ports to the parts that use them
  • Explain where the gateway gets its configuration and where it keeps its state
  • Follow a request through the router and the policy chain, and say what happens if the policy engine cannot answer

Before you start

On this page

Agent requests pass through a gate. The gate checks who is calling, applies the rules, and only then lets the request through to the agent, a model vendor or a tool server. In Agent Manager that gate is the , or APG. This lesson takes it apart. It is the same gateway that the lessons on LLM traffic and traces rely on, and now you will see its parts.

Two pieces, not one

Component

API Platform Gateway runtime (APG)

Data side Gateway BOTH

The API Platform Gateway runtime (APG) is the AI gateway. It is the one doorway for agent traffic: calls to LLM vendors, calls to MCP tool servers, trace uploads, and calls into agents. A router checks each request against a chain of policies before passing it on. It runs on the data plane side, one per organization and environment.

APG is made of two Deployments that work as a pair.

  • The is the brain of one gateway. It talks to AMS and prepares configuration.
  • The gateway runtime is one container that holds the , which receives the requests, and the , which runs the rules. A small Python helper can run beside them when the image contains policies written in Python. In the Agent Manager setup the router and the engine talk to each other over a Unix socket inside the container.

There is one gateway for each organisation and environment. On-prem, the installs it when it sees an APIGateway resource. On Choreo Cloud, Choreo Labs’ own services create it.

The parts and their ports

On-prem, the gateway values that the Agent Manager chart hands to the operator give each part its numbers.

PartPortJob
Controller, management REST API9090Manage the gateway.
Controller, xDS for the router18000Send listeners, routes and clusters to the router.
Controller, xDS for the policy engine18001Send policy chains and key hashes to the engine.
Router, HTTP and HTTPS22893 and 22894Receive requests.
Policy engine, admin9002Administration of the engine.

is Envoy’s way of receiving its configuration while it runs, so nothing has to restart when a route changes. Choreo Cloud’s gateway template uses 8080 and 8443 for the router instead.

Where the configuration comes from

The gateway does not make up its rules. They reach it by two routes, and both start in Agent Manager.

  • An agent’s own route comes from the api-configuration. When an agent is deployed, the trait creates a RestApi resource in the agent’s namespace, with the route and the policies that Agent Manager chose. The gateway operator finds the gateway that the resource’s label points at and hands the resource to that gateway’s controller on its management port, 9090.
  • LLM providers, LLM proxies, MCP proxies and A2A agents come from AMS. AMS writes an event, and the controller fetches the definition over REST.
  1. The controller dials AMS

    It opens a WebSocket to AMS’s internal server, with its registration token in the api-key header. If the line drops, it reconnects, waiting from 1 second up to 5 minutes.

  2. It collects what it needs

    When AMS reports a deployment, the controller fetches the definition of that LLM provider, proxy or A2A agent. It also fetches the lists of API key hashes. An agent’s route arrives from the gateway operator instead, as described above.

  3. It feeds the router and the engine

    Listeners, routes and clusters go to the router. Policy chains, route settings and API key hashes go to the policy engine. From then on the route exists on the gateway.

  4. It keeps its state

    The controller saves what it rendered in a small SQLite database on a 100Mi volume, so a restart does not lose it.

Component

APG gateway-controller

Data side Gateway BOTH

The gateway-controller is the local control brain of one gateway. It connects to AMS over a WebSocket, downloads the definitions of LLM providers, proxies and agents, and turns them into configuration for the router and policy engine. It stores state in a small database.

The policies themselves are compiled into the gateway when its image is built, from the gateway’s build file. AMS does not send code. It decides which policies a route uses. Each gateway also tells AMS which policies it has installed, and AMS keeps the latest list it received, so the console only offers the rules that the gateways report.

One request through the gate

  1. A caller reaches the first gateway

    The data plane’s ingress gateway, , routes by host name. It does not check credentials.

  2. Everything is passed to APG

    A patch added at deploy time points all of the route’s traffic at the gateway runtime. On-prem that is port 22893.

  3. The router asks the policy engine

    The router sends each request to the policy engine and waits for the answer. If the engine cannot answer, the request is not let through. The link is set to fail closed.

  4. The policy chain runs

    The engine looks up the for this route. It runs the request policies in order and the response policies in reverse. For an agent route, the browser access rules come first and then one key check or one token check. A policy can end the request early, for example with a 401, 403 or 429.

  5. The agent is called

    If everything passes, the router calls the agent’s Service, and the answer comes back the same way.

On-prem, an agent in the cluster is given the address of its environment’s gateway runtime Service, on port 22893, for its model calls and its trace uploads. It does not go out through the ingress and back.

In Choreo Cloud

Each organisation and environment still has its own gateway. Choreo Labs’ own services create it, the provisioner or platform-api’s bootstrap, and OpenChoreo deploys it to the data plane. In the gateway template of the organisation bootstrap, the controller keeps its state in Postgres instead of a file. Agents there reach the gateway on its public host name, not on the in-cluster runtime address.

Your turn

Under Try it, play flow F8 and stop at the step where the policy engine checks the request. What happens if it cannot answer? Then open the gateway diagram and click the router and the policy engine in turn. Which port does the router listen on? Finish with the matcher that pairs each part and port with its job.

Recap

  • APG is two Deployments. The gateway-controller prepares the configuration. The gateway runtime holds the Envoy router and the policy engine.
  • The controller dials AMS and receives definitions, from AMS and, for an agent’s own route, from the gateway operator. It feeds the router (port 18000) and the policy engine (port 18001). It keeps its state in a small SQLite database on-prem.
  • The policies are compiled into the gateway’s image. AMS chooses which ones a route uses and keeps the latest list of installed policies that a gateway reported.
  • The router asks the policy engine about each request, and fails closed if the engine cannot answer.

Try it

Follow one request

What to do: press Play, or use Next, to walk through the request step by step.

Loading the diagram...

The diagram

What to do: look at the highlighted boxes, then click one. "Reset view" shows the whole diagram.

Loading the diagram...

Match them up

What to do: pick an item on the left, then its partner on the right.

Loading the matching game...

Wrap up

Recap

Tick each one when you could explain it to a colleague.

Finished?

Quick check

Loading the quick check...

Spotted something wrong or unclear in this lesson? Report an inaccuracy (opens GitHub in a new tab)