Spaces:
Running
Running
Download src/api/__init__.py from saibalajiomg/customercore: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/spaces/saibalajiomg/customercore/resolve/main/src/api/__init__.py
- Command line
-
hf download hf://spaces/saibalajiomg/customercore/src/api/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/saibalajiomg/customercore/resolve/main/src/api/__init__.py
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 | |
| """ | |