crewai - ✅(Solved) Fix [BUG] AWS Bedrock tool calls extract empty arguments - uses wrong field name [5 pull requests, 6 comments, 6 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#4748Fetched 2026-04-08 00:40:27
View on GitHub
Comments
6
Participants
6
Timeline
38
Reactions
0
Timeline (top)
referenced ×17cross-referenced ×15commented ×5labeled ×1

CrewAI's tool argument extraction only checks OpenAI's function.arguments format and fails to extract Bedrock's input field, causing all tool calls from AWS Bedrock models to receive empty arguments {} regardless of what the LLM provides.

The bug is in crew_agent_executor.py line ~850 where the code uses:

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

Since .get("arguments", "{}") returns the string "{}" (not None), the or operator never evaluates the Bedrock input field.

Error Message

Root Cause

This bug affects only AWS Bedrock models. OpenAI and Ollama models work correctly because they use the function.arguments format.

Fix Action

Fixed

PR fix notes

PR #4750: fix: Bedrock tool calls extract empty arguments - uses wrong field name (#4748)

Description (problem / solution / changelog)

Summary

Fixes #4748 — AWS Bedrock tool calls always received empty arguments {} regardless of what the LLM provided.

Root cause: In _parse_native_tool_call (line 850 of crew_agent_executor.py), the expression:

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

The default value "{}" is a truthy string, so Python's or short-circuits and never evaluates the Bedrock input field.

Fix: Remove the default values so None (falsy) is returned when the key is absent, allowing the or chain to fall through correctly:

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

This matches the already-correct pattern in extract_tool_call_info in agent_utils.py (line 1155).

Review & Testing Checklist for Human

  • Verify the one-line fix doesn't regress OpenAI-format tool calls — when func_info["arguments"] is a valid JSON string, it should still be returned directly (truthy string passes through or correctly)
  • Consider edge case: if func_info["arguments"] is an empty string "", the old code returned "{}" while the new code falls through to input. Confirm this is acceptable (empty string arguments are arguably malformed)
  • Ideally validate with an actual Bedrock model (e.g. us.amazon.nova-pro-v1:0) that tool arguments now arrive correctly

Notes

  • The companion function extract_tool_call_info in agent_utils.py already used the correct pattern — only the _parse_native_tool_call method in CrewAgentExecutor had the bug. Tests were added for both.
  • 15 new unit tests added across two test files covering OpenAI, Bedrock, Anthropic, and edge-case formats.
  • Requested by: João
  • Link to Devin session
<!-- CURSOR_SUMMARY -->

[!NOTE] Medium Risk Touches native tool-call parsing in CrewAgentExecutor, which can affect tool execution inputs across providers; however the change is small and covered by new regression/unit tests.

Overview Fixes a bug in CrewAgentExecutor._parse_native_tool_call where missing function.arguments defaulted to the truthy string "{}", preventing fallback to Bedrock-style input and causing empty tool arguments.

Adds regression/unit coverage for _parse_native_tool_call and extract_tool_call_info across OpenAI/Bedrock/Anthropic-style tool call shapes, plus minor test file cleanup.

<sup>Written by Cursor Bugbot for commit 9900a7954699bff30fc46c0ace457428702e64ca. This will update automatically on new commits. Configure here.</sup>

<!-- /CURSOR_SUMMARY -->

Changed files

  • lib/crewai/src/crewai/agents/crew_agent_executor.py (modified, +1/-1)
  • lib/crewai/tests/agents/test_async_agent_executor.py (modified, +92/-1)
  • lib/crewai/tests/utilities/test_agent_utils.py (modified, +130/-0)

PR #4764: fix(bedrock): extract tool arguments from Bedrock's input field

Description (problem / solution / changelog)

Problem

AWS Bedrock tool calls always receive empty arguments {} regardless of what the LLM provides. This affects all Bedrock models (Nova Pro, Nova Lite, Claude via Bedrock, etc.).

Bedrock tool call format:

{"toolUseId": "tooluse_abc", "name": "search_tool", "input": {"query": "AWS Bedrock features"}}

OpenAI tool call format:

{"id": "call_xyz", "function": {"name": "search_tool", "arguments": '{"query": "test"}'}}

Root Cause

In _parse_native_tool_call (line 850):

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

When func_info (from tool_call.get("function", {})) is an empty dict (Bedrock has no function key), .get("arguments", "{}") returns the default string "{}". Since "{}" is truthy, the or operator never evaluates tool_call.get("input").

Result: Bedrock's actual arguments in input are silently dropped.

Fix

Use None as the sentinel so or falls through correctly:

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

Verified Locally

=== Bedrock tool call ===
OLD CODE: '{}'       <-- BUG: returns empty string instead of args
NEW CODE: {'query': 'AWS Bedrock features'}  <-- FIXED: returns actual args

=== OpenAI tool call (regression) ===
OLD CODE: '{"query": "test"}'
NEW CODE: '{"query": "test"}'
MATCH: True          <-- No regression

Tests

Added 7 unit tests covering:

  • Bedrock dict with input field (the reported bug)
  • OpenAI dict with function.arguments (regression)
  • Bedrock dict without function key
  • Empty input dict
  • Neither function nor input (fallback)
  • OpenAI-style object with .function attribute
  • Bedrock-style object with .name and .input attributes

All pass.

Fixes #4748

<!-- CURSOR_SUMMARY -->

[!NOTE] Low Risk Low risk bugfix limited to native tool-call argument extraction; main risk is subtle behavior changes for dict-style tool calls when function.arguments is missing/empty, but new tests cover expected formats.

Overview Fixes _parse_native_tool_call to correctly extract tool arguments from AWS Bedrock-style tool calls by falling back to the dict’s input field when function.arguments is absent.

Adds focused unit tests covering Bedrock dict/object tool calls, OpenAI regression cases, and fallback behavior when no arguments are provided.

<sup>Written by Cursor Bugbot for commit 310f000b4f34699934e5352be4b06ded899fa7bc. This will update automatically on new commits. Configure here.</sup>

<!-- /CURSOR_SUMMARY -->

Changed files

  • lib/crewai/src/crewai/agents/crew_agent_executor.py (modified, +5/-1)
  • lib/crewai/tests/agents/test_bedrock_tool_args.py (added, +168/-0)

PR #4765: fix: extract Bedrock tool arguments from 'input' field correctly

Description (problem / solution / changelog)

Problem

When using AWS Bedrock models, all tool calls receive empty arguments {} regardless of what the LLM provides.

The bug is in crew_agent_executor.py:

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

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

Solution

Use a sentinel object to distinguish "key absent" from "key is empty string". Only fall back to Bedrock's input field when no valid OpenAI-style arguments are present.

Fixes #4748

<!-- CURSOR_SUMMARY -->

[!NOTE] Low Risk Low risk, small change isolated to native tool-call parsing; behavior only differs when OpenAI-style function.arguments is absent/empty, enabling Bedrock input to be used instead.

Overview Fixes native tool-call argument extraction for Bedrock-style responses so tools receive the actual payload from the input field when OpenAI-style function.arguments is missing or effectively empty.

Updates _parse_native_tool_call to use a sentinel to distinguish “key absent” from default '{}', preventing the previous truthy default from masking Bedrock arguments.

<sup>Written by Cursor Bugbot for commit 08a1c00f221ac7d4fd89befbf31ae39c74346855. This will update automatically on new commits. Configure here.</sup>

<!-- /CURSOR_SUMMARY -->

Changed files

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

PR #4769: fix: extract Bedrock tool arguments from input field

Description (problem / solution / changelog)

Summary

Fixes #4748.

When using AWS Bedrock models, tool calls always receive empty arguments {} because the fallback to Bedrock's input field never executes.

Root cause: func_info.get("arguments", "{}") returns the string "{}" (truthy) when no arguments key exists, so the or branch for tool_call.get("input", {}) is never evaluated.

Fix

# 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", "{}")

Using None as the default for get("arguments") makes the or fallback work correctly. The "{}" default is moved to the Bedrock input fallback as the final default.

lib/crewai/src/crewai/agents/crew_agent_executor.py line 850 — one-line fix.

<!-- CURSOR_SUMMARY -->

[!NOTE] Low Risk Very small, isolated change to native tool-call parsing; risk is limited to how tool arguments are extracted for dict-style (Bedrock) tool calls.

Overview Fixes native tool-call argument extraction for Bedrock-style responses by changing _parse_native_tool_call to only use function.arguments when it exists, otherwise falling back to the tool call’s input field (defaulting to the JSON string {}). This prevents missing arguments from incorrectly short-circuiting the fallback and producing empty tool args.

<sup>Written by Cursor Bugbot for commit fd59c902c1270f57e3c0ed220b52733280f2f77e. This will update automatically on new commits. Configure here.</sup>

<!-- /CURSOR_SUMMARY -->

Changed files

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

PR #4803: fix: extract Bedrock tool arguments from input field correctly

Description (problem / solution / changelog)

Summary

Fixes #4748 - AWS Bedrock tool calls extract empty arguments due to wrong default value in get().

All AWS Bedrock models (Nova Pro, Nova Lite, Claude via Bedrock, etc.) receive empty {} arguments for every tool call, regardless of what the LLM actually provides. This causes tools to fail or return incorrect results.

Root cause

In CrewAgentExecutor._parse_native_tool_call() (line 850):

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

func_info.get("arguments", "{}") returns the string "{}" when "arguments" is absent (Bedrock format). Since "{}" is truthy, Python's or operator never evaluates tool_call.get("input", {}), which is where Bedrock stores its arguments.

The correct pattern already exists in utilities/agent_utils.py line 1155:

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

Fix

One-line change: remove the default value "{}" from get("arguments") so it returns None when absent, allowing the or-chain to fall through to Bedrock's "input" field:

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

Test plan

  • Verify Bedrock tool call format {"name": "search_tool", "input": {"query": "test"}} correctly extracts arguments
  • Verify OpenAI tool call format {"function": {"name": "search_tool", "arguments": {"query": "test"}}} still works
  • Verify empty tool calls (no arguments in either format) default to {}
  • Run existing test suite: pytest lib/crewai/tests/agents/

🤖 Generated with Claude Code

<!-- CURSOR_SUMMARY -->

[!NOTE] Medium Risk Touches core tool-call argument extraction used during agent execution; while the change is small and targeted, it can affect tool invocation behavior across providers when arguments is absent or empty.

Overview Fixes native tool-call parsing for dict-based providers (notably AWS Bedrock) by no longer defaulting missing function.arguments to the truthy string "{}", allowing _parse_native_tool_call() to fall through to tool_call["input"] and correctly pass real tool arguments.

This changes the default behavior for tool calls with no provided args to return an empty dict ({}) rather than a stringified empty object, improving consistency across provider formats.

<sup>Written by Cursor Bugbot for commit 4d8f15f4284bcfa659f486cb404bca8b716f9be0. This will update automatically on new commits. Configure here.</sup>

<!-- /CURSOR_SUMMARY -->

Changed files

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

Code Example

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

---

from crewai import Agent, Task, Crew
from crewai.tools import tool

@tool("search_tool")
def search_tool(query: str) -> str:
    """Search for information."""
    return f"Searched for: {query}"

agent = Agent(
    role="Researcher",
    goal="Search for information",
    backstory="Expert researcher",
    tools=[search_tool],
    llm="bedrock/us.amazon.nova-pro-v1:0"
)

task = Task(
    description="Search for 'AWS Bedrock features'",
    expected_output="Search results",
    agent=agent
)

crew = Crew(agents=[agent], tasks=[task])
result = crew.kickoff()

---

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

---

{
    "name": "search_tool",
    "input": {"query": "AWS Bedrock features"}  # ← This field is never extracted
}

---

{
    "function": {
        "name": "search_tool",
        "arguments": {"query": "test"}  # ← This works
    }
}

---

# Bedrock uses "input" directly, OpenAI uses "function.arguments"
if "function" in tool_call and "arguments" in func_info:
    func_args = func_info["arguments"]
elif "input" in tool_call:
    func_args = tool_call["input"]
else:
    func_args = {}

# Ensure it's a dict
if isinstance(func_args, str):
    func_args = json.loads(func_args)
RAW_BUFFERClick to expand / collapse

Description

CrewAI's tool argument extraction only checks OpenAI's function.arguments format and fails to extract Bedrock's input field, causing all tool calls from AWS Bedrock models to receive empty arguments {} regardless of what the LLM provides.

The bug is in crew_agent_executor.py line ~850 where the code uses:

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

Since .get("arguments", "{}") returns the string "{}" (not None), the or operator never evaluates the Bedrock input field.

Steps to Reproduce

  1. Configure CrewAI to use an AWS Bedrock model (e.g., us.amazon.nova-pro-v1:0)
  2. Create an agent with a tool that requires parameters:
from crewai import Agent, Task, Crew
from crewai.tools import tool

@tool("search_tool")
def search_tool(query: str) -> str:
    """Search for information."""
    return f"Searched for: {query}"

agent = Agent(
    role="Researcher",
    goal="Search for information",
    backstory="Expert researcher",
    tools=[search_tool],
    llm="bedrock/us.amazon.nova-pro-v1:0"
)

task = Task(
    description="Search for 'AWS Bedrock features'",
    expected_output="Search results",
    agent=agent
)

crew = Crew(agents=[agent], tasks=[task])
result = crew.kickoff()
  1. Observe that the tool receives empty arguments {} instead of {"query": "AWS Bedrock features"}
  2. Tool fails or returns incorrect results

Expected behavior

Tool should receive the arguments that the Bedrock model provides in the input field: {"query": "AWS Bedrock features"}

Screenshots/Code snippets

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

Bedrock tool call format:

{
    "name": "search_tool",
    "input": {"query": "AWS Bedrock features"}  # ← This field is never extracted
}

OpenAI tool call format:

{
    "function": {
        "name": "search_tool",
        "arguments": {"query": "test"}  # ← This works
    }
}

Operating System

Other (specify in additional context)

Python Version

3.12

crewAI Version

1.10.1 - commit 87759cdb from main branch

crewAI Tools Version

N/A

Virtual Environment

Venv

Evidence

AWS Bedrock API Documentation:

Affected Models:

  • All AWS Bedrock models: Nova Pro, Nova Lite, Nova Micro
  • Claude models via Bedrock: Claude Opus 4.5, Claude Sonnet 3.5, etc.
  • Any model accessed through Bedrock's Converse API

Possible Solution

Replace the argument extraction logic in crew_agent_executor.py (~line 850):

# Bedrock uses "input" directly, OpenAI uses "function.arguments"
if "function" in tool_call and "arguments" in func_info:
    func_args = func_info["arguments"]
elif "input" in tool_call:
    func_args = tool_call["input"]
else:
    func_args = {}

# Ensure it's a dict
if isinstance(func_args, str):
    func_args = json.loads(func_args)

This explicitly checks for both formats instead of relying on or operator short-circuit behavior.

Additional context

O/S is MacOS Tahoe 26.3.1

This bug affects only AWS Bedrock models. OpenAI and Ollama models work correctly because they use the function.arguments format.

The bug has been independently discovered by multiple frameworks:

All stem from not properly handling Bedrock's specific message format.

extent analysis

Fix Plan

To fix the issue, replace the argument extraction logic in crew_agent_executor.py (~line 850) with the following code:

import json

# Bedrock uses "input" directly, OpenAI uses "function.arguments"
if "function" in tool_call and "arguments" in func_info:
    func_args = func_info["arguments"]
elif "input" in tool_call:
    func_args = tool_call["input"]
else:
    func_args = {}

# Ensure it's a dict
if isinstance(func_args, str):
    func_args = json.loads(func_args)

This code explicitly checks for both Bedrock and OpenAI formats, ensuring that the input field is extracted correctly.

Verification

To verify that the fix worked, follow these steps:

  • Configure CrewAI to use an AWS Bedrock model.
  • Create an agent with a tool that requires parameters.
  • Run the agent and observe that the tool receives the correct arguments.
  • Test with different Bedrock models and tools to ensure the fix is working as expected.

Extra Tips

  • Make sure to update the crew_agent_executor.py file with the new code.
  • If you're using a virtual environment, ensure that the changes are reflected in the virtual environment.
  • Consider adding tests to ensure that the fix is working correctly and to prevent regressions in the future.
  • If you encounter any issues or have questions, refer to the AWS Bedrock API documentation and the CrewAI documentation for more information.

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

Tool should receive the arguments that the Bedrock model provides in the input field: {"query": "AWS Bedrock features"}

Still need to ship something?

×6

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

Back to top recommendations

TRENDING