aws-samples / aws-samples/sample-strands-chaos-engineering-agents
AWS Resource Analysis Agent defaults to us-east-1 region instead of using get_aws_region() tool
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13
- Forks
- 2
- Avg merge
- 43m
- Merged PRs (30d)
- 1
Description
Issue Description:
The AWS Resource Analysis Agent is hardcoded to use us-east-1 region instead of dynamically detecting the correct region, causing it to fail when AWS resources are deployed in other regions.
Problem:
• The aws_resource_analysis_agent uses the use_aws tool but doesn't have access to get_aws_region()
• This causes it to fall back to the default us-east-1 region
• Results in ResourceNotFoundException when actual resources are in different regions (e.g., us-west-2)
• Hypothesis generation fails with "No EKS or EKS Clusters Discovered" even when clusters exist
Root Cause:
The AWS Resource Analysis Agent is missing get_aws_region from its tools list, preventing it from using the centralized region configuration.
Files to Update:
-
assets/src/HypothesisGeneratorAgent/agents/aws_resource_analysis/agent.py
• Add import: from shared.config import get_small_model, get_aws_region
• Add get_aws_region to the tools list in the Agent constructor -
assets/src/shared/config.py (already fixed)
• Ensure get_aws_region() function has @tool decorator
Code Changes:
python
In aws_resource_analysis/agent.py
from shared.config import get_small_model, get_aws_region # Add get_aws_region import
Add get_aws_region to tools list:
agent = Agent(
model=get_small_model(),
tools=[
use_aws,
shell,
get_aws_region, # Add this line
insert_resource_analysis,
get_workload_tags,
get_source_analysis,
get_deployed_resources
],
system_prompt=SYSTEM_PROMPT,
callback_handler=get_callback("aws-resource-analysis")
)
Expected Behavior:
The agent should dynamically detect the correct AWS region and discover resources in that region instead of defaulting to us-east-1.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in assets/src/HypothesisGeneratorAgent/agents/aws_resource_analysis/agent.py and inspect the Agent constructor and its imports. Confirm that assets/src/shared/config.py exposes get_aws_region() as a tool, then verify the agent can use the configured region rather than defaulting to us-east-1. Done means resources in regions such as us-west-2 are discoverable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100