Agent Router for LLM and MCP Traffic
Two calls count equally against a request limit. One carries a long prompt. Which tenant exhausts the model budget first?
Conventional Layer-7 API gateways operate on URL paths, HTTP verbs, and requests-per-minute (RPM) counters—leaving gaps when token costs vary dramatically across calls, MCP traffic runs over JSON-RPC 2.0 plus streaming HTTP/SSE, and tool names collide across backend servers. On September 9, 2026, Envoy AI Gateway announced its transition to Agent Router (joining the AAIF on September 10 under theagentrouter/agent-router, while keeping backward compatibility for aigateway.envoyproxy.io and aigw), unifying LLM routing and MCP aggregation in v1.2.
Policy Ownership Across an AI Request Lifecycle
At the gateway data plane, a request crosses authentication, routing, upstream credential injection, usage metering, and telemetry export:
Keep distinct governance concerns separated:
- Separate three quota layers: upstream provider token limits, tenant-facing gateway token rate limits, and monetary spend budgets serve different roles (for per-request model tiering and budget circuit breaking, see Adaptive Thinking and Tiered Model Routing).
- Reference and inject credentials:
BackendSecurityPolicyreferences Secrets or cloud IAM identities and injects upstream credentials so individual services never copy primary API keys. - Failover requires
BackendTrafficPolicyand has a streaming limit: Configure failover explicitly viaBackendTrafficPolicy(Traffic Handling), noting that once a streamed response has started emitting output, the gateway cannot transparently switch upstreams mid-stream. - Centralized telemetry: Export latency, time-to-first-token, and token metrics through Envoy/OTEL pipelines into your LLM Observability stack.
Agent Router v1.2 v1beta1 CRD Responsibilities
Per the Agent Router v1.2 API Reference, aigateway.envoyproxy.io/v1beta1 is a beta API with five distinct Kinds:
Core CRD (v1beta1 Beta API) |
Responsibility | Typical Configuration |
|---|---|---|
AIGatewayRoute |
LLM inference routing rules | Match by model name, tenant headers, or traffic weights across backends |
AIServiceBackend |
Upstream AI service abstraction | Define provider schema and backend service reference |
BackendSecurityPolicy |
Upstream credential injection | Reference Secrets or cloud IAM credentials injected into upstream calls |
GatewayConfig |
Configure the AI external processor (extProc) container (Gateway Config) |
Referenced via annotation by a Gateway in the same namespace; sets extProc env vars, resources, and metadata forwarding |
MCPRoute |
MCP routing and multiplexing (MCP Gateway) | Aggregate backend MCP servers, tool prefixes, authorization rules, and streaming transport |
Avoid attributing rate-limit backends, telemetry exporters, or timeouts to GatewayConfig—it configures the extProc sidecar/processor container, while failover, retries, and timeouts live in traffic policies such as BackendTrafficPolicy.
For MCP traffic, MCPRoute provides:
- Server multiplexing: Clients talk to one aggregated endpoint instead of tracking dozens of backend server URLs.
- Tool namespacing: Backend prefixes (such as
github__issue_read) prevent tool-name collisions across internal servers. - OAuth Authorization Code + PKCE and stream resumption: Integrates OAuth + PKCE per the MCP spec, scopes tool discovery per client identity when authorization rules are configured, and handles Streamable HTTP with
Last-Event-IDresumption (dependent on backend stream support).
A2A Routing: Preview Scope vs. Production Interim Path
Keep preview capabilities separate from production recommendations when governing A2A traffic:
- Current Agent Router A2A preview (A2A Preview Docs): Covers JSON-RPC only via an Envoy alpha filter attached with
EnvoyPatchPolicy. A first-classA2ARouteCRD remains an open proposal (GitHub #2070). - Production interim path: Until
A2ARoutematures, govern cross-team A2A traffic with standard HTTPS/gRPC proxies, strict egress allowlists, and short-lived tokens rather than betting production SLAs on an alpha filter.
When to Adopt an AI Gateway
Base adoption on credential sharing, policy duplication, and audit ownership (counts below are illustrative examples):
- Single-service stage: When one service holds its own credentials with no cross-team audit mandate, a thin backend adapter for timeouts, retries, and spend caps is sufficient.
- Shared-credential and duplicated-policy stage (for example, 2+ model vendors or 3+ internal MCP servers): Once multiple repos duplicate API keys, rate limits, and MCP server lists, extract a dedicated proxy or managed gateway.
- Multi-team Kubernetes platform stage: When organizations need declarative GitOps governance and centralized compliance audits, deploy Agent Router for
AIGatewayRoute,BackendSecurityPolicy, andMCPRoute.