Scale back friction and latency for long-running jobs with Webhooks in Gemini API


Right this moment, we’re making it simpler and extra environment friendly to construct advanced, long-running agentic purposes with the Gemini API. We’re introducing event-driven Webhooks, a push-based notification system that eliminates the necessity for inefficient polling.

As Gemini shifts towards agentic workflows and high-volume processing — like Deep Analysis, lengthy video era, or processing 1000’s of prompts by way of the Batch API — operations can take minutes and even hours. Till now, builders needed to depend on steady polling (e.g., repeatedly callingGEToperations) to verify if a job was accomplished.

Now, the Gemini API can merely push a real-time HTTP POST payload to your server the moment a activity finishes.

We’ve constructed this with reliability and safety in thoughts. Our implementation strictly adheres to the Standard Webhooks specification. Each request is signed utilizing webhook-signature, webhook-id, and webhook-timestamp headers, guaranteeing idempotency and stopping replay assaults. We additionally assure “at-least-once” supply with automated retries for as much as 24 hours.

The way it works

You possibly can configure webhooks globally on the challenge degree (secured by way of HMAC), or override them dynamically on a per-request foundation to route particular jobs (secured by way of JWKS).

Here is a fast instance of how one can dynamically configure a webhook for a batch activity utilizing the Python SDK: