Skip to content

Port the Bedrock toolUse arg-extraction patch from seller-agent - #116

Open
aleksUIX wants to merge 1 commit into
IABTechLab:mainfrom
aleksUIX:fix/port-bedrock-arg-extraction-patch
Open

Port the Bedrock toolUse arg-extraction patch from seller-agent#116
aleksUIX wants to merge 1 commit into
IABTechLab:mainfrom
aleksUIX:fix/port-bedrock-arg-extraction-patch

Conversation

@aleksUIX

Copy link
Copy Markdown
Contributor

Problem

patches/crewai_bedrock_fix.py has drifted between buyer-agent and seller-agent, and each repo is missing the other's fix. The one buyer-agent lacks: seller's _patch_parse_native_tool_call. CrewAI's CrewAgentExecutor._parse_native_tool_call does

func_info = tool_call.get("function", {})            # {} for Bedrock-format dicts
func_args = func_info.get("arguments", "{}") or tool_call.get("input", {})

func_info.get("arguments", "{}") returns the truthy default string "{}", so the or never reaches tool_call.get("input"). On Bedrock Converse, every native tool call therefore executes with empty arguments.

Change

Ports seller-agent's patch verbatim (the Bedrock-format dict is handled directly, falling through to the original parser otherwise) and registers it in apply_patches(). The file is now byte-identical with the seller-agent copy, at the union of both repos' fixes; a matching PR to seller-agent ports buyer's surgical toolResult stripping in the other direction, so the two copies stay in sync. One docstring bullet updated to describe the surgical-strip behavior accurately.

Verification

Ran against installed crewai: both patches apply cleanly, the patched parser returns {"product_id": "p-1"} for a Bedrock-format toolUse dict where the unpatched path yields "{}", and the sanitizer keeps matched toolResult blocks while stripping only orphans.

patches/crewai_bedrock_fix.py has drifted between the two agent repos.
seller-agent carries _patch_parse_native_tool_call, which fixes
CrewAgentExecutor._parse_native_tool_call dropping Bedrock tool
arguments: func_info.get("arguments", "{}") returns the truthy default
string, so the or-chain never reaches tool_call.get("input") and every
tool runs with empty args. buyer-agent lacked that fix.

This ports it verbatim and brings the file to the union of both repos'
fixes, byte-identical with the seller-agent copy (a matching PR ports
buyer's surgical toolResult stripping there). Also documents the
surgical-strip behavior in the sanitizer docstring.
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.

1 participant