feat(bedrock): support OpenAI Responses models - #53880
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Bedrock OpenAI Responses model support (7 files). Well-scoped provider extension:
- New
is_openai_bedrock_modelandbedrock_openai_base_urlfunctions in bedrock_adapter - OpenAI SDK client configuration via SigV4-signing httpx client
- Proper fallback: if the OpenAI path fails for non-Bedrock providers, the exception is swallowed gracefully
configure_bedrock_openai_client_kwargscentralizes client setup- Changes in
agent_init.pyandauxiliary_client.pyare additive, not destructive
Test coverage is reasonable for a provider integration. The except Exception with re-raise guard for actual Bedrock providers is a good pattern.
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Well-scoped Bedrock OpenAI Responses model support (7 files). Key features:
- New
is_openai_bedrock_modelandbedrock_openai_base_urlfunctions in bedrock_adapter BedrockOpenAISigV4Authfor httpx SigV4-signing- OpenAI SDK client configuration via SigV4-signing httpx client
- Proper fallback: if the OpenAI path fails for non-Bedrock providers, the exception is swallowed gracefully
configure_bedrock_openai_client_kwargscentralizes client setup- Changes in
agent_init.pyandauxiliary_client.pyare additive, not destructive
Test coverage is reasonable for a provider integration. The except Exception with re-raise guard for actual Bedrock providers is a good pattern.
No concerns. Ready to merge.
Reviewed by Hermes Agent
Route Bedrock-hosted OpenAI GPT-5.5 through the Bedrock Mantle OpenAI Responses endpoint with SigV4 request signing. Keep native Bedrock Converse and Claude Bedrock routing unchanged, and add picker/runtime regression coverage.
Preserve the Bedrock provider identity for MoA reference and aggregator slots so Bedrock OpenAI Responses models use the aws_sdk/SigV4 runtime instead of being downgraded to a generic custom endpoint. Add regression coverage for Bedrock GPT-5.5 MoA slots.
a1f579f to
6c0b176
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused Mantle/IAM implementation. The core premise remains valid: current main routes non-Claude Bedrock models through Converse at hermes_cli/runtime_provider.py:1991, while AWS documents GPT-5.5 as Responses-only on bedrock-mantle.
Problems
agent/auxiliary_client.py:4473reconstructs the endpoint fromresolve_bedrock_region()and ignores the explicit main-runtime URL forwarded by auto resolution (agent/auxiliary_client.py:4222-4251). That disagrees with the main resolver, which honorsbedrock.region(hermes_cli/runtime_provider.py:1958-1962), so auxiliary requests can move to the wrong region.- The added picker tests snapshot a model name and counts, contrary to
AGENTS.md:1309-1355.
Suggested changes
- Preserve/parse the explicit Mantle URL for auxiliary calls and add a config-region-vs-environment regression.
- Salvage the MoA coverage onto the current centralized preservation path:
a653bb0cremoved the whitelist this PR edits. - Update
website/docs/guides/aws-bedrock.md:9, which currently says Hermes does not use the OpenAI-compatible endpoint.
Automated hermes-sweeper review.
|
|
||
| if is_openai_bedrock_model(final_model): | ||
| bearer = resolve_bedrock_bearer_token() | ||
| base_url = bedrock_openai_base_url(region) |
There was a problem hiding this comment.
This rebuilds the endpoint from the ambient AWS region and ignores explicit_base_url forwarded from the active main runtime. Please preserve/parse that Mantle URL (or reuse runtime resolution), otherwise bedrock.region can select one region for the main agent and another for auxiliary calls.
Summary
openai.gpt-5.5.openai.gpt-5.5in the AWS Bedrock model picker even though it is not returned by native Bedrock Converse discovery.https://bedrock-mantle.<region>.api.aws/openai/v1, while preserving existing Claude-on-Bedrock and native Converse routing.Why
Bedrock-hosted GPT-5.5 is served through the Bedrock Mantle OpenAI-compatible Responses endpoint, not
bedrock-runtimeConverse. Without a separate route, Hermes can discover/use Converse models under AWS Bedrock but cannot select or callopenai.gpt-5.5from the Bedrock provider.MoA slots also need provider-aware runtime handling. If a Bedrock GPT-5.5 MoA slot forwards
base_url+api_key="aws-sdk"as a generic custom OpenAI endpoint, the sentinel is sent as an invalid bearer token. Keepingprovider=bedrocklets the auxiliary provider router attach the SigV4 Responses client.Conflict resolution
origin/main(23021be26e66e26e1b9893eda2dc943849ede03d).agent/moa_loop.pyconflict by keeping upstream's provider-preservation guard fornousand addingbedrockto the same preserved-provider set.Testing
scripts/run_tests.sh tests/run_agent/test_moa_loop_mode.py tests/hermes_cli/test_bedrock_model_picker.py tests/agent/test_bedrock_integration.py tests/run_agent/test_callable_api_key.py tests/test_empty_model_fallback.py127 passed, 0 failedPYTHONPATH="$WT" /Users/nathaniel/.hermes/hermes-agent/venv/bin/python -m py_compile agent/agent_init.py agent/auxiliary_client.py agent/bedrock_adapter.py agent/moa_loop.py hermes_cli/models.py hermes_cli/runtime_provider.py tests/agent/test_bedrock_integration.py tests/hermes_cli/test_bedrock_model_picker.py tests/run_agent/test_moa_loop_mode.pygit diff --check origin/main...HEAD/Users/nathaniel/.hermes/hermes-agent/venv/bin/python scripts/check-windows-footguns.py agent/agent_init.py agent/auxiliary_client.py agent/bedrock_adapter.py agent/moa_loop.py hermes_cli/models.py hermes_cli/runtime_provider.py tests/agent/test_bedrock_integration.py tests/hermes_cli/test_bedrock_model_picker.py tests/run_agent/test_moa_loop_mode.py✓ No Windows footguns found (9 file(s) scanned).PYTHONPATH="$WT" AWS_REGION=us-east-2 /Users/nathaniel/.hermes/hermes-agent/venv/bin/hermes -z 'Reply exactly: rebase-bedrock-gpt55-ok' --provider bedrock -m openai.gpt-5.5 --toolsets ''rebase-bedrock-gpt55-okcall_llm(provider="bedrock", model="openai.gpt-5.5"):aux-bedrock-rebase-okHERMES_HOME=/private/tmp/hermes-moa-bedrock-home PYTHONPATH="$WT" AWS_REGION=us-east-2 /Users/nathaniel/.hermes/hermes-agent/venv/bin/hermes -z 'Reply exactly: rebase-moa-bedrock-ok' --provider moa -m bedrock-gpt55 --toolsets ''rebase-moa-bedrock-okDuplicate check
Bedrock GPT-5.5.Bedrock OpenAI Responses.