Skip to content

fix(bedrock): preserve aws_profile in copied clients#1556

Open
pragnyanramtha wants to merge 3 commits into
anthropics:mainfrom
pragnyanramtha:pragnyan/fix-bedrock-copy-aws-profile
Open

fix(bedrock): preserve aws_profile in copied clients#1556
pragnyanramtha wants to merge 3 commits into
anthropics:mainfrom
pragnyanramtha:pragnyan/fix-bedrock-copy-aws-profile

Conversation

@pragnyanramtha
Copy link
Copy Markdown

Summary

  • preserve aws_profile when copying sync and async Bedrock clients
  • allow copy()/with_options() callers to override aws_profile explicitly
  • add regression coverage for sync preserve, sync override, and async preserve cases

Why

A Bedrock client configured with aws_profile would lose that profile after copy()/with_options(). The copied client still preserved region and other credential options, but request signing would use aws_profile=None and could fall back to the default AWS profile.

Tests

  • uv run --frozen --extra bedrock pytest tests/lib/test_bedrock.py -q
  • uv run --frozen ruff check src/anthropic/lib/bedrock/_client.py tests/lib/test_bedrock.py
  • uv run --frozen ruff format --check src/anthropic/lib/bedrock/_client.py tests/lib/test_bedrock.py
  • git diff --check

@pragnyanramtha pragnyanramtha marked this pull request as ready for review May 16, 2026 20:56
@pragnyanramtha pragnyanramtha requested a review from a team as a code owner May 16, 2026 20:56
Copilot AI review requested due to automatic review settings May 16, 2026 20:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

2 participants