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

Trophy and certificate after a win

Walking a room through evaluation criteria
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:
- Email: pranjulrathour41@gmail.com
- Invite / talk menu: https://pranjulrathour.scult.in/invite
- Portfolio & blog: https://pranjulrathour.scult.in
- LinkedIn: https://www.linkedin.com/in/pranjul-rathour/
- X: https://x.com/PranjulRathourx
- Instagram: https://www.instagram.com/pranjulrathour.in/
- Bluesky: https://bsky.app/profile/pranjulrathour.bsky.social
- GitHub: https://github.com/Pranjulrathour
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)