fix(swarm): pass actual tool objects instead of tool name strings to sub-agents #164
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.
Description
Fixed a critical bug in the swarm tool where sub-agents were receiving tool names as strings instead of actual tool objects from the parent agent's registry. This caused sub-agents to treat tool names like "shell" and "editor" as file paths, attempting to load files like
./shell.pyand resulting in "Tool file not found" errors.The fix modifies
_create_custom_agents()to properly retrieve actual tool objects fromparent_agent.tool_registry.registryinstead of passing tool name strings, ensuring sub-agents receive functional tool instances.Thanks for reporting: @westonbrown
Related Issues
Addresses bug reported by Aaron Brown regarding swarm sub-agents being unable to use tools due to incorrect tool object passing.
Documentation PR
[Link to related associated PR in the agent-docs repo - if needed]
Type of Change
Testing
The change has been thoroughly tested with:
hatch fmt --linter✅hatch fmt --formatter✅hatch test --all✅Added comprehensive unit test
test_create_agents_tool_objects_retrieval()that verifies:Checklist
I have read the CONTRIBUTING document
I have added tests that prove my fix is effective or my feature works
I have updated the documentation accordingly
I have added an appropriate example to the documentation to outline the feature
My changes generate no new warnings
Any dependent changes have been merged and published
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.