File size: 1,221 Bytes
8ce332b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
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
"""