r/FastAPI • u/Educational-Hope960 • Apr 03 '26
Question How are you actually managing background/async tasks in FastAPI in production?
I’ve been building with FastAPI for a while now and I’m curious how people are really handling background work beyond simple demos.
The docs show BackgroundTasks, but that feels pretty limited once things get even slightly complex.
Some situations I keep running into:
- sending emails, notifications, webhooks
- retrying failed tasks
- long running async jobs
- tasks that depend on other tasks
- needing visibility into what’s running or failing
Right now it feels like there are a few options:
- stick with
BackgroundTasks - use something like Celery or RQ
- or just push everything into a message broker
But none of these feel very “FastAPI-native” or simple.
So I’m wondering:
- What are you using in production?
- Are you staying fully async or mixing in workers?
- How are you handling retries and failures?
- Do you have any visibility into tasks or is it just logs and hope?
Would be interesting to hear what actually works in real systems, not just tutorials.
28
Upvotes
View all comments
Show parent comment
1
u/Challseus Apr 03 '26
On the "Activity" tab, that shows all tasks, there is a not so obvious filter on the top left that let's you see all failed tasks.
From there, you can click into them and see the exception, pulled directly from the worker itself. Though, in this demo site, those errors are fabricated, so you won't see the full stack trace, just some noise.
As for how all the data gets there, for
arqin this instance, I have some before/after message received hook that sends to a RedisStream. Then I have a SSE endpoint that is continually reading from redis, which keeps sending those updates down to the frontend.