Async Workflows and Background Jobs
Long-running agents need queues (Celery, RQ, Temporal) — return a job id, poll for status.
When the Request Cycle Is Too Slow
Some agent tasks take 30s, 5min, or hours. You cannot keep the HTTP connection open. Move them to async background jobs.
The Pattern
- Client POSTs the task -> server creates job, returns job_id
- Worker picks up the job from a queue
- Client polls GET /jobs/{id} for status
- When done, server returns the result
All lessons in this course
- Serving Agents Behind an API
- Async Workflows and Background Jobs
- Rate Limiting and Quota Management
- Blue-Green and Canary Deploys for Agents