← All libraries

Celery

Python
↗ Official site

Database & backend

Run tasks in the background without slowing down your web app.

What it does

Celery is a task queue — it lets your Python app kick off time-consuming jobs (sending emails, processing files, running ML models) in the background so the user doesn't have to wait.

When to use it

Use this when your Python app has heavy jobs that shouldn't block the main request — like sending emails, video processing, or running AI models.

Real example

When a user exports a report, it takes 30 seconds to generate. You don't want the user to stare at a loading screen. Prompt: 'Use Celery to create a generate_report task decorated with @shared_task. In the FastAPI route, call generate_report.delay(user_id) and immediately return a job_id. Add a polling endpoint that returns the result when the task is done.'

Good to know

Requires a message broker like Redis or RabbitMQ. More complex to set up than a simple async function.

Alternatives

RQ (Redis Queue) Dramatiq

Install

$ pip install celery

Use cases

background jobstask queueasync tasksemail sending

Language

Python

Category

Database & backend

More in Database & backend

Other tools in the same category