crewai - ✅(Solved) Fix [BUG] _parse_native_tool_call drops Bedrock Converse API tool arguments — always passes empty dict [4 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
crewAIInc/crewAI#4972Fetched 2026-04-08 01:07:01
View on GitHub
Comments
2
Participants
3
Timeline
26
Reactions
0
Timeline (top)
referenced ×12cross-referenced ×9commented ×2labeled ×1

When using AWS Bedrock as the LLM provider with native function calling, all tool arguments are silently dropped. Every tool call receives an empty dict {} instead of the actual arguments, causing pydantic validation failures on any tool with required parameters.

Error Message

Error output (repeats every iteration until max iterations): Tool 'search_in_user_knowledgebase' arguments validation failed: 1 validation error for SearchUserKnowledgebaseToolSchema

Root Cause

When using AWS Bedrock as the LLM provider with native function calling, all tool arguments are silently dropped. Every tool call receives an empty dict {} instead of the actual arguments, causing pydantic validation failures on any tool with required parameters.

Fix Action

Fixed

PR fix notes

PR #4973: fix: extract Bedrock Converse API tool arguments from 'input' key (#4972)

Description (problem / solution / changelog)

Summary

Fixes #4972. When using AWS Bedrock as the LLM provider with native function calling, all tool arguments were silently dropped — every tool call received {} instead of its actual arguments.

Root cause: In _parse_native_tool_call's dict-handling branch, func_info.get("arguments", "{}") returned the truthy default string "{}" when the "function" key was absent (as it is for Bedrock). This prevented the or from ever reaching tool_call.get("input"), where Bedrock stores its arguments.

Fix: One-line change — remove the truthy default so get("arguments") returns None (falsy) when the key is missing, allowing the or-chain to correctly fall through:

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

# After (fixed):
func_args = func_info.get("arguments") or tool_call.get("input") or "{}"

Review & Testing Checklist for Human

  • Verify the or-chain edge cases are acceptable: when Bedrock returns "input": {} (empty dict, falsy), func_args becomes the string "{}" rather than {}. Confirm downstream parse_tool_call_args handles both types correctly (it does — see _execute_single_native_tool_call).
  • Confirm OpenAI-style dict tool calls ({"function": {"arguments": ...}}) are unaffected — the first get("arguments") still returns the string args when present.
  • If you have Bedrock credentials, test a crew with a BaseTool that has required arguments (e.g., search_query: str) to verify args flow end-to-end.

Notes

  • 8 new unit tests added covering Bedrock-style dicts, OpenAI-style dicts (regression), empty inputs, missing keys, and toolUseId handling.
  • This affects all Bedrock models using native function calling since BedrockCompletion.supports_function_calling() returns True.

Link to Devin session: https://app.devin.ai/sessions/999e4cae3d7045f3905052a39803fc23

Changed files

  • lib/crewai/src/crewai/agents/crew_agent_executor.py (modified, +1/-1)
  • lib/crewai/tests/agents/test_native_tool_calling.py (modified, +157/-0)

PR #4975: fix(agents): fix Bedrock Converse API tool arguments dropped in _parse_native_tool_call

Description (problem / solution / changelog)

The default value "{}" (truthy string) in func_info.get("arguments", "{}") prevents the fallback to tool_call.get("input", {}) from activating for Bedrock Converse API responses.

Closes #4972

Changed files

  • lib/crewai/src/crewai/agents/crew_agent_executor.py (modified, +1/-1)

PR #4978: fix: Bedrock Converse API tool arguments silently dropped (#4972)

Description (problem / solution / changelog)

Problem

When using AWS Bedrock with native function calling, all tool arguments are silently dropped. Every tool call receives an empty dict {} instead of the actual arguments, causing pydantic validation failures on any tool with required parameters.

This affects ALL Bedrock models using native function calling (Claude, Llama, etc.) via the native tool loop code path.

Root Cause

In _parse_native_tool_call (crew_agent_executor.py), the dict-format branch has a truthy default:

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

Bedrock Converse API returns {name, input, toolUseId}no "function" key.

So func_info is {}, and func_info.get("arguments", "{}") returns the default "{}" — a truthy string. The or short-circuits and tool_call.get("input", {}) is never evaluated.

Fix

Remove the default so get() returns None (falsy), allowing the or to fall through:

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

Verification

Bedrock format: {"name": "search_tool", "input": {"search_query": "hello"}, "toolUseId": "abc"}
OLD: func_info.get("arguments", "{}") → "{}" (truthy!) → short-circuits → broken
NEW: func_info.get("arguments") → None (falsy) → falls through to tool_call["input"] ✓

OpenAI format: {"function": {"name": "t", "arguments": "{"x": 1}"}}
NEW: func_info.get("arguments") → "{"x": 1}" (truthy) → same as before ✓

Tests Added

  • test_parse_native_tool_call_bedrock_format — verifies Bedrock input dict is correctly extracted
  • test_parse_native_tool_call_openai_dict_format — verifies OpenAI format still works

Fixes #4972

Changed files

  • lib/crewai/src/crewai/agents/crew_agent_executor.py (modified, +1/-1)
  • lib/crewai/tests/agents/test_agent_executor.py (modified, +38/-0)

PR #4985: fix: preserve Bedrock Converse API tool arguments in _parse_native_tool_call

Description (problem / solution / changelog)

Fix

Fixes #4972

Problem

When using AWS Bedrock (Converse API) with native function calling, all tool arguments are silently dropped — every tool call receives an empty dict {} instead of actual arguments.

Root Cause

In _parse_native_tool_call, the dict-handling branch has:

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

Bedrock returns tool calls as {"name": "...", "input": {...}, "toolUseId": "..."} — no "function" key. So func_info is {}, and func_info.get("arguments", "{}") returns the default string "{}". Since "{}" is truthy, the or short-circuits and tool_call["input"] is never evaluated.

Fix

Remove the default value from .get("arguments") so it returns None when the key is absent, allowing the or to fall through to tool_call.get("input"):

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

Behavior by provider:

Providertool_call structureBefore fixAfter fix
OpenAI{"function": {"arguments": "{...}"}}"{...}""{...}"
Anthropic (direct){"input": {...}} (has attr)Handled earlierHandled earlier
Bedrock (dict){"name": "..", "input": {...}}"{}"{...}

Testing

The fix can be verified by running a crew with Bedrock and a tool that has required arguments. Before the fix, all tool calls fail with Field required [type=missing, input_value={}, input_type=dict]. After fix, arguments are correctly passed through.

Changed files

  • lib/crewai/src/crewai/agents/crew_agent_executor.py (modified, +1/-1)
RAW_BUFFERClick to expand / collapse

Description

When using AWS Bedrock as the LLM provider with native function calling, all tool arguments are silently dropped. Every tool call receives an empty dict {} instead of the actual arguments, causing pydantic validation failures on any tool with required parameters.

Steps to Reproduce

  1. Configure a crewai project with BedrockCompletion as the LLM (any Claude model via Converse API)
  2. Create a custom BaseTool with required arguments (e.g. a tool with search_query: str in its args_schema)
  3. Create a crew/agent that uses this tool
  4. Run the crew with kickoff() or kickoff_async() 5 .Observe that every tool call fails with Field required [type=missing, input_value={}, input_type=dict]

Expected behavior

The agent should pass the arguments from the Bedrock Converse API response (from the "input" field) to the tool. For example, if the LLM returns {"name": "my_tool", "input": {"search_query": "test"}, "toolUseId": "abc"}, the tool should receive search_query="test".

Screenshots/Code snippets

Error output (repeats every iteration until max iterations):

Tool 'search_in_user_knowledgebase' arguments validation failed: 1 validation error for SearchUserKnowledgebaseToolSchema search_query Field required [type=missing, input_value={}, input_type=dict] For further information visit https://errors.pydantic.dev/2.11/v/missing Expected arguments: {"search_query": {"description": "Mandatory semantic search query", "title": "Search Query", "type": "string"}} Required: ["search_query"] Bug location — crewai/agents/crew_agent_executor.py, method _parse_native_tool_call, dict handling branch:

func_info = tool_call.get("function", {}) func_args = func_info.get("arguments", "{}") or tool_call.get("input", {}) Bedrock returns {"name": "...", "input": {...}, "toolUseId": "..."} — no "function" key. So func_info is {}, and func_info.get("arguments", "{}") returns the default "{}" (a truthy string). The or short-circuits and tool_call["input"] is never read.

Operating System

macOS Monterey

Python Version

3.12

crewAI Version

1.11.0

crewAI Tools Version

1.11.0

Virtual Environment

Poetry

Evidence

Reproducing the bug in isolation:

func_info = {} # No "function" key in Bedrock format tool_call = {"name": "my_tool", "input": {"search_query": "test"}, "toolUseId": "abc"}

Current (broken):

func_args = func_info.get("arguments", "{}") or tool_call.get("input", {}) print(func_args) # "{}" — truthy default prevents fallthrough

Fixed:

func_args = func_info.get("arguments") or tool_call.get("input") or "{}" print(func_args) # {"search_query": "test"} — correct

Possible Solution

One-line fix in _parse_native_tool_call (line ~850 of crew_agent_executor.py):

Before (broken):

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

After (fixed):

func_args = func_info.get("arguments") or tool_call.get("input") or "{}" Remove the default "{}" from get("arguments", "{}") so it returns None (falsy) when the key is missing, allowing the or to correctly fall through to tool_call.get("input").

Additional context

This affects ALL Bedrock models using native function calling (the _ainvoke_loop_native_tools / _invoke_loop_native_tools code path). BedrockCompletion.supports_function_calling() returns True, so the native path is always used instead of ReAct when tools are present. The _is_tool_call_list method correctly detects Bedrock-style dicts (line 663-669), but _parse_native_tool_call fails to extract arguments from them. This was likely introduced when native function calling support was added, since the dict branch was written primarily for OpenAI-style {"function": {"name": "...", "arguments": "..."}} format.

extent analysis

Fix Plan

To fix the issue, update the _parse_native_tool_call method in crew_agent_executor.py to correctly extract arguments from Bedrock-style tool calls.

  • Replace the line:
func_args = func_info.get("arguments", "{}") or tool_call.get("input", {})

with:

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

This change removes the default `"

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The agent should pass the arguments from the Bedrock Converse API response (from the "input" field) to the tool. For example, if the LLM returns {"name": "my_tool", "input": {"search_query": "test"}, "toolUseId": "abc"}, the tool should receive search_query="test".

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

crewai - ✅(Solved) Fix [BUG] _parse_native_tool_call drops Bedrock Converse API tool arguments — always passes empty dict [4 pull requests, 2 comments, 3 participants]