fix(agents): correctly extract tool arguments from AWS Bedrock responses#4889
Open
NIK-TIGER-BILL wants to merge 1 commit intocrewAIInc:mainfrom
Open
fix(agents): correctly extract tool arguments from AWS Bedrock responses#4889NIK-TIGER-BILL wants to merge 1 commit intocrewAIInc:mainfrom
NIK-TIGER-BILL wants to merge 1 commit intocrewAIInc:mainfrom
Conversation
The previous code used func_info.get('arguments', '{}') which returns
the string '{}' (not None/falsy) when the key is missing. This caused
the 'or' operator to never evaluate the Bedrock-style 'input' field,
resulting in all Bedrock tool calls receiving empty arguments {}.
Fix by checking for absent/empty arguments before falling back to
the Bedrock 'input' field.
Fixes crewAIInc#4748
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
When using AWS Bedrock models (e.g.,
us.amazon.nova-pro-v1:0), all tool calls receive empty arguments{}regardless of what the LLM provides.The bug is in
crew_agent_executor.py:func_info.get("arguments", "{}")returns the string"{}"(truthy!) when the key is absent. This means theoroperator never evaluatestool_call.get("input", {}), so Bedrock'sinputfield is always ignored.Fix
Use
.get()without a default to distinguish a missing key from an empty string, then fall back to the Bedrockinputfield only when the OpenAIargumentsfield is absent or empty:Fixes #4748
Note
Medium Risk
Touches core native tool-call parsing in
CrewAgentExecutor, which can change what arguments are passed into tools across providers. Small, targeted logic change but impacts tool execution correctness.Overview
Fixes native tool-call parsing in
CrewAgentExecutor._parse_native_tool_callso missing OpenAIfunction.argumentsno longer defaults to the truthy string"{}".When
argumentsis absent/empty, the executor now correctly falls back to Bedrock-style tool callinput, preventing tools from being invoked with empty{}arguments on Bedrock responses.Written by Cursor Bugbot for commit 5c72dab. This will update automatically on new commits. Configure here.