You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Anthropic model-info lookup does not resolve AWS Bedrock / cross-region inference model IDs #7833
Thanks for AutoGen and the Anthropic-on-Bedrock client. (Filing this as a small bug fix, in keeping with the project's maintenance-mode scope — not a feature request.)
What happened?
While using AnthropicBedrockChatCompletionClient, the model-info auto-detection can't resolve Bedrock-style model IDs.
Repro (no network / keys needed):
fromautogen_ext.models.anthropicimport_model_info_model_info.get_info("us.anthropic.claude-3-5-sonnet-20240620-v1:0")
# KeyError: "Model 'us.anthropic.claude-3-5-sonnet-20240620-v1:0' not found in model info"_model_info.get_token_limit("anthropic.claude-3-5-sonnet-20240620-v1:0")
# 100000 (fallback; the matching table entry is 200000)
Cause
The matcher in python/packages/autogen-ext/src/autogen_ext/models/anthropic/_model_info.py:149 is prefix-anchored (model.startswith(model_id.split("-2")[0])), so Bedrock provider/region prefixes (anthropic., us./eu./apac./global.anthropic.) and the -vN:M suffix never match. The Bedrock docstring example (_anthropic_client.py:1318) and the serialization test both pass model_info=ModelInfo(...) manually — a workaround for exactly this.
Scope note
The table values (context windows etc.) are a separate data-correctness concern; this is only about ID resolution. I have a minimal fix (a shared normalize helper) + a no-network regression test ready, happy to open a PR.
Added _normalize_model_id to strip Bedrock prefixes and version suffixes before model info lookup. Also filled in missing Claude 4 token limits. PR ready.
Thanks Eric Zhu (@ekzhu) for all the time you've put into autogen's model clients, including merging the Anthropic-on-Bedrock work in #6170 and #6979. This issue now has four open PRs for the same lookup fix (one of them is mine), so I've put them in one table to make it easier to pick one.
also targets #7867 (tool output serialization) and #7768 (trailing assistant messages)
All four sit on current main with no conflicts, and all four fix the reported KeyError. In my run the visible difference was the Claude 4 token limit, where only #7930 returns 200000:
ErenAta16 also compared #7834, #7886 and #7930 head to head in a review on #7930, including a us-gov. prefix case I haven't repeated here.
When you have a moment, could you say which one you'd like to take forward? If this isn't a priority right now, or you'd rather go with one of the others, tell me and I'll close #7834 to keep your queue clean.
How this was run
Each PR's _model_info.py was loaded from its head commit and called with the same IDs. Test results are tests/models/test_anthropic_model_client.py (plus test_anthropic_model_info.py for #7886) in python/packages/autogen-ext, run without API credentials: 18 passed on main, 20 skipped on every branch.
Activity
Functionhx commentedon Jul 9, 2026
Added _normalize_model_id to strip Bedrock prefixes and version suffixes before model info lookup. Also filled in missing Claude 4 token limits. PR ready.
fix: resolve Bedrock-style model IDs in Anthropic model-info lookup
kimnamu commentedon Sep 30, 2026
Thanks Eric Zhu (@ekzhu) for all the time you've put into autogen's model clients, including merging the Anthropic-on-Bedrock work in #6170 and #6979. This issue now has four open PRs for the same lookup fix (one of them is mine), so I've put them in one table to make it easier to pick one.
main@ 027ecf0main@ 027ecf0main@ 027ecf0_MODEL_TOKEN_LIMITSmain@ 027ecf0All four sit on current
mainwith no conflicts, and all four fix the reportedKeyError. In my run the visible difference was the Claude 4 token limit, where only #7930 returns 200000:ErenAta16 also compared #7834, #7886 and #7930 head to head in a review on #7930, including a
us-gov.prefix case I haven't repeated here.When you have a moment, could you say which one you'd like to take forward? If this isn't a priority right now, or you'd rather go with one of the others, tell me and I'll close #7834 to keep your queue clean.
How this was run
Each PR's
_model_info.pywas loaded from its head commit and called with the same IDs. Test results aretests/models/test_anthropic_model_client.py(plustest_anthropic_model_info.pyfor #7886) inpython/packages/autogen-ext, run without API credentials: 18 passed onmain, 20 skipped on every branch.