PyCon Ghana 2026Accra, Ghana · 2026
Managing background tasks in FastAPI
FastAPI's BackgroundTasks is the fastest way to defer work after a response. It is also easy to lose that work: one unhandled exception and the task is gone, with no retry, no record and no visibility. This talk covers what actually happens to a background task in production, where it breaks under load, and how to add retries, persistence and observability without moving to a full broker-backed queue.
What it covered
- What FastAPI's BackgroundTasks does and does not guarantee
- Failure modes under load: lost work on restart, no retry strategy, no backpressure
- Adding retries, persistence and lifecycle tracking a step at a time
- When an in-process approach is enough, and when to move to Celery, RQ or Dramatiq



