Fix: Bedrock Application Inference ARN breaks Claude Sonnet tools usage #561
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.
Description
This PR fixes the issue when running a agent using tools with application inference profile of Claude Sonnet 3.7 as input. Note that using regional inference profile is working well, and only application inference profile (AIP) will not return any tools use information.
Root Cause
Langchain needs to identify the model id of the foundation model but fails to detect the foundation model from the input AIP ARN (e.g.,
arn:aws:bedrock:us-east-1:111111484058:application-inference-profile/c3myu2h6fllr
), while regional inference profile contains the foundation model nameus.anthropic.claude-3-7-sonnet-20250219-v1:0
and can be easily used to identify the base model id. Therefore, regional inference profile is working well while AIP is not.Solution
To identify the foundation model used in AIP, we need to call Bedrock
get_inference_profile
control plane API, and parse the model id from the response.Issue
#535