hermes - 💡(How to fix) Fix bedrock_adapter: Opus 4.8 (and 4.7) on Bedrock Converse 400s with "temperature is deprecated" — _forbids_sampling_params guard never applied to Bedrock path

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

agent/bedrock_adapter.py sends temperature (and top_p) in the Converse inferenceConfig for all Claude models, including Opus 4.7 and the newly-added Opus 4.8. Opus 4.7 already rejects non-default sampling params on the Anthropic-native path (handled in anthropic_adapter.py via _forbids_sampling_params()), and Opus 4.8 extends the same restriction. On Bedrock+Converse the guard is missing entirely, so every Opus 4.7/4.8 call from the Bedrock path either silently relies on a default temperature being skipped, or 400s with ValidationException: temperature is deprecated for this model. when temperature is non-None.

This blocks Opus 4.8 adoption on AWS Bedrock end-to-end, even though PR #34003 (merged 2026-05-28) added the model to Hermes's catalog/anthropic_adapter and closed the related thinking-schema regression (#34554).

Error Message

botocore.errorfactory.ValidationException: An error occurred (ValidationException) when calling the Converse operation: The model returned the following errors: temperature is deprecated for this model.

Root Cause

Two gaps:

  1. agent/anthropic_adapter.py already has the right shape:

    _NO_SAMPLING_PARAMS_SUBSTRINGS = ("4-7", "4.7")
    
    def _forbids_sampling_params(model: str) -> bool:
        """Return True for models that 400 on any non-default temperature/top_p/top_k."""
        return any(v in model for v in _NO_SAMPLING_PARAMS_SUBSTRINGS)

    …but the substring list does not include 4-8/4.8. Even Anthropic-native callers will start to 400 on Opus 4.8 once the model gets exercised under non-default temperature.

  2. agent/bedrock_adapter.py does not import or call _forbids_sampling_params() at all. It unconditionally writes temperature/top_p into inferenceConfig whenever they are non-None, regardless of model id. So even after fixing (1), Bedrock+Opus-4.7 and Bedrock+Opus-4.8 will keep failing.

Fix Action

Fix / Workaround

  • Hermes-agent: origin/main at fa4ebaa8b (2026-05-31)
  • Local base: 0325e18f3 + 2 local Bedrock-adjacent patches (d7b164864 1M-context beta forwarding for #31277, 039145bcd Converse cachePoint for #11970). Neither patch touches the temperature path.
  • AWS region: us-east-1
  • Inference profile: us.anthropic.claude-opus-4-8 (also reproduces against global.anthropic.claude-opus-4-8)
  • Foundation model: anthropic.claude-opus-4-8 (ACTIVE per bedrock list-foundation-models)
  • Auth: AWS_BEARER_TOKEN_BEDROCK
  • boto3: pinned via uv.lock

P2 — blocks upgrade to current-flagship Opus 4.8 on AWS Bedrock; equivalent breakage already latent on Opus 4.7 for any caller that passes a non-default temperature.

Code Example

import boto3
client = boto3.client('bedrock-runtime', region_name='us-east-1')
client.converse(
    modelId='us.anthropic.claude-opus-4-8',
    messages=[{'role':'user','content':[{'text':'hi'}]}],
    inferenceConfig={'maxTokens': 32, 'temperature': 1.0},
)

---

botocore.errorfactory.ValidationException:
  An error occurred (ValidationException) when calling the Converse operation:
  The model returned the following errors: `temperature` is deprecated for this model.

---

if temperature is not None:
    kwargs["inferenceConfig"]["temperature"] = temperature

---

_NO_SAMPLING_PARAMS_SUBSTRINGS = ("4-7", "4.7")

   def _forbids_sampling_params(model: str) -> bool:
       """Return True for models that 400 on any non-default temperature/top_p/top_k."""
       return any(v in model for v in _NO_SAMPLING_PARAMS_SUBSTRINGS)

---

_NO_SAMPLING_PARAMS_SUBSTRINGS = ("4-7", "4.7", "4-8", "4.8")

---

from .anthropic_adapter import _forbids_sampling_params

   if temperature is not None and not _forbids_sampling_params(model_id):
       kwargs["inferenceConfig"]["temperature"] = temperature

   if top_p is not None and not _forbids_sampling_params(model_id):
       kwargs["inferenceConfig"]["topP"] = top_p
RAW_BUFFERClick to expand / collapse

Summary

agent/bedrock_adapter.py sends temperature (and top_p) in the Converse inferenceConfig for all Claude models, including Opus 4.7 and the newly-added Opus 4.8. Opus 4.7 already rejects non-default sampling params on the Anthropic-native path (handled in anthropic_adapter.py via _forbids_sampling_params()), and Opus 4.8 extends the same restriction. On Bedrock+Converse the guard is missing entirely, so every Opus 4.7/4.8 call from the Bedrock path either silently relies on a default temperature being skipped, or 400s with ValidationException: temperature is deprecated for this model. when temperature is non-None.

This blocks Opus 4.8 adoption on AWS Bedrock end-to-end, even though PR #34003 (merged 2026-05-28) added the model to Hermes's catalog/anthropic_adapter and closed the related thinking-schema regression (#34554).

Reproduction

Local repro on origin/main (fa4ebaa8b as of 2026-05-31):

import boto3
client = boto3.client('bedrock-runtime', region_name='us-east-1')
client.converse(
    modelId='us.anthropic.claude-opus-4-8',
    messages=[{'role':'user','content':[{'text':'hi'}]}],
    inferenceConfig={'maxTokens': 32, 'temperature': 1.0},
)

Result:

botocore.errorfactory.ValidationException:
  An error occurred (ValidationException) when calling the Converse operation:
  The model returned the following errors: `temperature` is deprecated for this model.

Dropping temperature from inferenceConfig succeeds (OPUS-4-8-OK in ~4s, usage in=25 out=13).

The same call shape is what agent/bedrock_adapter.py:903-904 produces today:

if temperature is not None:
    kwargs["inferenceConfig"]["temperature"] = temperature

The function signature defaults temperature: Optional[float] = None, but every Hermes call site that goes through this adapter passes a concrete value (config default + provider defaults), so temperature is not None is the common path.

Root cause

Two gaps:

  1. agent/anthropic_adapter.py already has the right shape:

    _NO_SAMPLING_PARAMS_SUBSTRINGS = ("4-7", "4.7")
    
    def _forbids_sampling_params(model: str) -> bool:
        """Return True for models that 400 on any non-default temperature/top_p/top_k."""
        return any(v in model for v in _NO_SAMPLING_PARAMS_SUBSTRINGS)

    …but the substring list does not include 4-8/4.8. Even Anthropic-native callers will start to 400 on Opus 4.8 once the model gets exercised under non-default temperature.

  2. agent/bedrock_adapter.py does not import or call _forbids_sampling_params() at all. It unconditionally writes temperature/top_p into inferenceConfig whenever they are non-None, regardless of model id. So even after fixing (1), Bedrock+Opus-4.7 and Bedrock+Opus-4.8 will keep failing.

Proposed fix

Two minimal changes:

  1. Extend the Anthropic-side substring list:

    _NO_SAMPLING_PARAMS_SUBSTRINGS = ("4-7", "4.7", "4-8", "4.8")
  2. Apply the same guard in bedrock_adapter.py. Either import the helper or duplicate the substring check (the adapter already does light model-id sniffing for other features). Skeleton:

    from .anthropic_adapter import _forbids_sampling_params
    
    if temperature is not None and not _forbids_sampling_params(model_id):
        kwargs["inferenceConfig"]["temperature"] = temperature
    
    if top_p is not None and not _forbids_sampling_params(model_id):
        kwargs["inferenceConfig"]["topP"] = top_p

    (Or hoist the helper into a shared location like agent/model_metadata.py to avoid the cross-adapter import.)

Tests: extend tests/agent/test_bedrock_adapter.py with a case asserting temperature and topP are absent from inferenceConfig when model_id matches claude-opus-4-7 or claude-opus-4-8.

Environment

  • Hermes-agent: origin/main at fa4ebaa8b (2026-05-31)
  • Local base: 0325e18f3 + 2 local Bedrock-adjacent patches (d7b164864 1M-context beta forwarding for #31277, 039145bcd Converse cachePoint for #11970). Neither patch touches the temperature path.
  • AWS region: us-east-1
  • Inference profile: us.anthropic.claude-opus-4-8 (also reproduces against global.anthropic.claude-opus-4-8)
  • Foundation model: anthropic.claude-opus-4-8 (ACTIVE per bedrock list-foundation-models)
  • Auth: AWS_BEARER_TOKEN_BEDROCK
  • boto3: pinned via uv.lock

Severity

P2 — blocks upgrade to current-flagship Opus 4.8 on AWS Bedrock; equivalent breakage already latent on Opus 4.7 for any caller that passes a non-default temperature.

Related

  • PR #34003 (merged 2026-05-28) — added Opus 4.8 to model catalog + Anthropic-native adapter, but did not touch bedrock_adapter.py.
  • Issue #34554 (closed by #34003) — Opus 4.8 thinking-schema regression on the Anthropic path.
  • Issue #31277 (open, P2) — separate Bedrock Converse adapter regression for context-1m beta on Opus 4.6/4.7. Same adapter, adjacent surface.
  • Issue #11970 (open, P1) — Bedrock Converse cachePoint never injected. Same adapter.

These three together suggest agent/bedrock_adapter.py is drifting behind the Anthropic-native adapter's model-aware feature gates; a small consolidation pass on this file would prevent the next Opus release from hitting the same shape.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix bedrock_adapter: Opus 4.8 (and 4.7) on Bedrock Converse 400s with "temperature is deprecated" — _forbids_sampling_params guard never applied to Bedrock path