generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 192
Feature: tool pass-through in use_llm and think tools #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cagataycali
merged 11 commits into
strands-agents:main
from
cagataycali:feat/tool-filtering-meta-tools
Jun 9, 2025
Merged
Feature: tool pass-through in use_llm and think tools #72
cagataycali
merged 11 commits into
strands-agents:main
from
cagataycali:feat/tool-filtering-meta-tools
Jun 9, 2025
Conversation
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
This commit enhances multiple tool components to better work together: - feat(think): inherit parent agent's traces and tools to maintain context - fix(load_tool): remove unnecessary hot_reload_tools dependency check - fix(use_llm): properly pass trace_attributes from parent agent to new instances - style(mem0_memory): improve code formatting and readability - test: update tests to match new implementation patterns
…-agents#19) Mock os.environ for test_environment by using a fixture, eliminating the need to worry about the real os environment. Properly mock the get_user_input function by using a fixture as well and having environment import user_input as a module rather than importing the function directly. This is the more an important change as previously the user input wasn't being mocked in the tests - all tests were passing as the code paths didn't actually need "y". Co-authored-by: Mackenzie Zastrow <[email protected]>
- Add 'tools' parameter to use_llm and think functions for parent tool filtering - Implement tool registry filtering to prevent infinite recursion - Allow parent agents to specify subset of tools for child agents - Add comprehensive tests for tool filtering scenarios - Update documentation with tool filtering examples - Fix infinite recursion issue when use_llm calls use_llm or think calls think This enhancement allows better control over meta-tool capabilities and prevents recursive loops while maintaining backward compatibility.
Closed
10 tasks
dbschmigelski
approved these changes
Jun 9, 2025
jimbrub
pushed a commit
to jimbrub/tools
that referenced
this pull request
Jun 23, 2025
) * chore: bump version from 0.1.0 to 0.1.1 * fix: improve tool interoperability and remove dependencies This commit enhances multiple tool components to better work together: - feat(think): inherit parent agent's traces and tools to maintain context - fix(load_tool): remove unnecessary hot_reload_tools dependency check - fix(use_llm): properly pass trace_attributes from parent agent to new instances - style(mem0_memory): improve code formatting and readability - test: update tests to match new implementation patterns * fix(slack): add missing trace_attributes to Agent initialization * docs(memory): update examples to use agent.tool.memory syntax * fix: Rewrite environment tests to properly mock dependencies (strands-agents#19) Mock os.environ for test_environment by using a fixture, eliminating the need to worry about the real os environment. Properly mock the get_user_input function by using a fixture as well and having environment import user_input as a module rather than importing the function directly. This is the more an important change as previously the user input wasn't being mocked in the tests - all tests were passing as the code paths didn't actually need "y". Co-authored-by: Mackenzie Zastrow <[email protected]> * feat: add tool filtering to use_llm and think meta-tools - Add 'tools' parameter to use_llm and think functions for parent tool filtering - Implement tool registry filtering to prevent infinite recursion - Allow parent agents to specify subset of tools for child agents - Add comprehensive tests for tool filtering scenarios - Update documentation with tool filtering examples - Fix infinite recursion issue when use_llm calls use_llm or think calls think This enhancement allows better control over meta-tool capabilities and prevents recursive loops while maintaining backward compatibility. --------- Co-authored-by: Cagatay Cali <[email protected]> Co-authored-by: Mackenzie Zastrow <[email protected]> Co-authored-by: Mackenzie Zastrow <[email protected]> Co-authored-by: Strands Agent <[email protected]>
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.
Description
This PR introduces tool filtering capabilities to the
use_llmandthinkmeta-tools, enabling parent agents to specify precise subsets of tools for child agents. This enhancement solves a critical infinite recursion issue and provides fine-grained control over meta-tool capabilities.Note: "tools" parameter will be extended to support additional tool loading in future pull requests.
Issue: #73
🎯 Key Enhancements
1. Tool Filtering Parameter
toolsparameter to bothuse_llmandthinkfunctionstoolsparameter inherits all parent tools2. Infinite Recursion Prevention 🛡️
use_llmcallinguse_llmorthinkcallingthinkcaused infinite loops["calculator", "file_read"]instead of all tools includinguse_llm3. Smart Tool Registry Filtering
4. Enhanced Documentation & Examples
🔧 Implementation Details
Tool Registry Integration
Function Signatures Enhanced
use_llm: Addedtools: list = Noneparameterthink: Addedtools: list = Noneparameter🎮 Usage Examples
Preventing Infinite Recursion
Specialized Agent Creation
Meta-Tool Development Safety
Related Issues
Documentation PR
Documentation will be updated to include:
Type of Change
Testing
🧪 Comprehensive Test Coverage
test_think.pyandtest_use_llm.py📋 Test Scenarios Covered
Tool Filtering Tests
Manual Testing Results
✅ Tested with actual agent script (
/Users/cagatay/tools/test.py):Pre-commit Validation
hatch fmt --linter- All code passes lintinghatch fmt --formatter- Code formatting validatedhatch test --all- All existing and new tests passIntegration Testing
🔍 Edge Cases Tested
Checklist
🚀 Additional Quality Assurance
🌟 Impact & Benefits
For Developers
For Agent Systems
For Production Use
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.