Skip to content

feat(clients): add opt-in retry with backoff for transient failures - #1668

Closed
tharunsridhar wants to merge 1 commit into
caura-ai:mainfrom
tharunsridhar:feat/client-retry-backoff
Closed

tharunsridhar wants to merge 1 commit into
caura-ai:mainfrom
tharunsridhar:feat/client-retry-backoff

Conversation

@tharunsridhar

Copy link
Copy Markdown

Closes #551

What

Adds opt-in retry-with-backoff to the Python client for transient failures (429/502/503/504), off by default (retries=0).

Why

A single transient error currently fails the whole call; every consumer was hand-rolling the same retry loop.

Design

  • retries and retry_backoff constructor params, default preserves current behavior.
    • Retries only transport errors and 429/502/503/504, no other 4xx.
    • Honors Retry-After when present, otherwise exponential backoff (retry_backoff * 2**attempt).
    • Applies to read methods only by default (search, recall, health, get_document); write() and submit_interview() are excluded to avoid duplicate-write risk on retry.

Testing

Added 18 unit tests covering: default-off behavior is unchanged, retry and backoff timing per read method, all four retryable status codes, that other 4xx are never retried, Retry-After overriding backoff, and that write operations are never retried even when retries is configured.

ruff check, ruff format --check, and mypy all pass on the changed file; full client suite is green (183 passed, 7 pre-existing Windows-only failures in unrelated interviewer-CLI tests, unaffected by this change).

Add retries and retry_backoff constructor params to the Python client.
Off by default (retries=0), so existing behavior is unchanged.

When enabled, read methods (search, recall, health, get_document) retry
on transport errors and HTTP 429/502/503/504, using the Retry-After
header when the server sends one and exponential backoff otherwise.
Other 4xx responses are never retried. write() and submit_interview()
are excluded by default to avoid duplicating a write whose result is
unknown.

Closes #551

Signed-off-by: Tharun Sridhar <tharunsridhar@gmail.com>
@tharunsridhar
tharunsridhar requested a review from a team as a code owner September 21, 2026 13:36
@tharunsridhar tharunsridhar closed this by deleting the head repository Sep 21, 2026
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(client-python): opt-in retry with backoff for transient failures (429/502/503/504)

1 participant