Skip to content

fix: Bedrock tool call arguments no longer silently dropped (closes #5275)#5277

Open
TheCodingDragon0 wants to merge 1 commit intocrewAIInc:mainfrom
TheCodingDragon0:fix/bedrock-tool-args
Open

fix: Bedrock tool call arguments no longer silently dropped (closes #5275)#5277
TheCodingDragon0 wants to merge 1 commit intocrewAIInc:mainfrom
TheCodingDragon0:fix/bedrock-tool-args

Conversation

@TheCodingDragon0
Copy link
Copy Markdown

Fixes #5275

Problem

When using crewAI with AWS Bedrock LLMs (e.g. Amazon Nova Pro), tool arguments were silently discarded. The LLM correctly called the tool with the right arguments, but the tool received an empty dict {}.

Root Cause

Line 850 in crew_agent_executor.py:

func_args = func_info.get("arguments", "{}") or tool_call.get("input", {})

Bedrock's Converse API returns tool calls as {"name": "X", "toolUseId": "Y", "input": {...}} — no "function" wrapper. So func_info = {}, and func_info.get("arguments", "{}") returns the default string "{}" which is truthy, preventing the or from falling through to tool_call.get("input", {}).

Fix

Changed default from "{}" to None:

func_args = func_info.get("arguments") or tool_call.get("input", {})

With None as default, func_info.get("arguments") returns None (falsy) when no "function" wrapper exists, so the or correctly falls through to the Bedrock input format.

…rewAIInc#5275)

When using AWS Bedrock LLMs, tool arguments were being discarded because
the default value of '{}' in func_info.get('arguments', '{}') was truthy,
preventing the fallback to tool_call.get('input', {}).

Changed default from '{}' to None so the or-chain correctly falls through
to the Bedrock input format when no 'function' wrapper is present.
@samimasod
Copy link
Copy Markdown

A small regression test here would make this much safer. There’s already Bedrock native tool-calling coverage in lib/crewai/tests/agents/test_native_tool_calling.py, especially test_bedrock_agent_kickoff_with_tools_mocked.

It would be great to extend that test (or add a nearby Bedrock-specific regression test in the same file) to assert that a Bedrock-shaped tool call like:

{"name": "calculator", "toolUseId": "...", "input": {"expression": "15 * 8"}}

results in the executed tool receiving {"expression": "15 * 8"} rather than {}.

Right now the test seems to validate the final outcome, but not that the Bedrock input payload was preserved through parsing/execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Bedrock tool call arguments silently dropped — tool invoked with empty input

2 participants