fix: prevent Bedrock tool call arguments from being silently dropped#5276
Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Open
fix: prevent Bedrock tool call arguments from being silently dropped#5276devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
When using AWS Bedrock LLMs, tool arguments were silently discarded
because func_info.get('arguments', '{}') returned the truthy default
'{}' string, preventing the 'or' fallback to tool_call.get('input')
which contains the actual Bedrock arguments.
Changed the default from '{}' to None (by omitting it) so that when
no 'function' wrapper is present (Bedrock format), the or-chain
correctly falls through to read tool_call['input'].
Fixes #5275
Co-Authored-By: João <joao@crewai.com>
Contributor
Author
|
Prompt hidden (unlisted session) |
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
Fixes #5275. When using AWS Bedrock LLMs, tool call arguments were silently discarded, causing tools to receive
{}instead of the actual parameters.Root cause: In
_parse_native_tool_call, the dict-branch usedfunc_info.get("arguments", "{}"). Bedrock tool calls have no"function"wrapper, sofunc_infois{}. The.get("arguments", "{}")returns the default"{}"— a truthy string — which short-circuits theor, andtool_call.get("input", {"city": "Paris"})is never evaluated.Fix: Remove the truthy default so the
or-chain falls through correctly:This aligns with
extract_tool_call_infoinagent_utils.py(line 1224), which already uses the correct pattern.Review & Testing Checklist for Human
"function": {"arguments": ...}) still work — theargumentsvalue is a non-empty JSON string (truthy), so theorshould not fall throughargumentsis ever an empty string"", it now falls through toinputinstead of returning"{}". This should be benign (empty string is invalid JSON anyway) but worth confirming no provider sends itTravelToolfrom the issue) and confirm the tool receives the correct arguments instead of{}Notes
agent_utils.py:extract_tool_call_infoalready had the correct pattern and was not affected_parse_native_tool_callandextract_tool_call_infoLink to Devin session: https://app.devin.ai/sessions/f9045bdaa79642948bb2f734e0de5d79
Note
Low Risk
Low risk, localized change to native tool-call argument extraction plus new unit coverage; main risk is subtle behavior change when
function.argumentsis missing/empty causing fallback toinput/{}.Overview
Fixes native tool-call parsing so Bedrock-style dict tool calls no longer drop their
inputarguments (removes the truthy default"{}"and falls through totool_call["input"]or{}).Adds regression/unit tests covering Bedrock vs OpenAI dict formats, empty-args behavior, and nested Bedrock inputs for both
CrewAgentExecutor._parse_native_tool_callandagent_utils.extract_tool_call_info.Reviewed by Cursor Bugbot for commit c0c1920. Bugbot is set up for automated code reviews on this repo. Configure here.