crewAIInc / crewAIInc/crewAI

[BUG] native tool calls crash when arguments JSON is not an object

Open Beginner friendly
#7,536 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
58.8k
Forks
8.5k
Avg merge
1d 15h
Merged PRs (30d)
109

Description

Description

parse_tool_call_args JSON-decodes string arguments and returns whatever type json.loads produced. A JSON array, string, or number is not a mapping, so later fn(**args) raises TypeError. Bedrock streaming already coerces non-dict JSON to a dict. Native tool calls do not.

Steps to Reproduce
from crewai.utilities.agent_utils import parse_tool_call_args

args, error = parse_tool_call_args('["oops"]', "get_weather", "call_1")
print(args, error)
# later: fn(**args)
Expected behavior

Non-object JSON is treated as invalid input and returns an error result, not a list.

Screenshots/Code snippets

TypeError: dict argument ... when expanding a list into keyword arguments.

Operating System

Windows 11

Python Version

3.12

crewAI Version

main

Additional context

Native tool execution in agent_utils uses the parsed value as kwargs.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in crewai/utilities/agent_utils.py at parse_tool_call_args and compare its handling with the Bedrock streaming coercion described in the issue. Reproduce the array-argument case, then verify that non-object JSON produces an error result rather than a value later passed as keyword arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.