How agentgateway/agentgateway works
Agentgateway is an AI-native proxy for LLM, MCP, and A2A traffic, with standalone and Kubernetes deployment modes. The primary workflow is a client request entering the proxy, being routed to a model or tool/agent backend, and receiving a response; security, policy, and telemetry provide cross-cutting controls. The README documents major capabilities, while the source index supports selected internal links. Unsampled areas are represented by their exact tree paths, but their internal call relationships are not inferred.
Main entry points: http/mod.rs HTTP proxy · gw_controller.go Gateway controller · model_router.rs LLM routing · client/mod.rs Backend client
Components 25
Proxy runtime
- Runtime entry
crates/agentgateway-app/src/commands/run.rs - HTTP proxy
crates/agentgateway/src/http/mod.rs - Backend client
crates/agentgateway/src/client/mod.rs - Built-in UI
ui/src/main.tsx
AI protocols
- LLM routing
crates/agentgateway/src/llm/model_router.rs - MCP gateway
crates/agentgateway/src/mcp/router.rs - A2A gateway
crates/agentgateway/src/a2a/mod.rs - Inference routing
crates/agentgateway/src/llm/discovery.rs
Security and policy
- LLM guardrails
crates/agentgateway/src/llm/policy/mod.rs - HTTP authentication
crates/agentgateway/src/http/auth/mod.rs - CEL policies
crates/agentgateway/src/cel/mod.rs - TLS transport
crates/agentgateway/src/transport/tls.rs
Configuration and telemetry
- Runtime config
crates/agentgateway/src/config.rs - State manager
crates/agentgateway/src/state_manager.rs - Dynamic config store
crates/agentgateway/src/config_store.rs - Resource loading
crates/agentgateway/src/resource_manager.rs - Telemetry
crates/agentgateway/src/telemetry/mod.rs
Kubernetes control plane
- Gateway controller
controller/pkg/controller/gw_controller.go - Gateway translator
controller/pkg/agentgateway/translator - xDS syncer
controller/pkg/syncer
Other components
- Client
- Model providers
- Tools and data
- External agents
- Kubernetes API
Connections 20
- Client → HTTP proxy: sends requests
README.md - HTTP proxy → LLM routing: routes LLM
README.md - HTTP proxy → MCP gateway: routes MCP
README.md - HTTP proxy → A2A gateway: routes A2A
README.md - HTTP proxy → HTTP authentication: applies auth
README.md - HTTP proxy → CEL policies: checks policies
README.md - HTTP proxy → LLM guardrails: filters content
README.md - LLM routing → Inference routing: selects models
README.md - LLM routing → Model providers: forwards requests
README.md - MCP gateway → Tools and data: connects tools
README.md - A2A gateway → External agents: communicates with
README.md - HTTP proxy → Backend client: uses backend client
crates/agentgateway/src/http/mod.rs - Backend client → TLS transport: configures TLS
crates/agentgateway/src/client/mod.rs - HTTP proxy → Telemetry: emits telemetry
crates/agentgateway/src/http/mod.rs - Runtime entry → Runtime config: loads configuration
- State manager → Dynamic config store: uses config store
crates/agentgateway/src/state_manager.rs - Dynamic config store → Resource loading: loads resources
crates/agentgateway/src/config_store.rs - Gateway controller → Kubernetes API: reconciles gateways
controller/pkg/controller/gw_controller.go - Gateway controller → Gateway translator: translates config
- Gateway controller → xDS syncer: publishes xDS