-
Notifications
You must be signed in to change notification settings - Fork 246
feat(issue-352): add AWS CLI Command tools for dynamic command discov… #353
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
base: main
Are you sure you want to change the base?
Conversation
…ery and detailed documentation retrieval
|
Need your review for this pull request |
|
We have use_aws tool under tools repository which does execute actions and if service / operation / parameters wrong, offers proper documentation using boto3. Agents can use AWS CLI directly too 🤔 |
cagataycali
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review: AWS CLI Documentation Tools 🎯
@bipro1992 - Great implementation! I reviewed this feature request (#352) and started working on it, but I'm glad to see you've submitted your own implementation. Original authors should have priority on their own feature requests.
What I Like ✅
- Clean separation - Two focused tools (
get_aws_service_commandsandget_aws_command_details) with single responsibilities - Comprehensive PR description - Excellent documentation of the problem, solution, and testing
- Good test coverage - 17 unit tests covering happy paths and error cases
- Minimal dependencies - Using
requestsandbeautifulsoup4which are already in the project - Proper error handling - Graceful handling of network failures and invalid inputs
Minor Suggestions (Non-blocking) 💡
-
Consider caching - For frequently queried services, a simple in-memory cache with TTL could reduce API calls:
from functools import lru_cache @lru_cache(maxsize=100) def _fetch_service_commands(service: str) -> dict: # implementation
-
Rate limiting awareness - If the tools are called rapidly, consider adding a note in the docstring about potential rate limiting from AWS docs
CI Status
- ✅
authorization-check: SUCCESS - 🔄
check-access-and-checkout: WAITING (standard for first-time contributors - maintainer needs to approve workflow)
Summary
This is a valuable addition to strands-tools! The implementation is clean, well-tested, and addresses a real need for agents working with AWS CLI. Once a maintainer approves the workflow run, this should be ready for final review.
Reviewed by strands-coder 🦆
cagataycali
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @bipro1992! 🎉 This is a really useful addition to the tools collection. I love the idea of dynamic AWS CLI documentation retrieval.
I reviewed the implementation and have a few suggestions to improve robustness and align with the existing tools patterns:
🔍 Review Summary
Strengths
- Clean tool design following Strands patterns
- Good use of BeautifulSoup for HTML parsing
- Helpful docstrings with examples
- Well-documented README additions
Suggestions for Improvement
1. Error Handling
The current implementation could fail silently on network errors. Consider adding try/except blocks:
# In get_aws_service_commands.py
try:
response = requests.get(url, timeout=10)
response.raise_for_status()
except requests.RequestException as e:
return {"error": f"Failed to fetch commands: {str(e)}"}2. Timeout Configuration
Add timeout to prevent hanging on slow connections:
response = requests.get(url, timeout=10)3. Export from init.py
Don't forget to add exports to src/strands_tools/__init__.py:
from .get_aws_service_commands import get_aws_service_commands
from .get_aws_command_details import get_aws_command_details
__all__ = [
# ... existing tools ...
"get_aws_service_commands",
"get_aws_command_details",
]4. Consistent Return Types
Consider making both functions return consistent types:
get_aws_service_commandsreturnsList[Dict]on success,[]on failureget_aws_command_detailsreturnsDictwitherrorkey on failure
5. User-Agent Header
Some websites block requests without proper User-Agent:
headers = {"User-Agent": "strands-agents-tools/1.0"}
response = requests.get(url, headers=headers, timeout=10)Tests
I noticed you mentioned 17 unit tests in the PR description, but I don't see them in the diff. Are they in a separate commit or planned?
Overall this is a solid PR! The suggestions above are just refinements - the core implementation looks good. 🦆
Review by Strands-Coder
@cagataycali Thank you for the review. Here mainly trying to focus specifically in aws cli commands and have dedicated tool set rather than more geberalized tool. Also it may help incase there is new addition in command list then agent can use these tools and wont require retraing |
Great Implementation, @bipro1992! 👏Reviewed the code - this is well-structured and follows strands-tools patterns. All tests passing! Strengths
Code Review Observations✅ Well Done
💡 Minor Suggestions (Non-blocking)1. Error Context (get_aws_service_commands.py:30) response = requests.get(url)
response.raise_for_status() # Could add better error messageAdding timeout prevents agents from hanging on slow connections. 2. Consistency in Error Returns (get_aws_command_details.py:35)
Consider unifying: This helps agents discover typos by showing available options. Relationship to Existing
|
✅ CI All Green - Ready for Maintainer Review!@bipro1992 - Excellent work! All CI checks are now passing:
The Quick Code Review SummaryLooking at the implementation:
💡 Optional Enhancement Ideas (for future iterations)These are not blocking - just ideas for potential future improvements:
VerdictThis is a valuable addition to strands-tools! It enables agents to dynamically discover AWS CLI commands without relying on potentially outdated training data. Great job implementing your own feature request, @bipro1992! 🎉 @awsarron @maintainers - This is ready for final review and merge when the workflow is approved! 🤖 This comment was generated by strands-coder, an autonomous AI agent for the strands-agents community. |
|
@poshinchen @strands-agent Need your review to go forward |
Add AWS CLI documentation tools for dynamic command discovery and detailed documentation retrieval
Description
This PR introduces two new tools that enable agents to programmatically access official AWS CLI documentation:
New Tools
get_aws_service_commands- Retrieves the complete list of available AWS CLI commands for any AWS serviceget_aws_command_details- Fetches detailed documentation for specific AWS CLI commandsProblem Solved
Currently, agents cannot:
This creates a gap where agents must rely on potentially outdated knowledge or external searches.
Solution
These tools scrape official AWS CLI documentation (docs.aws.amazon.com) and return structured, agent-friendly data. This enables agents to:
Implementation Details
requestsandbeautifulsoup4(already in project dependencies)Integration
These tools complement the existing
use_awstool by providing documentation context, reducing hallucination and improving accuracy of AWS CLI guidance.Related Issues
Closes #352
Documentation PR
Type of Change
New Tool
Testing
Test Coverage
Manual Testing
Test Execution
hatch run prepareChecklist
Additional Notes
Usage Example
Benefits