AgileAndy Claude commited on
Commit
a4278a3
·
1 Parent(s): 26b7da4

Update retry delays: 10s, 20s, 30s, 45s, 60s, 60s

Browse files

- Changed from exponential backoff to fixed delay pattern
- Starts at 10 seconds for better rate limit handling
- 6 attempts total with specified timing sequence
- Removed jitter for predictable delays

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (2) hide show
  1. .DS_Store +0 -0
  2. speed_optimized_gaia_agent.py +6 -8
.DS_Store CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
 
speed_optimized_gaia_agent.py CHANGED
@@ -114,8 +114,10 @@ class SpeedOptimizedGAIAAgent:
114
  base_url="https://openrouter.ai/api/v1"
115
  )
116
 
117
- def retry_with_backoff(self, func, *args, max_attempts=5, max_delay=60, **kwargs):
118
- """Exponential backoff retry with jitter"""
 
 
119
  for attempt in range(max_attempts):
120
  try:
121
  return func(*args, **kwargs)
@@ -124,12 +126,8 @@ class SpeedOptimizedGAIAAgent:
124
  print(f"❌ Final attempt failed: {e}")
125
  raise e
126
 
127
- # Calculate delay with exponential backoff + jitter
128
- base_delay = min(2 ** attempt, max_delay // 4) # Cap base delay
129
- jitter = random.uniform(0.1, 0.3) * base_delay
130
- delay = min(base_delay + jitter, max_delay)
131
-
132
- print(f"⏳ Rate limited (attempt {attempt + 1}/{max_attempts}), retrying in {delay:.1f}s...")
133
  time.sleep(delay)
134
 
135
  raise Exception("Max retry attempts exceeded")
 
114
  base_url="https://openrouter.ai/api/v1"
115
  )
116
 
117
+ def retry_with_backoff(self, func, *args, max_attempts=6, **kwargs):
118
+ """Custom retry with specified delay pattern: 10s, 20s, 30s, 45s, 60s, 60s"""
119
+ delay_pattern = [10, 20, 30, 45, 60, 60] # Fixed delay pattern as requested
120
+
121
  for attempt in range(max_attempts):
122
  try:
123
  return func(*args, **kwargs)
 
126
  print(f"❌ Final attempt failed: {e}")
127
  raise e
128
 
129
+ delay = delay_pattern[attempt]
130
+ print(f"⏳ Rate limited (attempt {attempt + 1}/{max_attempts}), retrying in {delay}s...")
 
 
 
 
131
  time.sleep(delay)
132
 
133
  raise Exception("Max retry attempts exceeded")