Skip to content

feat(bedrock): allow selecting Mantle auth mode - #1896

Closed
mikemikimike wants to merge 1 commit into
anthropics:mainfrom
mikemikimike:codex/1893-auth-mode
Closed

feat(bedrock): allow selecting Mantle auth mode#1896
mikemikimike wants to merge 1 commit into
anthropics:mainfrom
mikemikimike:codex/1893-auth-mode

Conversation

@mikemikimike

@mikemikimike mikemikimike commented Aug 29, 2026

Copy link
Copy Markdown

Summary

Adds an explicit auth_mode option to AnthropicBedrockMantle and AsyncAnthropicBedrockMantle.

  • auto preserves the existing authentication precedence.
  • api_key selects bearer authentication even when AWS credentials are provided.
  • sigv4 selects the refreshable AWS credential chain even when bearer-key environment variables are set.
  • copy() and with_options() preserve or override the selected mode.

This gives applications using ECS task roles, EC2 instance profiles, IRSA, or other rotating AWS credentials a public way to avoid ambient bearer-key selection.

Closes #1893

Tests

  • python -m pytest tests/lib/test_bedrock_mantle.py -q — 39 passed
  • ruff check src/anthropic/lib/aws/_credentials.py src/anthropic/lib/bedrock/_mantle.py tests/lib/test_bedrock_mantle.py
  • ruff format --check on the changed files
  • pyright src/anthropic/lib/aws/_credentials.py src/anthropic/lib/bedrock/_mantle.py
  • git diff --check

The test run uses the checkout's src via PYTHONPATH and does not require AWS credentials or network calls.

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

1 participant