Better handle 429 errors on openrouter.
This commit is contained in:
parent
d115b8d5fe
commit
80d2d2fa60
|
|
@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
- Improve prompts for better open model support.
|
||||
- Better handle 429 errors on openrouter.
|
||||
|
||||
## [0.12.1] - 2025-01-08
|
||||
- Fix bug where directories are added as related files.
|
||||
|
|
|
|||
|
|
@ -552,7 +552,9 @@ def run_agent_with_retry(agent, prompt: str, config: dict) -> Optional[str]:
|
|||
return "Agent run completed successfully"
|
||||
except (KeyboardInterrupt, AgentInterrupt):
|
||||
raise
|
||||
except (InternalServerError, APITimeoutError, RateLimitError, APIError) as e:
|
||||
except (InternalServerError, APITimeoutError, RateLimitError, APIError, ValueError) as e:
|
||||
if isinstance(e, ValueError) and 'code 429' not in str(e):
|
||||
raise # Re-raise ValueError if it's not a Lambda 429
|
||||
if attempt == max_retries - 1:
|
||||
logger.error("Max retries reached, failing: %s", str(e))
|
||||
raise RuntimeError(f"Max retries ({max_retries}) exceeded. Last error: {e}")
|
||||
|
|
|
|||
Loading…
Reference in New Issue