Datum: 2026-01-25 Port: 9090 Status: ✅ PRODUKČNÍ
Unified Gateway je centrální vstupní bod pro všechny CzechAI agent servery. Namísto volání 11 různých portů (9100-9116), voláš JEDEN port (9090) a gateway ti směruje requesty na správnou službu.
# Základní info
curl http://localhost:9090/
# Health check všech služeb
curl http://localhost:9090/health
# Seznam služeb
curl http://localhost:9090/api/services
# Seznam všech agentů
curl http://localhost:9090/api/agents
# Swagger UI dokumentace
http://localhost:9090/docs
# Prometheus metrics
curl http://localhost:9090/metrics
# Vytvoř SSH tunnel
ssh -L 9090:localhost:9090 root@46.224.121.179
# Pak v jiném terminálu
curl http://localhost:9090/health
curl http://46.224.121.179:9090/health
# 1. Přihlásit se na server
ssh root@46.224.121.179
# 2. Přejít do složky
cd /root/.claude-code/unified_gateway
# 3. Spustit/Restartovat/Zastavit
docker compose up -d # Spustit
docker compose restart # Restartovat
docker compose down # Zastavit
# 4. Logování
docker compose logs -f # Real-time logy
# 1. Zastavit
docker compose down
# 2. Rebuild (BEZ cache!)
docker compose build --no-cache
# 3. Spustit
docker compose up -d
# 4. Ověřit
curl http://localhost:9090/health
Gateway běží v Dockeru, NE přes PM2. Pokud chceš PM2:
# NE! Gateway je Docker service
pm2 list | grep gateway # Nic nenajdeš
[Klient]
↓
[Nginx] (api.czechai.io) - budoucí TODO
↓
[Gateway:9090] ←──────────── Unified vstup
↓
├─→ Banking (9100) 6 agentů
├─→ Legal-AML (9101) 5 agentů
├─→ Real Estate (9102) 9 agentů
├─→ Insurance (9103) 4 agenty
├─→ Compliance (9104) 5 agentů
├─→ Risk (9105) 5 agentů
├─→ AML (9106) 7 agentů
├─→ Legal (9107) 3 agenty
├─→ Data (9108) 14 agentů
├─→ Contact (9109) 12 agentů
└─→ Orchestrator (9116) 2 agenty
POST http://localhost:9090/api/banking/loan-assessmenthttp://localhost:9100 (banking service)POST http://localhost:9100/loan-assessment# BANKING - Loan Assessment
curl -X POST http://localhost:9090/api/banking/loan-assessment \
-H "Content-Type: application/json" \
-d '{
"amount": 5000000,
"monthly_income": 80000,
"property_value": 8000000,
"monthly_expenses": 30000
}'
# LEGAL-AML - Company Screening
curl -X POST http://localhost:9090/api/legal-aml/company-screening \
-H "Content-Type: application/json" \
-d '{
"ico": "12345678",
"company_name": "Example s.r.o."
}'
# REAL ESTATE - Due Diligence
curl -X POST http://localhost:9090/api/real-estate/due-diligence \
-H "Content-Type: application/json" \
-d '{
"property_id": "ABC123",
"address": "Praha 1, Václavské náměstí 1"
}'
# Zkontroluj všechny služby
curl http://localhost:9090/health | jq
# Response:
# {
# "gateway": "healthy",
# "overall": "healthy",
# "services": {
# "banking": {"status": "healthy", "url": "http://localhost:9100"},
# "legal-aml": {"status": "healthy", "url": "http://localhost:9101"},
# ...
# }
# }
# Prometheus metrics endpoint
curl http://localhost:9090/metrics
# Metriky:
# - gateway_requests_total (celkový počet requestů)
# - gateway_request_duration_seconds (doba trvání)
# - gateway_active_requests (aktivní requesty)
# - gateway_service_health (zdraví služeb - 1=healthy, 0=unhealthy)
# - gateway_proxy_requests_total (proxy requesty)
# - gateway_proxy_errors_total (proxy errors)
# Budoucí setup:
# 1. Prometheus scraping z /metrics
# 2. Grafana vizualizace
# 3. Alerting (Slack notifications)
unified_gateway/
├── app.py # Hlavní FastAPI aplikace (494 řádků)
├── generate_openapi.py # OpenAPI schema generator (548 řádků)
├── openapi.json # OpenAPI 3.0 schema (1057 řádků, 27KB)
├── openapi.yaml # YAML verze (optional)
├── requirements.txt # Python dependencies
├── Dockerfile # Docker build
├── docker-compose.yml # Docker orchestrace
├── deploy.sh # Deployment script
├── README.md # Původní dokumentace
└── PRISTUP_A_POUZITI.md # TENTO SOUBOR - vstupní dokumentace
Gateway momentálně nepotřebuje ENV proměnné. Všechny URL jsou hardcodované v app.py:
AGENT_SERVICES = {
"banking": {"url": "http://localhost:9100", ...},
"legal-aml": {"url": "http://localhost:9101", ...},
...
}
| Port | Použití |
|---|---|
| 9090 | Gateway hlavní port |
| 9100-9116 | Backend agent servery (11 služeb) |
# 1. Zkontroluj Docker status
docker ps | grep unified-gateway
# 2. Podívej se na logy
cd /root/.claude-code/unified_gateway
docker compose logs -f
# 3. Restart
docker compose restart
# 4. Pokud nepomohlo - rebuild
docker compose down
docker compose build --no-cache
docker compose up -d
# 1. Zkontroluj který agent server neběží
curl http://localhost:9090/health | jq '.services'
# 2. Test konkrétního serveru (např. banking)
curl http://localhost:9100/health
# 3. Pokud 9100 neběží - restart banking serveru
cd /opt/agents/banking # (nebo kde je banking implementace)
# ...restart podle implementace (PM2/Docker/systemd)
# 1. Test /metrics endpointu
curl http://localhost:9090/metrics | head -20
# 2. Pokud error "ModuleNotFoundError: No module named 'prometheus_client'"
# - Rebuild Docker image BEZ cache:
docker compose down
docker system prune -af
docker compose build --no-cache
docker compose up -d
# 1. Zjisti co běží na 9090
netstat -tlnp | grep 9090
# 2. Pokud MinIO nebo jiná služba - změň port v docker-compose.yml:
# ports:
# - "9091:9090" # Místo 9090:9090
# 3. Restart
docker compose down && docker compose up -d
| Soubor | Popis |
|---|---|
README.md |
Původní dokumentace gateway (230 řádků) |
BATCH_8_COMPLETE_SUMMARY.md |
Kompletní summary Batch 8 (453 řádků) |
PRAKTICKE_PRIKLADY_POUZITI.md |
9 praktických příkladů použití |
AGENT_IMPLEMENTATION_STATUS.md |
Status všech 111 agentů |
app.py v sekci AGENT_SERVICES:AGENT_SERVICES = {
...
"nova-sluzba": {
"url": "http://localhost:9117",
"name": "Nová Služba",
"description": "Popis nové služby",
"tag": "Nova Sluzba"
}
}
docker compose down
docker compose build --no-cache
docker compose up -d
curl http://localhost:9090/health | jq '.services."nova-sluzba"'
# 1. Update generate_openapi.py (přidej nové endpointy)
# 2. Regeneruj schema
python generate_openapi.py
# 3. Zkopíruj do Docker
docker cp openapi.json czechai-unified-gateway:/app/openapi.json
# 4. Restart
docker compose restart
# 5. Ověř
curl http://localhost:9090/docs # Swagger UI
# 1. SSH na server
ssh root@46.224.121.179
# 2. Test gateway
curl http://localhost:9090/health
# 3. Pokud neběží - start
cd /root/.claude-code/unified_gateway
docker compose up -d
# 4. Swagger UI
# → Otevři v browseru: http://46.224.121.179:9090/docs
# (nebo přes SSH tunnel)
# 5. Test endpoint
curl -X POST http://localhost:9090/api/banking/loan-assessment \
-H "Content-Type: application/json" \
-d '{"amount": 5000000, "monthly_income": 80000}'
# 6. Hotovo! ✅
Vytvořeno: 2026-01-25 Autor: CzechAI Status: ✅ PRODUCTION READY
© 2026 CzechAI | router.czechai.io | API Docs