fix(bedrock): route auxiliary tasks through AnthropicBedrock SDK - #11612
Closed
denysgaievskyi wants to merge 1 commit into
Closed
fix(bedrock): route auxiliary tasks through AnthropicBedrock SDK#11612denysgaievskyi wants to merge 1 commit into
denysgaievskyi wants to merge 1 commit into
Conversation
Auxiliary tasks (compression, memory flush, session search, vision, web
extract) share a separate client resolver from the main inference path:
agent/auxiliary_client.py → resolve_provider_client(). In v0.10.0 that
resolver knows how to build clients for api_key, external_process, and
oauth_device_code auth types — but not aws_sdk. Bedrock is the only
provider that registers with auth_type="aws_sdk", so users who configure
auxiliary.* blocks with provider=bedrock hit:
WARNING agent.auxiliary_client: resolve_provider_client:
unhandled auth_type aws_sdk for bedrock
WARNING agent.auxiliary_client: Auxiliary auto-detect: no provider
available (tried: openrouter, nous, local/custom, openai-codex,
api-key). Compression, summarization, and memory flush will not
work.
The existing AnthropicAuxiliaryClient wrapper already exposes
.chat.completions.create() by delegating to a native Anthropic client's
.messages.create(). anthropic.AnthropicBedrock has the same messages
surface, so the wrapper works as-is — the only thing missing is a
builder that constructs it via boto3 credentials and a preserve_dots
flag so cross-region inference profile IDs
(us.anthropic.claude-haiku-4-5-20251001-v1:0) aren't dot-mangled by
normalize_model_name().
Changes:
- _try_bedrock() builder: resolves region (config.yaml bedrock.region →
env → us-east-1), checks has_aws_credentials(), builds AnthropicBedrock
via build_anthropic_bedrock_client(), wraps with AnthropicAuxiliaryClient
(preserve_dots=True, api_key="aws-sdk").
- resolve_provider_client() gains an aws_sdk branch ahead of the
api_key branch — returns (None, None) with a warning when AWS creds
or the SDK are missing, instead of silently falling through to
auto-detect.
- _AnthropicCompletionsAdapter + AnthropicAuxiliaryClient accept a
preserve_dots kwarg; defaults to False (unchanged behavior for direct
Anthropic) and flows through to build_anthropic_kwargs().
- _API_KEY_PROVIDER_AUX_MODELS gains a bedrock entry pointing at
Haiku 4.5 (cheap/fast like the other provider defaults).
Tests (5 new, 160 existing pass):
- _try_bedrock returns (None, None) when AWS creds absent
- _try_bedrock builds AnthropicBedrock, wraps with preserve_dots=True,
api_key=aws-sdk, base_url points at bedrock-runtime.<region>
- config.yaml bedrock.region wins over resolve_bedrock_region() fallback
- resolve_provider_client("bedrock") returns an AnthropicAuxiliaryClient
- resolve_provider_client("bedrock") without creds returns (None, None)
This was referenced Apr 22, 2026
Collaborator
Contributor
|
Thanks for the detailed PR and live verification, @denysgaievskyi! The core fix here — adding an This is an automated hermes-sweeper review. Evidence:
One residual gap: the merged implementation does not thread |
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.
Summary
Auxiliary tasks (compression, memory flush, session search, vision, web extract) share a separate client resolver from the main inference path at
agent/auxiliary_client.py. That resolver handlesauth_typeofapi_key,external_process, andoauth_device_code— but notaws_sdk. Bedrock is the only provider registered withauth_type=\"aws_sdk\", so users who setprovider: bedrockon theirauxiliary.*blocks hit:#10745 quiets the first warning but explicitly returns
(None, None)(diff) because there is no OpenAI-compatible endpoint on Bedrock — so the functional gap remains. The second warning still fires, auxiliary tasks still break, andcontext_compressorstill drops middle turns without summary.The existing
AnthropicAuxiliaryClientalready exposes.chat.completions.create()by delegating to a native Anthropic client's.messages.create().anthropic.AnthropicBedrockhas the same messages surface, so the wrapper works unchanged — all we need is a builder that constructs it via boto3 credentials plus apreserve_dotsflag so cross-region inference profile IDs likeus.anthropic.claude-haiku-4-5-20251001-v1:0are not mangled bynormalize_model_name().Root cause
hermes_cli/auth.pyregisters Bedrock withauth_type=\"aws_sdk\"agent/auxiliary_client.py:resolve_provider_clienthas noaws_sdkbranch → falls through to auto-detectopenrouter → nous → local/custom → openai-codex → api-key— all OpenAI-compat, none of them Bedrock →(None, None)Fix
_try_bedrock()builder: resolves region (config.yaml bedrock.region→AWS_REGION→AWS_DEFAULT_REGION→us-east-1, mirroringhermes_cli/runtime_provider.pyresolve_bedrock_runtime), checkshas_aws_credentials(), buildsAnthropicBedrockviabuild_anthropic_bedrock_client(), wraps withAnthropicAuxiliaryClient(preserve_dots=True, api_key=\"aws-sdk\")resolve_provider_client()gains anaws_sdkbranch ahead of theapi_keybranch — returns(None, None)with a warning when AWS creds or the SDK are unavailable, so callers surface a real error instead of silent auto-detect fallthrough_AnthropicCompletionsAdapter+AnthropicAuxiliaryClienttake apreserve_dotskwarg; defaults toFalse(unchanged for direct Anthropic) and flows through tobuild_anthropic_kwargs()_API_KEY_PROVIDER_AUX_MODELS[\"bedrock\"]defaults to Haiku 4.5 cross-region inference profileVerification
Local pytest (5 new tests + 52 existing in
test_auxiliary_client.py): 57/57 passing.Live-verified against AWS Bedrock (eu-central-1) in a separate deployment — auxiliary requests route through the
AnthropicBedrockSDK, nounhandled auth_type aws_sdkwarning, nono provider availablewarning, compression actually runs.Tests added
tests/agent/test_auxiliary_client.py::TestBedrockAuxiliary:test_try_bedrock_builds_wrapped_client— parametrized (empty config vsbedrock.regionoverride) to verify region resolution, wrapper construction,preserve_dots=True,api_key=\"aws-sdk\", and base URL pointing atbedrock-runtime.<region>.amazonaws.comtest_resolve_provider_client_bedrock_happy_path— verifiesprovider=\"bedrock\"routes through the newaws_sdkbranchtest_resolve_provider_client_bedrock_missing_credentials— verifies clean(None, None)return when AWS credentials are absent (no silent fall-through)Related
(None, None)with a comment that Bedrock has no OpenAI-compat path — this PR wires up the native-path alternative)Type of Change