fix: support Bedrock application inference profile ARNs in cache detection#1788
Open
giulio-leone wants to merge 1 commit intostrands-agents:mainfrom
Open
fix: support Bedrock application inference profile ARNs in cache detection#1788giulio-leone wants to merge 1 commit intostrands-agents:mainfrom
giulio-leone wants to merge 1 commit intostrands-agents:mainfrom
Conversation
…ction _supports_caching only checked for 'claude'/'anthropic' in the model_id string, which fails for application inference profile ARNs since they contain opaque profile IDs without model names. Changes: - Resolve application inference profile ARNs via the Bedrock control-plane GetInferenceProfile API to discover the underlying foundation model - Cache the resolution result to avoid repeated API calls - Invalidate cache when model_id changes via update_config() - Preserve original ARN casing for API calls (ARNs are case-sensitive) - Handle API errors gracefully with broad exception catching Fixes strands-agents#1705 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Author
|
All 5 CI checks pass. Fixes Bedrock inference profile ARN support. Ready for review. |
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.
Problem
_supports_cachingonly checks for'claude'or'anthropic'in themodel_idstring. This works for system inference profile IDs (e.g.,us.anthropic.claude-haiku-4-5-20251001-v1:0) but fails for application inference profile ARNs which contain opaque profile IDs without model names:As a result, users get a warning on every API call and prompt caching is silently disabled, even when the underlying model is Claude.
Solution
GetInferenceProfileAPImodel_idchanges viaupdate_config()Tests
Added 7 new tests covering:
model_idchangeAll 128 existing tests continue to pass.
Fixes #1705