Skip to content

feat(bedrock): add explicit Mantle auth mode - #1933

Open
00200200 wants to merge 1 commit into
anthropics:mainfrom
00200200:codex/bedrock-mantle-auth-mode
Open

00200200 wants to merge 1 commit into
anthropics:mainfrom
00200200:codex/bedrock-mantle-auth-mode

Conversation

@00200200

Copy link
Copy Markdown

Summary

  • add auth_mode="auto" | "api_key" | "sigv4" to AnthropicBedrockMantle and AsyncAnthropicBedrockMantle
  • allow callers to force SigV4 while ignoring ambient bearer-key environment variables
  • preserve and switch the selected mode through copy() / with_options()
  • validate missing API keys and conflicting skip_auth / auth_mode settings
  • add sync and async regression coverage

Fixes #1893

Verification

  • uv run pytest tests/lib/test_bedrock_mantle.py -q — 41 passed
  • ./scripts/test — Python 3.10/Pydantic v2: 6026 passed; Python 3.10/Pydantic v1: 5813 passed; Python 3.14/Pydantic v2: 6026 passed; MCP v2: 39 passed
  • uv run ruff check ... — passed
  • uv run --all-extras pyright --project . — 0 errors
  • uv run mypy src/anthropic/lib/bedrock/_mantle.py tests/lib/test_bedrock_mantle.py — passed

@00200200
00200200 requested a review from a team as a code owner September 14, 2026 13:18

@gouveags gouveags left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This addresses the issue: callers can force SigV4 while retaining the default AWS credential chain, and the mode survives client copies. All 41 Mantle tests passed locally; additional local signing checks passed for sync and async clients, including copy() and with_options().

@gouveags

Copy link
Copy Markdown

Thanks for working on this! The implementation looks great to me, and I left an approval after reviewing and testing it. @craigie-ant could you please take a look when you have a chance?

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.

Add an explicit authentication mode to AnthropicBedrockMantle

2 participants