Why separating UI and AI workers prevents serverless timeouts
Document ingestion, multi-step agent runs, and image/video generation often take 15–90 seconds—far longer than standard serverless function limits. Offloading heavy AI jobs to Redis/Celery workers while streaming live progress events over SSE keeps the UI snappy and reliable.
- Next.js / React handles auth, billing portals, SEO landing pages, and SSE token streaming.
- FastAPI + Python workers handle embeddings, RAG, LangGraph, and model routing.
- Usage credits are deducted atomically in Postgres so billing stays 100% accurate.