Загрузка...

Part 8 Async LLM Tasks — Celery + Redis + FastAPI Queue Tutorial

In this video you will learn how to run slow LLM API calls as background
jobs in Python using Celery and Redis — so your FastAPI server stays fast
and responsive even when AI tasks take 30 to 60 seconds.
We cover:
→ Celery task queue with Redis broker and result backend
→ FastAPI enqueue + status + cancel endpoints
→ Python polling client
→ WebSocket push — results delivered instantly when ready
→ Running full agent loops as background tasks
By the end you will have a production-ready async queue that handles
slow AI tasks without blocking your server.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WHAT YOU WILL LEARN
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✔ What an async job queue is and why AI needs it
✔ What blocking means and why it kills server performance
✔ What Celery is — distributed task queue explained
✔ What a broker and backend are in Celery
✔ What broker and backend database numbers mean in Redis
✔ What polling is vs WebSockets — when to use each
✔ What task states mean — PENDING, STARTED, SUCCESS, FAILURE
✔ What bind=True and self.retry mean in Celery tasks
✔ What time_limit and max_retries do
✔ Common errors and exactly how to fix them
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
NEW WORDS EXPLAINED IN THIS VIDEO
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Async job queue, Thread, Blocking, Celery,
Distributed task queue, Broker, Backend,
task.delay(), AsyncResult, task states,
time_limit, max_retries, bind=True,
Polling, WebSocket, Concurrency,
worker_prefetch_multiplier, revoke()
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PREREQUISITES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
→ Video 00 — Backend AI workflows — https://youtu.be/atrWZPghDhg?si=Gn5Bqkd_Xse81rEn
→ Video 01 — Basic LLM API Call — https://youtu.be/CSqOC2aKTx4?si=C0J2C0F5t2WQ2wke
→ Video 02 — Streaming— https://youtu.be/RtcjFueBB3M?si=sP1sqaX1HPc6y8OH
→ Video 03 — Data Ingestion - https://youtu.be/QJLRJC0KwzQ
→ Video 04 — RAG - https://youtu.be/n8teHOv1OWA
→ Video 04 - Caching - https://youtu.be/eydzBBOvPj0
→ Video 06 — Tool Calling (required — agents build directly on this)-https://youtu.be/uE3aD9U-sKY
→ Video 07 — Agentic Loop https://youtu.be/yohIVCINx7A
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Chapters
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
What is an async job queue
The workflow — submit and poll
Key concepts — Celery, Redis roles, polling vs WebSockets
Project setup — three terminals
tasks.py — Celery worker
main.py — FastAPI endpoints
Python polling client
WebSocket push
Running agent tasks as background jobs
Common errors and fixes
Key takeaways
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
TOOLS USED
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Celery — https://docs.celeryq.dev
Redis — https://redis.io
FastAPI — https://fastapi.tiangolo.com
Docker — https://docker.com

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SERIES — AI Backend Workflows
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
01 — Basic LLM API Call
02 — Streaming
03 — Data Ingestion
04 — RAG
05 — Caching
06 — Tool Calling
07 — Agentic Loop
08 — Async Job Queue ← you are here
09 — Guardrails
10 — Observability and Evals
#Python #Celery #Redis #FastAPI #AsyncQueue #AIBackend
#LLM #BackgroundTasks #WebSockets #MachineLearning #Tutorial

Видео Part 8 Async LLM Tasks — Celery + Redis + FastAPI Queue Tutorial канала cn2tech
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять