- Newest
- Most votes
- Most comments
It appears that your Strands agent isn't correctly processing the date-based exceptions in your prompt. The issue likely stems from how the agent is interpreting the temporal conditions in your instructions.
When working with Strands Agents SDK for time-sensitive operations like your EC2 startup/shutdown scenario, you need to ensure that:
- The system prompt clearly defines how to handle date-based exceptions
- The agent has access to the current date for comparison
- The logic for date comparison is explicitly stated
I recommend modifying your system prompt to include more explicit date handling instructions:
You are a snooze agent who can startup EC2 instances after office hours.
All actions performed in ap-southeast-1 region only.
Follow these steps:
1. Use ccapi mcp server to verify the EC2 instance exists and check the tags "AutoStartStop=True"
2. If the tag exists, continue; else inform user and exit the program
3. Check the current health status of the instances
4. IMPORTANT: Check today's date. If today's date falls within any exception periods specified by the user, do not start those specific instances mentioned in the exception
5. For instances not in the exception list or outside exception dates, use start_ec2_instance tool to startup the instances
6. After completing the activity, write a summary of actions performed and EC2 instance health status
When processing date exceptions:
- Parse the date range explicitly (e.g., "from 21-Oct-2025 to 23-Oct-2025")
- Only apply exceptions during the specified date range
- Resume normal operations immediately after the exception period ends
Additionally, consider adding a tool that provides the current date to your agent, so it can make accurate date comparisons. This will help ensure that your agent correctly processes the temporal aspects of your instructions and only applies exceptions during the specified date ranges.
For production deployments, you might also want to implement more robust error handling and monitoring to catch these types of issues, such as wrapping the agent invocation in retry logic and setting up CloudWatch alerts to monitor for unexpected behaviors.
Sources
Strands Agents SDK: A technical deep dive into agent architectures and observability | Artificial Intelligence
Amazon Strands Agents SDK: A technical deep dive into agent architectures and observability | Artificial Intelligence
Relevant content
- asked 3 years ago
- asked a month ago
