Summary
Providers like Anthropic and OpenAI return 429 Too Many Requests with
a retry-after header. The current retry logic does not honour this header
and uses fixed delays. This leads to wasted retries and unnecessary failures
on long multi-agent runs.
Scope
- Read
retry-after / x-ratelimit-reset-requests headers on 429 responses
- Exponential backoff with jitter for 5xx errors
- Per-provider retry config: max retries, base delay, max delay
- Expose
config.RetryPolicy in ClientConfig
Proposed config
type RetryPolicy struct {
MaxRetries int // default 3
BaseDelay time.Duration // default 1s
MaxDelay time.Duration // default 60s
HonorRetryAfter bool // default true
}
Acceptance criteria
Summary
Providers like Anthropic and OpenAI return
429 Too Many Requestswitha
retry-afterheader. The current retry logic does not honour this headerand uses fixed delays. This leads to wasted retries and unnecessary failures
on long multi-agent runs.
Scope
retry-after/x-ratelimit-reset-requestsheaders on 429 responsesconfig.RetryPolicyinClientConfigProposed config
Acceptance criteria
RetryPolicystruct inpkg/sdkretry-afterheader parsed and respected (sleep until reset time)