Skip to content

feat(bedrock): add support for passing boto3.Session#1148

Draft
Ashutosh0x wants to merge 3 commits intoanthropics:mainfrom
Ashutosh0x:feat/bedrock-boto3-session
Draft

feat(bedrock): add support for passing boto3.Session#1148
Ashutosh0x wants to merge 3 commits intoanthropics:mainfrom
Ashutosh0x:feat/bedrock-boto3-session

Conversation

@Ashutosh0x
Copy link

@Ashutosh0x Ashutosh0x commented Jan 22, 2026

Fixes #538.

This PR adds support for passing a boto3.Session directly to the AnthropicBedrock and AsyncAnthropicBedrock clients.

Changes

  • Added aws_session parameter to Bedrock client constructors.
  • If provided, the session is used for region inference and request signing.
  • Updated get_auth_headers to accept and use the passed session.
  • Added safer handling of the connection header in _auth.py to prevent KeyError.

Verification

  • Verified with verify_bedrock_session.py using Mocks to ensure credentials and region are correctly extracted from the session.

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.

Feature: Support for access aws bedrock through role arn directly and retrieve the AKSK from boto3.Session directly

1 participant