跳到主要内容

Architectures

Overview

The AI Gateway system is designed with a two-plane architecture consisting of a Management Plane and a Traffic Plane. The two planes are intentionally decoupled and connected only through native Kubernetes configuration mechanisms, enabling centralized governance with reliable runtime enforcement.

Management Plane

Operators manage the system through a Management Panel, covering the following functional areas:

  • Gateway: gateway lifecycle and related components
  • Backend: definition and management of destinations (LLMs, MCP, APIs)
  • Route/API: routing rules, endpoints, and API mappings
  • Policy: access control and content governance policies
  • Secret: credentials and keys management
  • Gateway Config: operational gateway settings
  • Topology/Monitoring: system visibility and monitoring views

All UI actions are materialized as Kubernetes CRDs. The agentgateway continuously watches these CRDs and reconciles runtime behavior accordingly. This is the single, controlled integration point between management and production traffic.

Traffic Plane (Runtime Flow)

Requests flow left → right:

Input Traffic (AI Clients)

The gateway accepts requests from common AI clients such as Claude Desktop, Cursor, GitHub Copilot, as well as custom applications/agents.

agentgateway (Rust Proxy)

All requests pass through agentgateway, which enforces and optimizes traffic before forwarding:

  • Auth / AuthZ
  • Rate Limiting
  • Prompt Guard
  • Routing
  • Caching
  • Observability 
Backends

Processed requests are forwarded to one of three backend categories:

  • AI Models: OpenAI, Anthropic, Bedrock, Gemini, Vertex, etc.
  • MCP Servers: tool/data servers (e.g., GitHub, Slack, databases, …)
  • REST APIs: internal Kubernetes services or external HTTP endpoints

Components Summary

Management Plane (this repository)

ComponentTechnologyRole
Vue UIVue 3.4 + TypeScript 5.4 + Vite 5.3Operator console, standalone or MFE (ai-gateway) on port 8230
CORE serviceREST /core/v1Profile, menu, project (cross-cutting)
AI_GATEWAY serviceREST /ai-gateway/v1CRUD for all CRDs, realm + project scoped

Runtime Plane (agentgateway upstream project)

ComponentTechnologyRole
Control planeGogatewayReconciler (Helm render) + agentgatewaysyncer (XDS converter)
Data planeRustTLS, AuthN/Z, rate limit, prompt guard, routing — all in one pod
Backend dispatchers (built-in)4 types — ai, mcp, static, dynamicForwardProxy

Kubernetes Resources

CRDAPI GroupPurpose
Gatewaygateway.networking.k8s.ioEntry point with listeners (host / port / TLS); GatewayClass = agentgateway
HTTPRoutegateway.networking.k8s.ioMatch request → backendRef; supports filters (rewrite / redirect / mirror)
AgentgatewayBackendagentgateway.dev/v1alpha1Upstream definition (ai / mcp / static / dfp)
AgentgatewayPolicyagentgateway.dev/v1alpha1Frontend / traffic / backend policies (incl. AI sub-policies)
AgentgatewayParametersagentgateway.dev/v1alpha1Data-plane provisioning (image, replicas, HPA, etc.)
Secretcore/v1TLS certificates and backend API keys