Gemini 2.5 503 "High Demand" errors - recommended handling strategy? #1742
Unanswered
LiveNathan
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been hitting frequent
503errors from Google Gemini 2.5 models (gemini-2.5-flash-litein my case, but reports online indicategemini-2.5-flashandgemini-2.5-proare also affected) over the past two days. I'm looking for advice on the best way to handle this within Embabel, and whether any framework-level improvements could help.Environment
gemini-2.5-flash-liteError
The root cause coming from
com.google.genai.errors.ServerException:Full stack trace visible in logs via:
Observed behavior
Embabel's
RetryPropertiesdoes retry on failure (Retry count: 1logged fromc.e.agent.spi.common.RetryProperties), and eventually succeeds - but the tool loop is taking ~47-55 seconds per call as a result:What I've done
I wrote a custom
ResilientLlmExecutorfallback wrapper that catches these errors and retries with exponential backoff (or falls back to an alternate model). It's working, but I'm not sure if this is the right layer to be solving this, or if there's a better hook Embabel provides.application.properties
I have also attempted to tune the retry behavior:
Context: This is a widespread Google-side issue
For what it's worth, this appears to be a persistent infrastructure capacity problem on Google's end - there are many reports across [Google's developer forums](https://discuss.ai.google.dev/t/503-this-model-is-currently-experiencing-high-demand-spikes-in-demand-are-usually-temporary-please-try-again-later/138664) and the [googleapis Python SDK repo](googleapis/python-genai#1373). One particularly concerning finding: Google appears to be [counting failed 503 retries toward the daily rate limit quota](https://www.reddit.com/r/GeminiAI/comments/1ritany/google_is_counting_failed_requests_because_of/), meaning aggressive retry loops can accelerate quota exhaustion.
Questions
RetryPropertiesconfigurable per-provider? I'd like to tune the backoff specifically for the Google GenAI provider (e.g., longer initial delay, exponential backoff, fewer total attempts to avoid quota burn).gemini-2.5-flash-litereturns 503, automatically retry withgemini-2.5-flashbefore giving up.ResilientLlmExecutorapproach (wrapping at theLlmOperationsorChatModellevel) the right place for this, or is there a more idiomatic Embabel extension point?Happy to share the
ResilientLlmExecutorimplementation if useful as a reference or potential contribution.Beta Was this translation helpful? Give feedback.
All reactions