Week 20 Master Guide
Week 20: Production FastAPI Microservice, Streaming Web Chatbot & Month 5 Capstone
Week 20 Daily Breakdown (4 Days)
Day 1
Day 1: Microservice Production Architecture & Schemas
1 code file(s) • 2 Q&ADay 2
Day 2: Streaming API Endpoints & Server-Sent Events Routes
1 code file(s) • 2 Q&ADay 3
Day 3: Semantic Cache & OpenTelemetry Tracing Integration
1 code file(s) • 2 Q&ADay 4
Day 4: Docker Compose & Multi-Stage Containerization
1 code file(s) • 2 Q&AWeek 20: Production FastAPI Microservice, Streaming Web Chatbot & Month 5 Capstone
1. Executive Overview
Week 20 culminates the entire fifth month of our 6-Month AI Engineering journey. You take every production concept mastered across Weeks 17, 18, and 19:
- Week 17: High-concurrency ASGI Lifespan, SSE token streaming, multi-turn chat memory, and token-bucket rate limiting.
- Week 18: OpenTelemetry GenAI semantic conventions, Langfuse observability traces, sub-10ms semantic prompt caching (), and multi-provider cascade routing.
- Week 19: Generative UI component rendering, Smart auto-scrolling, multimodal attachments, and E2E contract testing.
and synthesize them into Capstone Project 5: Production FastAPI Microservice, Streaming Web Chatbot & MLOps Platform (
capstones/month05_production_fastapi_mlops/).
2. Capstone Architecture
Architecture Flow Diagram
Client Web Browser / SRE CLI->|POST /v1/copilot/query (SSE/JSON)| Gateway[FastAPI Microservice Engine
Auth[1. API Key Auth & Token-Bucket Rate Limiter
Quota{2. Spend Quota Check}
|Allowed| Cache{3. Semantic Prompt Cache (Cosine >= 0.95)}
|Hit (< 10ms, $0)| FastReturn[Fast Cache Stream (0 Tokens)
|Miss| LLMGateway[4. Resilient Cascade Model Router
P1[Primary: OpenAI gpt-4o-mini
|503 Outage| P2[Fallback: Claude 3.5 Haiku
& P2->OTel[5. OpenTelemetry GenAI Tracing (W3C traceparent)
LF[6. Langfuse Trace & Score Ingestion
Prom[7. Prometheus /metrics & K8s Probes (/healthz, /readyz)