Skip to content

fix(anthropic): disable vendor SDK retries by default - #6604

Draft
axelray-dev wants to merge 1 commit into
livekit:mainfrom
axelray-dev:fix/anthropic-disable-sdk-retries
Draft

fix(anthropic): disable vendor SDK retries by default#6604
axelray-dev wants to merge 1 commit into
livekit:mainfrom
axelray-dev:fix/anthropic-disable-sdk-retries

Conversation

@axelray-dev

Copy link
Copy Markdown

Summary

Fixes #6603.

livekit-plugins-anthropic was building anthropic.AsyncClient without max_retries, so the SDK default of 2 internal retries stacked on top of framework conn_options.max_retry. That made wall-clock time exceed conn_options.timeout (especially with FallbackAdapter).

OpenAI plugin already defaults vendor client retries to 0. This PR matches that for Anthropic.

Changes

  • Pass max_retries=0 by default when constructing anthropic.AsyncClient in the Anthropic LLM plugin.
  • Optional max_retries constructor arg for callers who want a different vendor-client policy.
  • Unit test that the default client has max_retries == 0.
  • Custom client= injection is unchanged (caller owns that client).

Verification

  • ruff format / ruff check on touched files
  • pytest tests/test_plugin_anthropic.py (8 passed)

Backwards compatibility

Default behavior for the constructed client changes from SDK default (2) to 0 so retries are owned by the framework only. Callers who pass their own client= are unaffected. Callers who want SDK retries can pass max_retries=....

@CLAassistant

CLAassistant commented Jul 29, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

anthropic plugin: vendor SDK retries not disabled, double-retrying on top of conn_options.max_retry

2 participants