fix(batch): read invocations from tool input and fix concurrency error#439
Open
dosvk wants to merge 1 commit intostrands-agents:mainfrom
Open
fix(batch): read invocations from tool input and fix concurrency error#439dosvk wants to merge 1 commit intostrands-agents:mainfrom
dosvk wants to merge 1 commit intostrands-agents:mainfrom
Conversation
Fix two bugs preventing the batch tool from executing sub-tools: 1. Read invocations from tool['input']['invocations'] instead of kwargs, which only contains framework state (agent, model, etc.) and never the tool input parameters. 2. Pass record_direct_tool_call=False when calling sub-tools to avoid ConcurrencyException from the agent invocation lock that is already held by the batch tool execution. Update tests to pass invocations via tool['input'] to match the real SDK calling convention. Closes strands-agents#413
3 tasks
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.
Fix two bugs preventing the batch tool from executing sub-tools:
Read invocations from tool['input']['invocations'] instead of kwargs,
which only contains framework state (agent, model, etc.) and never
the tool input parameters.
Pass record_direct_tool_call=False when calling sub-tools to avoid
ConcurrencyException from the agent invocation lock that is already
held by the batch tool execution.
Update tests to pass invocations via tool['input'] to match the real
SDK calling convention.
Closes #413
Description
Fix two bugs in the batch tool that prevented any sub-tool execution.
Bug 1 (line 97):
kwargs.get("invocations", [])always returned empty becausemodule-based tools receive their inputs in the
tooldict, notkwargs. Fixedto
tool.get("input", {}).get("invocations", []).Bug 2 (line 112):
tool_fn(**arguments)raised ConcurrencyException becausethe agent invocation lock was already held. Fixed by passing
record_direct_tool_call=Falseto skip the lock and message recording.Related Issues
Closes #413
Documentation PR
N/A
Type of Change
Bug fix
Testing
Evidence
Before fix (batch returns 0 results, agent falls back to individual calls):
After fix (batch executes all sub-tools in one call):
hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.