Skip to content

feat: add configurable retry middleware for LlmProvider#97

Open
atharva-nagane wants to merge 1 commit intoc2siorg:mainfrom
atharva-nagane:feat/llm-provider-retry-middleware
Open

feat: add configurable retry middleware for LlmProvider#97
atharva-nagane wants to merge 1 commit intoc2siorg:mainfrom
atharva-nagane:feat/llm-provider-retry-middleware

Conversation

@atharva-nagane
Copy link
Contributor

Closes #96

Adds RetryProvider<P: LlmProvider> — a zero-overhead wrapper that applies
exponential back-off to any LlmProvider implementation.

  • RetryConfig: max_attempts, initial_delay_ms, backoff_factor, max_delay_ms
  • Retries transient errors (RateLimit, Network, Provider { retryable: true })
  • Respects RateLimit { retry_after } hint — sleeps the server-specified duration
  • Non-transient errors propagate immediately without retry
  • stream() retries initial connection; once streaming, passes events through
  • 8 unit tests using stub providers — no credentials needed, all pass in CI
  • No new dependencies

@atharva-nagane atharva-nagane force-pushed the feat/llm-provider-retry-middleware branch from 7d32efa to 7ba0038 Compare March 17, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add configurable retry middleware for LlmProvider

1 participant