Appearance
Gatez — Architecture Overview
The Three-Layer Gateway
┌─────────────────────────────────────────────┐
│ CONTROL PLANE │
│ ┌───────────────┐ ┌───────────────┐ │
│ │ Operator │ │ Developer │ │
│ │ Portal │ │ Portal │ │
│ │ :3003 │ │ :3004 │ │
│ └───────┬───────┘ └───────┬───────┘ │
│ │ │ │
│ ┌───────┴───────────────────┴───────┐ │
│ │ Control Plane API (:4001) │ │
│ │ Rust (axum + tokio) │ │
│ └──────┬──────┬──────┬──────┬──────┘ │
└─────────┼──────┼──────┼──────┼──────────────┘
│ │ │ │
┌───────────────────────────────┼──────┼──────┼──────┼───────────────────────┐
│ │ │ │ │ │
│ ┌───────────────────────────┼──────┼──────┼──────┼────────────────────┐ │
│ │ ▼ │ │ │ │ │
│ │ ┌─────────────────────────┐ │ │ │ │ │
Clients ────┼───┼──▶│ L1 — API GATEWAY │ │ │ │ │ │
(HTTP, │ │ │ Apache APISIX (:9080) │ │ │ │ │ │
gRPC, │ │ │ │ │ │ │ │ │
WebSocket) │ │ │ • JWT auth (Keycloak) │ │ │ │ │ │
│ │ │ • Per-tenant rate limit │ │ │ │ │ │
│ │ │ • Request logging (CH) │ │ │ │ │ │
│ │ │ • gRPC transcode │ │ │ │ │ │
│ │ │ • WebSocket proxy │ │ │ │ │ │
│ │ │ • Circuit breaker │ │ │ │ │ │
│ │ │ • Traffic splitting │ │ │ │ │ │
│ │ └──────────┬────────────────┘ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ ▼ │ │ │ │ │
│ │ ┌─────────────────────────┐ │ │ │ │ │
│ │ │ L2 — AI GATEWAY │ │ │ │ │ │
│ │ │ Custom Rust (:4000) │ │ │ │ │ │
│ │ │ │ │ │ │ │ │
│ │ │ • Multi-model routing │──────┘ │ │ │ │
│ │ │ (OpenAI, Anthropic, │ │ │ │ │
│ │ │ Gemini, Ollama) │ │ │ │ │
│ │ │ • PII redaction │ │ │ │ │
│ │ │ • Token budget enforce │ │ │ │ │
│ │ │ • Semantic cache │ │ │ │ │
│ │ │ (Redis + Qdrant) │ │ │ │ │
│ │ │ • SSE streaming │ │ │ │ │
│ │ │ • Fallback + circuit brk │ │ │ │ │
│ │ └──────────┬────────────────┘ │ │ │ │
│ │ │ │ │ │ │
│ │ ▼ │ │ │ │
│ │ ┌─────────────────────────┐ │ │ │ │
│ │ │ L3 — AGENT GATEWAY │ │ │ │ │
│ │ │ Custom Rust (:5001) │──────────────┘ │ │ │
│ │ │ │ │ │ │
│ │ │ • MCP protocol │ │ │ │
│ │ │ • A2A protocol │ │ │ │
│ │ │ • Session management │ │ │ │
│ │ │ • Tool allowlists │ │ │ │
│ │ │ • HITL approval gates │ │ │ │
│ │ │ • Blast radius controls │ │ │ │
│ │ │ • Tool poisoning protect │ │ │ │
│ │ └──────────────────────────┘ │ │ │
│ │ │ │ │
│ └────────────────────────────────────────────────────┼────────────────────┘ │
│ DATA PLANE │ │
│ │ │
│ ┌───────────────────────────────────────────────────┼────────────────────┐ │
│ │ INFRASTRUCTURE │ │ │
│ │ │ │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌───────┴──────┐ │ │
│ │ │ Redis │ │ClickHouse│ │ Qdrant │ │ Keycloak │ │ │
│ │ │ :6379 │ │ :8123 │ │ :6333 │ │ :8081 │ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ • Rate │ │ • Request│ │ • Semantic│ │ • JWT issuer │ │ │
│ │ │ limits │ │ logs │ │ cache │ │ • Realm/user │ │ │
│ │ │ • Budgets│ │ • AI logs│ │ vectors│ │ management │ │ │
│ │ │ • Session│ │ • Agent │ │ │ │ • OIDC/SAML │ │ │
│ │ │ state │ │ audit │ │ │ │ • IdP broker │ │ │
│ │ │ • Tenant │ │ • Mater. │ │ │ │ │ │ │
│ │ │ config │ │ views │ │ │ │ │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ └──────────────┘ │ │
│ │ │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │ │
│ │ │ etcd │ │Prometheus│ │ Grafana │ │ Jaeger │ │ │
│ │ │ :2379 │ │ :9090 │ │ :3002 │ │ :16686 │ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ • APISIX │ │ • Metrics│ │ • Dashbds│ │ • Distrib. │ │ │
│ │ │ config │ │ from │ │ (4 per │ │ tracing │ │ │
│ │ │ store │ │ L1+L2 │ │ layer) │ │ L1→L2→L3 │ │ │
│ │ │ │ │ +L3 │ │ │ │ │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ └──────────────┘ │ │
│ │ │ │
│ └──────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
ON-PREMISES / PRIVATE CLOUD
(Everything runs from container images)Request Flow — API Call Through All 3 Layers
Data Isolation — Per-Tenant Architecture
Every data store isolates by tenant_id. No shared state leaks across tenants.
| Layer | Isolation Method |
|---|---|
| APISIX | JWT claim extracts tenant_id → independent rate limit bucket per tenant |
| Redis | Key prefix: {tenant_id}:budget:*, rl:{tenant_id}:*, policy:tenant:{tenant_id} |
| ClickHouse | Shared tables, WHERE tenant_id = '...' filter on every query |
| Keycloak | Groups in shared gateway realm, or separate realms per tenant |
| Agent Gateway | Sessions scoped by tenant, tool allowlists per tenant, cross-tenant blocked |
Port Map
| Service | Internal Port | External Port | Purpose |
|---|---|---|---|
| APISIX (proxy) | 9080 | 9080 | API traffic entry point |
| APISIX (admin) | 9180 | 9180 | Route/plugin management |
| APISIX (metrics) | 9091 | 9091 | Prometheus scrape |
| AI Gateway | 4000 | 4000 | LLM routing + cache + PII |
| Agent Gateway | 5000 | 5001 | MCP + A2A + sessions |
| Control Plane API | 4001 | 4001 | Coordinates all services |
| Operator Portal | 3003 | 3003 | Platform admin UI |
| Developer Portal | 3004 | 3004 | Tenant user UI |
| Redis | 6379 | 6380 | State store |
| ClickHouse | 8123 | 8123 | Analytics + audit |
| Keycloak | 8080 | 8081 | Identity + auth |
| Qdrant | 6333 | 6333 | Vector similarity cache |
| Prometheus | 9090 | 9090 | Metrics collection |
| Grafana | 3000 | 3002 | Dashboards |
| Jaeger | 16686 | 16686 | Distributed tracing |
| etcd | 2379 | 2379 | APISIX config store |
| OTel Collector | 4317 | 4317 | Trace collection |
Technology Stack
| Layer | Technology | Language | Why |
|---|---|---|---|
| L1 API Gateway | Apache APISIX | Lua (plugins) | 50k TPS, battle-tested, plugin ecosystem |
| L2 AI Gateway | Custom (axum) | Rust | Sub-ms overhead, zero-copy streaming |
| L3 Agent Gateway | Custom (axum) | Rust | Session state + protocol handling at speed |
| Control Plane API | Custom (axum) | Rust | Coordinates all services, same stack |
| Operator Portal | React + Vite | TypeScript | 16-page admin console |
| Developer Portal | React + Vite | TypeScript | 4-page tenant self-service |
| Identity | Keycloak | Java | Enterprise IdP, OIDC/SAML/LDAP |
| Analytics | ClickHouse | SQL | 50k+ writes/sec, columnar queries |
| Cache | Redis | - | Rate limits, budgets, sessions, config |
| Vector Search | Qdrant | Rust | Semantic cache similarity |
| Observability | OTel + Prometheus + Grafana + Jaeger | - | Full stack, cross-layer tracing |