customercore / src /api /__init__.py
Saibalaji Namburi
feat(phase10): FastAPI REST API + Dockerfile + SSE streaming
8ce332b
Raw
History Blame Contribute Delete
1.22 kB
"""
CustomerCore REST API β€” Phase 10
This package exposes the full CustomerCore AI platform as a production-grade
FastAPI REST API. It serves as the HTTP surface for:
- External ticket submission (from Slack, email, webhook, or direct HTTP)
- LangGraph multi-agent triage invocation
- HITL (Human-in-the-Loop) review and resume operations
- Prometheus metrics export
- SSE real-time streaming of triage progress
- Health and readiness probes for Kubernetes
Architecture:
src/api/
main.py β€” FastAPI app factory, lifespan, middleware, router mounting
auth.py β€” JWT validation, tenant_id extraction, RBAC
rate_limit.py β€” Redis-backed per-tenant rate limiting (slowapi)
models.py β€” Pydantic request/response schemas for the API layer
routers/
triage.py β€” POST /triage, GET /triage/{id}, POST /triage/{id}/resume
health.py β€” GET /health, GET /ready
metrics.py β€” GET /metrics (Prometheus format)
stream.py β€” GET /triage/{id}/stream (Server-Sent Events)
middleware/
logging.py β€” Structured JSON request logging (structlog)
security.py β€” Security headers, CORS, request ID injection
"""