fix(agent): unpin anthropic to 0.112.0 so Bedrock Claude works with bearer-token auth - #54431
Open
krystiancharubin wants to merge 1 commit into
Open
Conversation
…earer-token auth
The `anthropic` extra and tools/lazy_deps.py both pinned `anthropic==0.87.0`.
On AWS Bedrock, Claude models are routed through the AnthropicBedrock SDK
client (agent/anthropic_adapter.build_anthropic_bedrock_client). In 0.87.0
that client only authenticates via SigV4, so users whose only credential is
an Amazon Bedrock API key (AWS_BEARER_TOKEN_BEDROCK) get:
API call failed after 3 retries: could not resolve credentials from session
even though `hermes doctor` reports Bedrock connectivity OK (the doctor probe
uses the bearer token directly) and non-Claude Bedrock models — Nova, OpenAI
gpt-oss, DeepSeek, etc. — work fine because they go through the boto3 Converse
API, which honors the bearer token.
AWS bearer-token auth for AnthropicBedrock was added in anthropic 0.88.0
(anthropics/anthropic-sdk-python#1623): the client now reads
AWS_BEARER_TOKEN_BEDROCK and sends `Authorization: Bearer <token>`, falling
back to SigV4 only when no api_key is resolved. Bumping to 0.112.0 makes
Claude-on-Bedrock work with just the bearer token on the full-feature path
(prompt caching, 1M-context beta) — no routing/logic change needed.
The exact `==0.87.0` pin was introduced for CVE-2026-34450 and CVE-2026-34452
(insecure memory-tool file permissions / async symlink TOCTOU). Both were
fixed *in* 0.87.0 and remain fixed in 0.112.0 (memory files still use
0o600/0o700 + O_EXCL + TOCTOU-safe mkdir), so this bump does not regress them.
Pinned exactly per the supply-chain no-ranges policy; uv.lock regenerated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
moro-no-kimi
added a commit
to RosenblattAI/hermes-agent
that referenced
this pull request
Jul 7, 2026
…earer-token auth Bumps the anthropic SDK from 0.87.0 to 0.112.0. Claude models on Bedrock are routed through AnthropicBedrock (agent/anthropic_adapter.build_anthropic_bedrock_client) for full feature parity (prompt caching, thinking budgets, 1M-context beta). In 0.87.0 that client only authenticates via SigV4, so a user whose only credential is an Amazon Bedrock API key (AWS_BEARER_TOKEN_BEDROCK) hit: API call failed after 3 retries: could not resolve credentials from session AWS bearer-token auth for AnthropicBedrock was added in anthropic 0.88.0 (anthropics/anthropic-sdk-python#1623). No hermes-agent routing/logic change required. CVE-2026-34450/34452 (the reason for the exact 0.87.0 pin) are fixed in 0.87.0 and confirmed retained in 0.112.0. Verified locally end-to-end: `hermes -z "Reply with exactly: CLAUDE_OK"` against claude-sonnet-5 on Bedrock via AWS_BEARER_TOKEN_BEDROCK alone (no AWS_ACCESS_KEY_ID/AWS_PROFILE/IMDS) now succeeds. 379 tests pass (test_bedrock_adapter, test_anthropic_adapter, test_bedrock_integration, test_bedrock_1m_context, test_bedrock_model_picker). Applying as a T2 patch ahead of upstream merge. Upstream PR: NousResearch#54431
teknium1
reviewed
Jul 15, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for isolating the Anthropic SDK update across the extra, lazy-install, and lockfile surfaces.
Problems
uv.lock:2900removes thesys_platform == 'win32'marker from theportalocker→pywin32dependency. Current main retains that marker atuv.lock:3030, consistent with the Windows-only logging dependency rationale inpyproject.toml:128-140. This unrelated resolution change should not accompany the Anthropic update.
Suggested changes
- Regenerate
uv.lockagainst current main and keep the existingpywin32platform marker, so the lockfile change is scoped to the Anthropic resolution. - Keep
pyproject.toml:146andtools/lazy_deps.py:99in lockstep; both currently pinanthropic==0.87.0while Claude Bedrock routing selects the AnthropicBedrock path athermes_cli/runtime_provider.py:1979.
Automated hermes-sweeper review.
| source = { registry = "https://pypi.org/simple" } | ||
| dependencies = [ | ||
| { name = "pywin32", marker = "sys_platform == 'win32'" }, | ||
| { name = "pywin32" }, |
Contributor
There was a problem hiding this comment.
Please retain marker = "sys_platform == 'win32'" on this edge. Current main has that marker at uv.lock:3030, matching the Windows-only concurrent-log-handler dependency in pyproject.toml; this unrelated lockfile change should be removed when regenerating for the Anthropic bump.
This was referenced Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Both the
anthropicextra inpyproject.tomlandtools/lazy_deps.pypinanthropic==0.87.0. On AWS Bedrock, Claude models are routed through the AnthropicBedrock SDK client (agent/anthropic_adapter.build_anthropic_bedrock_client) for full feature parity (prompt caching, thinking budgets, 1M-context beta). In 0.87.0 that client only authenticates via SigV4, so a user whose only credential is an Amazon Bedrock API key (AWS_BEARER_TOKEN_BEDROCK) hits:…even though:
hermes doctorreports AWS Bedrock ✓ (its probe uses the bearer token directly), andgpt-oss, DeepSeek, Llama…) work fine, because they route through the boto3 Converse API, which honorsAWS_BEARER_TOKEN_BEDROCK.So today Bedrock-with-an-API-key works for every model family except Claude — the one most users select first.
Root cause / fix: AWS bearer-token auth for
AnthropicBedrockwas added in anthropic 0.88.0 (anthropics/anthropic-sdk-python#1623). The client now readsAWS_BEARER_TOKEN_BEDROCKand sendsAuthorization: Bearer <token>, falling back to SigV4 only when no api_key resolves. Bumping the pin to0.112.0makes Claude-on-Bedrock work with just the bearer token on the full-feature path — no routing/logic change required.Security note (why the bump is safe)
The exact
==0.87.0pin was introduced for CVE-2026-34450 (memory-tool world-readable files) and CVE-2026-34452 (async memory-tool symlink TOCTOU). Both affect>=0.86.0,<0.87.0and were fixed in 0.87.0; the official guidance is "upgrade to 0.87.0 or later." I verified 0.112.0 retains both fixes — memory files use0o600/0o700+O_EXCL+ a TOCTOU-safe_secure_mkdir. So this bump does not regress either CVE.Pinned exactly (not a range) per the supply-chain no-ranges policy in
pyproject.toml;uv.lockregenerated withuv lock(only the anthropic entry changes — no transitive churn in pinned deps).How to test
With only an Amazon Bedrock API key configured (
AWS_BEARER_TOKEN_BEDROCKset, noAWS_ACCESS_KEY_ID/AWS_PROFILE/IMDS),provider: bedrock, and a Claude default:hermes -z "Reply with exactly: CLAUDE_OK"anthropic==0.87.0):could not resolve credentials from sessionanthropic==0.112.0): replies normally; streaming + tool-calling + title generation all work; response usage includescache_creation/cache_read, confirming the full-feature path.Tests
pytest tests/agent/test_bedrock_adapter.py tests/agent/test_anthropic_adapter.py tests/agent/test_bedrock_integration.py tests/agent/test_bedrock_1m_context.py tests/hermes_cli/test_bedrock_model_picker.py→ 373 passed. The 6 failures in this set are pre-existing and unrelated (OAuth tests that read real~/.claudecredentials; one EU-region picker test with mock leakage) — they fail identically on unmodifiedmain@anthropic==0.87.0.Platforms tested
us-east-1withus.anthropic.claude-sonnet-4-6.🤖 Generated with Claude Code