Skip to content

fix(bedrock): bearer-token auth (anthropic 0.88) + 1M context for Mythos Claude models - #63650

Open
vinayshah1998 wants to merge 3 commits into
NousResearch:mainfrom
vinayshah1998:bump-anthropic-0.88-bedrock-bearer
Open

fix(bedrock): bearer-token auth (anthropic 0.88) + 1M context for Mythos Claude models#63650
vinayshah1998 wants to merge 3 commits into
NousResearch:mainfrom
vinayshah1998:bump-anthropic-0.88-bedrock-bearer

Conversation

@vinayshah1998

@vinayshah1998 vinayshah1998 commented Jul 13, 2026

Copy link
Copy Markdown

Two related fixes for Anthropic Claude models on AWS Bedrock. Happy to split into two PRs if preferred.


1. Bump anthropic 0.87.0 → 0.88.0 — Bedrock bearer-token auth

Why. 0.88.0 is the first release whose AnthropicBedrock client reads the AWS_BEARER_TOKEN_BEDROCK bearer token. On 0.87.0, AnthropicBedrock is SigV4-only, so bring-your-own-key bearer-token auth to Bedrock (short-term ABSK… keys) fails at request time with:

RuntimeError: could not resolve credentials from session

Hermes routes Claude-on-Bedrock through AnthropicBedrock (agent/anthropic_adapter.py::build_anthropic_bedrock_client, constructed with no explicit api_key, relying on the SDK's env/credential chain), so on 0.87.0 the entire bearer-token Bedrock path for Claude is unusable. 0.88.0's AnthropicBedrock.__init__ adds api_key = os.environ.get("AWS_BEARER_TOKEN_BEDROCK"), so the existing call site works with zero code changes.

Safety. Minimal (single minor), additive (0.88 adds Bedrock bearer auth + stop_details; no breaking Messages/Bedrock API changes), and security-preserving (0.88 ≥ 0.87, so CVE-2026-34450 / CVE-2026-34452 fixes are retained).

Pins moved in lockstep (a mismatch makes the runtime lazy-installer in tools/lazy_deps.py silently downgrade a manually-upgraded install back to 0.87.0):

  • pyproject.toml[anthropic] extra
  • tools/lazy_deps.pyprovider.anthropic
  • uv.lockanthropic package + specifier (uv lock --check passes)

Tested. Against Bedrock us-east-1 with a bearer token, AnthropicBedrock (0.88.0) picks up AWS_BEARER_TOKEN_BEDROCK and both us.anthropic.claude-fable-5 and us.anthropic.claude-sonnet-5 return successful completions. New regression tests in tests/agent/test_bedrock_bearer_auth.py exercise the real installed SDK through build_anthropic_bedrock_client: bearer env var is picked up as api_key, absence falls back to the SigV4/boto3 chain, and the installed anthropic version is asserted >= 0.88.0 so a future pin downgrade fails in CI rather than at request time.


2. 1M context window for Mythos-class Claude on Bedrock

What. Add anthropic.claude-fable-5, anthropic.claude-sonnet-5, anthropic.claude-opus-4-8, anthropic.claude-opus-4-7 to BEDROCK_CONTEXT_LENGTHS (agent/bedrock_adapter.py) at 1_000_000.

Why. For provider: bedrock, get_model_context_length() short-circuits to the static BEDROCK_CONTEXT_LENGTHS table. These newer models are absent, so they fall through to BEDROCK_DEFAULT_CONTEXT_LENGTH (128K) — capping their usable window far below the documented ceiling.

Basis for 1M (verified against the AWS Bedrock model cards). Each model's official Bedrock model card documents Context window: 1M tokens as the model default (not beta-gated):

The in-code comment now cites these model cards instead of generalizing the context-1m-2025-08-07 beta-header behavior (whose documented scope in agent/anthropic_adapter.py is Opus 4.6/4.7 and Sonnet 4.6).

Tests. tests/agent/test_bedrock_adapter.py::TestBedrockContextLength now covers all four bare IDs, their geo/global inference-profile forms (us./eu./jp./au./global. per the model cards), and non-shadowing checks that sonnet-5 / opus-4-8 entries do not disturb the existing 200K sonnet-4-6 / opus-4-6 resolutions.

@vinayshah1998
vinayshah1998 requested a review from a team July 13, 2026 07:20
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/bedrock AWS Bedrock (boto3, IAM) dependencies Pull requests that update a dependency file P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 13, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Competing/overlapping with the anthropic-SDK-bump cluster for the same Bedrock bearer-token root cause (#29309): #54431 bumps to 0.112.0 (broadest), #26769 bumps the SDK and adds 1M context. This PR is the minimal 0.87.0 → 0.88.0 bump. Same three-pin surface (pyproject extra + tools/lazy_deps.py + uv.lock) — a maintainer should pick one target version.

… auth

anthropic 0.88.0 is the first release whose AnthropicBedrock client reads
AWS_BEARER_TOKEN_BEDROCK. On 0.87.0 the client is SigV4-only, so BYOK
bearer-token auth to Bedrock fails at request time with "could not resolve
credentials from session". The bump is minimal (single minor), additive
(no breaking changes to the Messages/Bedrock APIs), and preserves the
CVE-2026-34450 / CVE-2026-34452 fixes that motivated the 0.87.0 pin.

Moves all three pins that must stay in lockstep:
- pyproject.toml [anthropic] extra
- tools/lazy_deps.py provider.anthropic (runtime lazy-installer pin)
- uv.lock anthropic package + specifier (uv lock --check passes)
@vinayshah1998
vinayshah1998 force-pushed the bump-anthropic-0.88-bedrock-bearer branch from 989b5ae to 6538328 Compare July 13, 2026 07:37
@vinayshah1998

Copy link
Copy Markdown
Author

Sure I'm okay with just going with #26769 since it's broader and adds support for the 1M context window

Fable 5, Sonnet 5, and Opus 4.7/4.8 were absent from BEDROCK_CONTEXT_LENGTHS,
so get_bedrock_context_length() fell through to the 128K default and Hermes
compacted/truncated their context far below the 1M that the
context-1m-2025-08-07 beta already unlocks. build_anthropic_bedrock_client
sends that beta on every Bedrock Claude request, so the cap was purely the
static table lagging behind the newer models. Add the four at 1M.
@vinayshah1998 vinayshah1998 changed the title build(deps): bump anthropic 0.87.0→0.88.0 for Bedrock bearer-token auth fix(bedrock): bearer-token auth (anthropic 0.88) + 1M context for Mythos Claude models Jul 13, 2026
@vinayshah1998

Copy link
Copy Markdown
Author

I updated this in case you wanted a narrower update to the SDK along with the support for the 1M context windows.

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for keeping the SDK pin, lazy-installer pin, and lockfile synchronized. The bearer-token premise remains live on current main: Claude Bedrock models route through AnthropicBedrock (hermes_cli/runtime_provider.py:1975-1988), while the SDK remains pinned to 0.87.0 (pyproject.toml:146, tools/lazy_deps.py:99). The context-table premise is also live because Bedrock resolution uses the static table first (agent/model_metadata.py:2208-2224).

Problems

  • The four new 1M table entries have no regression coverage. Existing table tests in tests/agent/test_bedrock_adapter.py:1165-1196 do not cover any added ID.
  • The new comment generalizes the beta-header guarantee beyond current code's documented Opus 4.6/4.7 and Sonnet 4.6 scope (agent/anthropic_adapter.py:840-845). The PR does not provide repository-backed validation for the added Fable 5, Sonnet 5, and Opus 4.8 ceilings.
  • No test exercises bearer-token behavior through the AnthropicBedrock client path.

Suggested changes

  • Add targeted context-resolution tests for the added IDs and inference-profile variants.
  • Verify the Bedrock ceilings per model before retaining the 1M mappings.
  • Add a bearer-vs-SigV4 regression test for the upgraded SDK path.

Automated hermes-sweeper review.

Comment thread agent/bedrock_adapter.py
# sends on every Bedrock Claude request. Without an entry here these fell
# through to BEDROCK_DEFAULT_CONTEXT_LENGTH (128K), silently capping the
# window far below what the beta already enables.
"anthropic.claude-fable-5": 1_000_000,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add table-resolution coverage for these new IDs (including a regional inference-profile form). Bedrock bypasses generic model metadata and always uses this static table, while the current Bedrock table tests do not cover any of these entries.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added in 047dce9: TestBedrockContextLength now covers all four new IDs at 1M, plus their geo/global inference-profile forms (us./eu./jp./au./global., matching the ID tables on the AWS Bedrock model cards), and non-shadowing checks that the new sonnet-5 / opus-4-8 keys leave the existing 200K sonnet-4-6 / opus-4-6 resolutions untouched.

@teknium1 teknium1 added sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 16, 2026
Address review feedback on NousResearch#63650:

- Add context-resolution tests for the four new 1M table entries
  (fable-5, sonnet-5, opus-4-8, opus-4-7), including geo/global
  inference-profile forms (us./eu./jp./au./global.) and
  non-shadowing checks against the 200K sonnet-4-6 / opus-4-6 keys.
- Add bearer-vs-SigV4 regression tests exercising the real installed
  SDK through build_anthropic_bedrock_client: AWS_BEARER_TOKEN_BEDROCK
  is picked up as api_key, absence falls back to the SigV4/boto3
  chain, and the installed anthropic version is asserted >= 0.88.0 so
  a pin downgrade fails loudly in CI instead of at request time.
- Re-anchor the 1M table comment on the AWS Bedrock model cards
  (which document 1M-token context windows for all four models,
  default rather than beta-gated) instead of overgeneralizing the
  context-1m beta-header scope documented in anthropic_adapter.py.
@vinayshah1998

Copy link
Copy Markdown
Author

Addressed all three review points in 047dce9:

1. Regression coverage for the four new 1M table entries. TestBedrockContextLength (tests/agent/test_bedrock_adapter.py) now covers each added ID (fable-5, sonnet-5, opus-4-8, opus-4-7) at 1M, their geo/global inference-profile forms (us./eu./jp./au./global., matching the ID tables on the AWS model cards), and non-shadowing checks that the new keys do not disturb the existing 200K sonnet-4-6 / opus-4-6 resolutions under longest-key matching.

2. Ceiling verification + comment scope. The 1M values are now anchored on the official AWS Bedrock model cards, each of which documents "Context window: 1M tokens" as the model default (not beta-gated): Fable 5, Sonnet 5, Opus 4.8, Opus 4.7. The in-code comment was rewritten to cite these cards and no longer generalizes the context-1m-2025-08-07 beta beyond its documented Opus 4.6/4.7 + Sonnet 4.6 scope in agent/anthropic_adapter.py. The earlier "maintainers please confirm ceilings" caveat is resolved and removed from the PR body.

3. Bearer-token regression test through the AnthropicBedrock path. New tests/agent/test_bedrock_bearer_auth.py exercises the real installed SDK (no mocks) via build_anthropic_bedrock_client: with AWS_BEARER_TOKEN_BEDROCK set the client picks it up as api_key; without it the client leaves api_key unset so the SigV4/boto3 credential chain is used (no regression for IAM/SSO users); and the installed anthropic version is asserted >= 0.88.0, so a future pin drift back to 0.87.x fails in CI instead of at request time with "could not resolve credentials from session". The file pytest.importorskips anthropic for environments without the extra installed.

Full tests/agent/test_bedrock_adapter.py + tests/agent/test_anthropic_adapter.py suites pass locally (313 passed). PR body updated accordingly.

@vinayshah1998

Copy link
Copy Markdown
Author

Gentle ping @teknium1 - all three review points were addressed in 047dce9 (regression coverage for the 1M table entries, the bearer-token fallback ordering, and the version-gate test). No rush, just flagging it's ready for another look whenever you have a moment.

@vinayshah1998

Copy link
Copy Markdown
Author

@teknium1 Checking in on this one as well - all three review points from July 16 remain addressed in 047dce9 (regression coverage for the four 1M table entries including geo/global inference-profile forms, bearer-token fallback ordering, and the version-gate test). The branch is still green and I am happy to rebase if main has moved. Ready for another look whenever convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint dependencies Pull requests that update a dependency file P2 Medium — degraded but workaround exists provider/bedrock AWS Bedrock (boto3, IAM) sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants