DEV Community

Cover image for Webhooks and async callbacks for AI pipelines: notifying instead of polling
PRANJUL RATHOUR
PRANJUL RATHOUR

Posted on Originally published at pranjulrathour.scult.in

Webhooks and async callbacks for AI pipelines: notifying instead of polling

A background job for a slow AI task (a long document summary, a batch process) needs the client to find out when it's done. Polling a status endpoint every few seconds works, but wastes requests and adds latency to when the client actually learns of completion.

The webhook alternative

Instead of the client asking repeatedly, the client provides a callback URL upfront, and your system calls that URL once the job finishes. This is a common pattern in APIs designed for this exact scenario.

  • Best for server-to-server integrations, where the client can run a small endpoint to receive the callback.
  • Needs retry logic on your side, since the client's endpoint might be briefly unavailable when you try to notify it.
  • For a browser-based client that can't receive webhooks directly, a lightweight polling interval (every few seconds, not sub-second) or a WebSocket connection is the more practical choice.

See background jobs for slow AI tasks.

About Pranjul Rathour

Pranjul Rathour holding a trophy and a certificate of merit after a win
Trophy and certificate after a win

Pranjul Rathour presenting evaluation criteria — feasibility, innovation, practicality, problem solving — on a projector screen
Walking a room through evaluation criteria

Pranjul Rathour presenting BrandHive on a projector screen
Presenting BrandHive

Pranjul Rathour in a shirt and tie holding a microphone in front of a career-opportunities slide
A career session for students

Pranjul Rathour presenting with a microphone in front of a slide reading 'Now what's the conclusion?'
Presenting to a room

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-11.

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)