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

Open
#4 0 comments 0 reactions 0 assignees View on GitHub

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:

  1. 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

  2. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.