Skip to content

fix(bedrock): preserve regional runtime on model switch - #41322

Closed
BROCCOLO1D wants to merge 2 commits into
NousResearch:mainfrom
BROCCOLO1D:fix/41296-bedrock-model-switch-region
Closed

fix(bedrock): preserve regional runtime on model switch#41322
BROCCOLO1D wants to merge 2 commits into
NousResearch:mainfrom
BROCCOLO1D:fix/41296-bedrock-model-switch-region

Conversation

@BROCCOLO1D

Copy link
Copy Markdown
Contributor

Summary

Why

  • resolve_runtime_provider() accepted target_model but the Bedrock branch routed from the stale config default, so switching from a non-Bedrock default to Claude-on-Bedrock could select bedrock_converse incorrectly.
  • switch_model() also never rebuilt the Bedrock-specific runtime state, leaving _bedrock_region unset and falling back to us-east-1 for regional jp.* / eu.* / apac.* profiles.

Changes

  • hermes_cli/runtime_provider.py: route Bedrock dual-path selection from target_model when present.
  • agent/agent_runtime_helpers.py: rebuild Bedrock switch state without constructing an OpenAI client, including _bedrock_region and AnthropicBedrock for Claude models.
  • tests/hermes_cli/test_runtime_provider_resolution.py: cover target-model Bedrock routing for Claude and non-Claude models.
  • tests/run_agent/test_switch_model_context.py: cover Bedrock Anthropic and Converse switch rebuild paths.

Validation

  • python -m pytest tests/hermes_cli/test_runtime_provider_resolution.py tests/run_agent/test_switch_model_context.py -o 'addopts=' -q
  • python -m ruff check agent/agent_runtime_helpers.py hermes_cli/runtime_provider.py tests/hermes_cli/test_runtime_provider_resolution.py tests/run_agent/test_switch_model_context.py

Scope

  • In scope: mid-session Bedrock model-switch runtime selection and region preservation.
  • Out of scope: live AWS Bedrock API calls or changes to startup-time Bedrock initialization.

@daimon-nous daimon-nous Bot added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/bedrock AWS Bedrock (boto3, IAM) labels Jun 7, 2026
@BROCCOLO1D

Copy link
Copy Markdown
Contributor Author

Closing this as stale: there has been no activity or maintainer follow-up for over a week, and I don't want to leave inactive work open. Happy to reopen/rework if this becomes useful.

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 P2 Medium — degraded but workaround exists provider/bedrock AWS Bedrock (boto3, IAM) type/bug Something isn't working

Projects

None yet

1 participant