Skip to content

fix(bedrock): route non-Claude auxiliary models through Converse API (#60217) - #60479

Merged
kshitijk4poor merged 3 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/60217-bedrock-aux-converse
Jul 7, 2026
Merged

fix(bedrock): route non-Claude auxiliary models through Converse API (#60217)#60479
kshitijk4poor merged 3 commits into
NousResearch:mainfrom
kshitijk4poor:salvage/60217-bedrock-aux-converse

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Summary

Auxiliary Bedrock tasks (compression, memory, title generation, session search) now work with non-Claude Bedrock models: model IDs that aren't anthropic.claude* route through a Converse-API shim instead of the Anthropic Bedrock SDK, which only accepts Claude foundation-model IDs.

Root cause: the aws_sdk branch of resolve_provider_client() unconditionally built an AnthropicAuxiliaryClient, so an aux model like openai.gpt-oss-20b-1:0 failed — while the main agent already handled it via the bedrock_converse transport.

Changes

  • agent/auxiliary_client.py: new BedrockAuxiliaryClient (+ async wrapper) — OpenAI-client-compatible shim over bedrock_adapter.call_converse(); aws_sdk branch splits on is_anthropic_bedrock_model() (Claude keeps the Anthropic SDK path for prompt-caching/thinking parity); _maybe_wrap_anthropic + _to_async_client dispatch guards — @xxxigm's fix, cherry-picked from fix(bedrock): route non-Claude auxiliary models through Converse API #60217
  • tests/agent/test_bedrock_integration.py: routing + async tests — @xxxigm
  • Follow-up (review findings): normalize string stop to a list (Converse stopSequences requires a list), and log dropped stream=True / tool_choice instead of silently ignoring them — call_llm(stream=True) (MoA aggregator) can reach this client; the complete-response return is kept because the streaming consumer's got-final-object path downgrades gracefully. +2 regression tests.

Validation

Before After
aux task on openai.gpt-oss-20b-1:0 (bedrock) Anthropic SDK error Converse roundtrip
aux task on Claude Bedrock ID Anthropic SDK Anthropic SDK (unchanged)
stop="STOP" through shim raw string to stopSequences ["STOP"]
tests/agent/ 57→59 passed in file; suite: 0 new failures (15 pre-existing on main)
E2E (mocked boto3 converse, real imports) sync + async roundtrips, kwargs-robustness 16/16

Credit

Salvaged from #60217 by @xxxigm (commits cherry-picked, authorship preserved). Closes #60217.

xxxigm and others added 3 commits July 8, 2026 01:21
Auxiliary Bedrock resolution always used the Anthropic Bedrock SDK, which
only works for Claude foundation-model IDs. Non-Claude models such as
openai.gpt-oss-20b-1:0 now use a Bedrock Converse adapter, matching the
main agent's bedrock_converse transport.
Assert gpt-oss Bedrock IDs resolve to BedrockAuxiliaryClient while Claude
IDs keep the Anthropic SDK path, including async mode.
…nverse shim

Review findings on the salvaged shim: (a) OpenAI callers may pass stop as
a bare string but Converse's stopSequences requires a list — normalize;
(b) call_llm(stream=True) (MoA aggregator) can reach this client and the
shim silently returned a complete response — keep that behavior (the
streaming consumer's got-final-object path downgrades gracefully) but log
it, and log dropped tool_choice, instead of silently ignoring both.
+2 regression tests.

Follow-up to the salvage of NousResearch#60217 by @xxxigm.
@kshitijk4poor
kshitijk4poor enabled auto-merge (rebase) July 7, 2026 20:00
@kshitijk4poor
kshitijk4poor merged commit b2d6a51 into NousResearch:main Jul 7, 2026
31 checks passed
@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) P2 Medium — degraded but workaround exists labels Jul 7, 2026
@kshitijk4poor
kshitijk4poor deleted the salvage/60217-bedrock-aux-converse branch August 5, 2026 07:08
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

Development

Successfully merging this pull request may close these issues.

3 participants