A student's document-summary feature timed out on long PDFs because the whole pipeline ran inside one synchronous HTTP request. Some AI tasks are simply too slow for that pattern.
The fix: submit, poll, notify
- The API endpoint accepts the task and immediately returns a job ID — it does not wait for the AI call to finish.
- A background worker (a queue, a simple polling loop, or a serverless function) processes the job separately.
- The frontend polls a status endpoint, or the backend pushes a notification, when the job completes.
When you need this
Anything likely to take more than a few seconds — long-document processing, multi-step agentic tasks, batch operations. A quick chat reply doesn't need this; a full-document analysis usually does.
See notebook to production checklist for where this fits into a broader deployment plan.






