Component ยท Data side
APG policy engine
BOTH Component Gateway
What it is
The policy engine is a Go service that runs the gateway's policies. Envoy calls it for each request through ext_proc, a hook that lets an outside service inspect and change traffic. It has no built-in policies. Every policy is compiled in when the image is built.
Why it exists
Security and governance rules should be configuration, not code in each agent. A separate engine lets the same router apply different rules to different routes.
How it works
- Looks up the policy chain for the route, then runs request policies in order, and response policies in reverse order.
- Decides per chain whether it needs the request body (buffered) or only headers, so body inspection costs nothing when unused.
- A policy can end the request early, for example with 401, 403 or 429.
- It fails closed: if the engine cannot answer, Envoy does not let the request through.
- Admin port 9002. A metrics port (9003) exists but is off unless enabled. In Agent Manager, Envoy reaches it over a Unix domain socket.
Identity and access
It is where authentication and authorization happen. Policies such as api-key-auth, jwt-auth, mcp-auth and mcp-authz run here and read credentials from the request.
Key facts
- Ports
- Admin 9002, metrics 9003 (off by default)
- Language
- Go
- Failure mode
- Fail closed
- Side
- Data plane (gateway)
- Namespace
- <org>-<env>
Talks to (1)
- calls APG python executor Python policiesgRPC over UDS
Used by (2)
- called by APG gateway-controller Pushes chains, route config, api key hashes, subscriptionspolicy xDS :18001
- called by APG router (Envoy 1.39.0) Per-request policy execution; fail closedext_proc gRPC over UDS
Inside and around
Part of: APG gateway builder