-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Bug
I am encountering persistent 429 Resource Exhausted errors and occasional 503 Service Unavailable / Model Overloaded errors while using the Gemini 2.5 Flash model with a paid API key via Google ADK.
While the rate-limit/model errors themselves are problematic, they also trigger a secondary issue that significantly affects agent behavior.
After a 429 or 503 error occurs during an agent task, subsequent user queries do not start as fresh workflows. Instead, the agent appears to resume or re-run the previous incomplete workflow, even when the new query is for a completely different task. This results in mixed context, incorrect execution paths, and unexpected agent behavior.
Error 1 — 429 Rate Limit / Resource Exhausted (Frequent & Persistent)
{
"error": {
"code": 429,
"message": "Resource has been exhausted (e.g. check quota).",
"status": "RESOURCE_EXHAUSTED"
}
}
This error occurs consistently despite using a paid API key and moderate request volume.
Error 2 — 503 Service Unavailable / Model Overloaded (Occasional)
{
"error": {
"code": 503,
"message": "The model is overloaded. Please try again later.",
"status": "UNAVAILABLE"
}
}
This has appeared only 2–3 times so far, but contributes to the same downstream issue.
Secondary Issue: Agent Workflow & Context Mixing
After any of the above errors occur:
- The agent does not fully reset, Agent continues using prior workflow state after errors
- New user queries cause the agent to Resume the previous incomplete workflow, Merge old execution state with the new request, Attempt steps from an unrelated earlier task
This results in:
- Incorrect tool calls
- Misaligned reasoning
- Agent behavior that does not match the latest user query
- In effect, error handling does not appear to clear the agent’s execution state or workflow context.
To Reproduce
- Install '...' google-adk==1.17.0
Expected behavior
Expected Behavior
When a request fails with 429 or 503, the agent should:
- Fully discard the incomplete workflow
- Reset execution state
- Treat the next user query as a fresh task
- Alternatively, there should be a documented or programmatic way to explicitly clear/reset agent context or workflow state after failures
Desktop
- OS: Windows 11
- Python version(python -V): 3.12.5
- ADK version(pip show google-adk): 1.17.0
Model Information:
- Are you using LiteLLM: Yes
- Which model is being used: gemini-2.5-flash
Additional context
"Sorry, Something went wrong" in screen shot shows when the 429 and 503 errors occure.
So is there any officially supported way in Google ADK to clear or reset an agent’s workflow/context after an error and how can i handle 429/503 errors to avoid agent state corruption.



