Port the Bedrock toolUse arg-extraction patch from seller-agent - #116
Open
aleksUIX wants to merge 1 commit into
Open
Port the Bedrock toolUse arg-extraction patch from seller-agent#116aleksUIX wants to merge 1 commit into
aleksUIX wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
patches/crewai_bedrock_fix.pyhas 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'sCrewAgentExecutor._parse_native_tool_calldoesfunc_info.get("arguments", "{}")returns the truthy default string"{}", so theornever reachestool_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.