Skip to content

fix(agents): correctly extract tool arguments from AWS Bedrock responses#4889

Open
NIK-TIGER-BILL wants to merge 1 commit intocrewAIInc:mainfrom
NIK-TIGER-BILL:fix/bedrock-tool-call-arguments
Open

fix(agents): correctly extract tool arguments from AWS Bedrock responses#4889
NIK-TIGER-BILL wants to merge 1 commit intocrewAIInc:mainfrom
NIK-TIGER-BILL:fix/bedrock-tool-call-arguments

Conversation

@NIK-TIGER-BILL
Copy link

@NIK-TIGER-BILL NIK-TIGER-BILL commented Mar 15, 2026

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:

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

func_info.get("arguments", "{}") returns the string "{}" (truthy!) when the key is absent. This means the or operator never evaluates tool_call.get("input", {}), so Bedrock's input field is always ignored.

Fix

Use .get() without a default to distinguish a missing key from an empty string, then fall back to the Bedrock input field only when the OpenAI arguments field is absent or empty:

# AFTER (fixed)
_raw_args = func_info.get("arguments")
func_args = (_raw_args if _raw_args not in (None, "", "{}") else None) or tool_call.get("input", {})

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_call so missing OpenAI function.arguments no longer defaults to the truthy string "{}".

When arguments is absent/empty, the executor now correctly falls back to Bedrock-style tool call input, 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.

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
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] AWS Bedrock tool calls extract empty arguments - uses wrong field name

1 participant