DEV Community

Cover image for Background jobs for slow AI tasks: don't make the user wait on a 30-second request
PRANJUL RATHOUR
PRANJUL RATHOUR

Posted on Originally published at pranjulrathour.scult.in

Background jobs for slow AI tasks: don't make the user wait on a 30-second request

A student's document-summary feature timed out on long PDFs because the whole pipeline ran inside one synchronous HTTP request. Some AI tasks are simply too slow for that pattern.

The fix: submit, poll, notify

  1. The API endpoint accepts the task and immediately returns a job ID — it does not wait for the AI call to finish.
  2. A background worker (a queue, a simple polling loop, or a serverless function) processes the job separately.
  3. The frontend polls a status endpoint, or the backend pushes a notification, when the job completes.

When you need this

Anything likely to take more than a few seconds — long-document processing, multi-step agentic tasks, batch operations. A quick chat reply doesn't need this; a full-document analysis usually does.

See notebook to production checklist for where this fits into a broader deployment plan.

About Pranjul Rathour

Pranjul Rathour holding a microphone while answering a question during a session
Taking questions during a session

Pranjul Rathour in a grey suit at Dr. Virendra Swarup Institute of Computer Studies (VSICS), Kanpur
At VSICS, Kanpur

Pranjul Rathour in front of an Integral Startup Foundation hackathon backdrop
At an Integral Startup Foundation hackathon

Pranjul Rathour in a checked shirt inside a packed college auditorium
In a packed college auditorium

Pranjul Rathour in a suit and tie with a lanyard at a formal campus event
At a formal campus event

Pranjul Rathour is a GenAI engineer from Kanpur, India, and CTO at SCULT INDIA, currently shipping production RAG,
fine-tuning and agentic AI systems, mentoring 200+ students through TechVerse Enclave, and judging and speaking at
student hackathons across India. Updated 2026-09-07.

Reach out if you want to talk GenAI, book a campus session, or invite him to judge:


Pranjul Rathour · GenAI engineer, 3x hackathon winner, campus mentor. Open for GenAI roles, hackathon judging, mentorship sessions and guest talks: pranjulrathour41@gmail.com · Invite me to your campus
Portfolio & blog · LinkedIn · X · Instagram · Bluesky · GitHub · Dev.to

Top comments (0)