Skip to main content
GitHub

Retry Fixes

Add retry logic with backoff.

Retry fixes add automatic retry with configurable exponential backoff.

Use Cases

  • Transient API errors
  • Rate limiting
  • Network timeouts
  • Temporary unavailability

Configuration

{
  "fix_id": "fix-retry-001",
  "fix_type": "retry",
  "config": {
    "max_retries": 3,
    "initial_delay_ms": 1000,
    "exponential_base": 2.0,
    "max_delay_ms": 30000,
    "jitter": true,
    "retry_on": ["TimeoutError", "ConnectionError"]
  }
}

Options

OptionTypeDefaultDescription
max_retriesint3Maximum retry attempts
initial_delay_msint1000Initial backoff delay in milliseconds
exponential_basefloat2.0Exponential multiplier
max_delay_msint30000Maximum backoff delay in milliseconds
jitterbooltrueAdd randomness to delay
retry_onstring[][] (all)Error type strings to retry on

Backoff Calculation

With exponential backoff (initial_delay_ms=1000, exponential_base=2.0):

Attempt 1: Wait 1000ms
Attempt 2: Wait 2000ms
Attempt 3: Wait 4000ms
Attempt 4: Wait 8000ms (capped at max_delay_ms)

With jitter enabled, the computed delay is multiplied by a random factor between 0.5 and 1.5:

Attempt 1: Wait 500-1500ms
Attempt 2: Wait 1000-3000ms
...

Retry Filtering

Use retry_on to specify which exception types to retry. When empty, all errors are retried:

{
  "retry_on": [
    "TimeoutError",
    "ConnectionError",
    "RateLimitError"
  ]
}

Or retry all errors by leaving retry_on empty:

{
  "retry_on": []
}

Common Fixes

API Timeout

{
  "fix_type": "retry",
  "config": {
    "max_retries": 3,
    "initial_delay_ms": 2000,
    "exponential_base": 2.0,
    "max_delay_ms": 30000,
    "retry_on": ["TimeoutError"]
  }
}

Rate Limiting

{
  "fix_type": "retry",
  "config": {
    "max_retries": 5,
    "initial_delay_ms": 5000,
    "exponential_base": 2.0,
    "max_delay_ms": 60000,
    "jitter": true,
    "retry_on": ["RateLimitError"]
  }
}

LLM Errors

{
  "fix_type": "retry",
  "config": {
    "max_retries": 2,
    "initial_delay_ms": 1000,
    "exponential_base": 2.0,
    "retry_on": ["JSONDecodeError", "ValidationError"]
  }
}

Targeting

{
  "target": {
    "tools": ["external_api", "search"],
    "error_codes": ["TOOL.EXECUTION.TIMEOUT"]
  }
}

Next Steps