Skip to content

Commit 979a1d7

Browse files
committed
Restructure infrastructure samples: rename to 04-infrastructure-as-code and organize CloudFormation templates
- Rename 04-cfn-samples to 04-infrastructure-as-code - Create cloudformation subfolder for better organization - Rename weather-agent-runtime to end-to-end-weather-agent - Rename weather agent template.yaml to end-to-end-weather-agent.yaml - Update all documentation and scripts to reflect new structure - Update main README with new paths and folder structure - All Python files pass ruff formatting checks
1 parent 359994b commit 979a1d7

File tree

24 files changed

+55
-91
lines changed

24 files changed

+55
-91
lines changed

04-cfn-samples/README.md renamed to 04-infrastructure-as-code/README.md

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ These CloudFormation templates enable you to:
1212

1313
## 📚 Available Samples
1414

15-
### 01. [Hosting MCP Server on AgentCore Runtime](./mcp-server-agentcore-runtime/)
15+
### 01. [Hosting MCP Server on AgentCore Runtime](./cloudformation/mcp-server-agentcore-runtime/)
1616

1717
Deploy a complete MCP (Model Context Protocol) server with automated Docker image building and JWT authentication.
1818

@@ -34,14 +34,14 @@ Deploy a complete MCP (Model Context Protocol) server with automated Docker imag
3434

3535
**Quick start:**
3636
```bash
37-
cd mcp-server-agentcore-runtime
37+
cd cloudformation/mcp-server-agentcore-runtime
3838
./deploy.sh
3939
./test.sh
4040
```
4141

4242
---
4343

44-
### 02. [Basic Agent Runtime](./basic-runtime/)
44+
### 02. [Basic Agent Runtime](./cloudformation/basic-runtime/)
4545

4646
Deploy a basic AgentCore Runtime with a simple Strands agent - no additional tools or memory.
4747

@@ -61,14 +61,14 @@ Deploy a basic AgentCore Runtime with a simple Strands agent - no additional too
6161
```bash
6262
aws cloudformation create-stack \
6363
--stack-name basic-agent-demo \
64-
--template-body file://basic-runtime/template.yaml \
64+
--template-body file://cloudformation/basic-runtime/template.yaml \
6565
--capabilities CAPABILITY_IAM \
6666
--region us-east-1
6767
```
6868

6969
---
7070

71-
### 03. [Multi-Agent Runtime](./multi-agent-runtime/)
71+
### 03. [Multi-Agent Runtime](./cloudformation/multi-agent-runtime/)
7272

7373
Deploy a multi-agent system where Agent1 (orchestrator) can invoke Agent2 (specialist) for complex tasks.
7474

@@ -90,14 +90,14 @@ Deploy a multi-agent system where Agent1 (orchestrator) can invoke Agent2 (speci
9090
```bash
9191
aws cloudformation create-stack \
9292
--stack-name multi-agent-demo \
93-
--template-body file://multi-agent-runtime/template.yaml \
93+
--template-body file://cloudformation/multi-agent-runtime/template.yaml \
9494
--capabilities CAPABILITY_IAM \
9595
--region us-east-1
9696
```
9797

9898
---
9999

100-
### 04. [Weather Agent with Tools and Memory](./weather-agent-runtime/)
100+
### 04. [End-to-End Weather Agent with Tools and Memory](./cloudformation/end-to-end-weather-agent/)
101101

102102
Deploy a complete weather-based activity planning agent with browser automation, code interpreter, and memory.
103103

@@ -126,7 +126,7 @@ Deploy a complete weather-based activity planning agent with browser automation,
126126
```bash
127127
aws cloudformation create-stack \
128128
--stack-name weather-agent-demo \
129-
--template-body file://weather-agent-runtime/template.yaml \
129+
--template-body file://cloudformation/end-to-end-weather-agent/end-to-end-weather-agent.yaml \
130130
--capabilities CAPABILITY_IAM \
131131
--region us-west-2
132132
```
@@ -182,23 +182,24 @@ Default values:
182182
## Repository Structure
183183

184184
```
185-
04-cfn-samples/
186-
├── README.md # This file
187-
├── mcp-server-agentcore-runtime/ # MCP Server sample
188-
│ ├── deploy.sh # Deployment script
189-
│ ├── test.sh # Testing script
190-
│ ├── cleanup.sh # Cleanup script
191-
│ ├── mcp-server-template.yaml # CloudFormation template
192-
│ ├── get_token.py # Authentication helper
193-
│ ├── test_mcp_server.py # MCP client test
194-
│ ├── README.md # Sample documentation
195-
│ └── DETAILED_GUIDE.md # Technical deep-dive
196-
├── basic-runtime/ # Basic agent sample
197-
│ └── template.yaml # CloudFormation template
198-
├── multi-agent-runtime/ # Multi-agent sample
199-
│ └── template.yaml # CloudFormation template
200-
└── weather-agent-runtime/ # Weather agent sample
201-
└── template.yaml # CloudFormation template
185+
04-infrastructure-as-code/
186+
├── README.md # This file
187+
└── cloudformation/ # CloudFormation samples
188+
├── mcp-server-agentcore-runtime/ # MCP Server sample
189+
│ ├── deploy.sh # Deployment script
190+
│ ├── test.sh # Testing script
191+
│ ├── cleanup.sh # Cleanup script
192+
│ ├── mcp-server-template.yaml # CloudFormation template
193+
│ ├── get_token.py # Authentication helper
194+
│ ├── test_mcp_server.py # MCP client test
195+
│ ├── README.md # Sample documentation
196+
│ └── DETAILED_GUIDE.md # Technical deep-dive
197+
├── basic-runtime/ # Basic agent sample
198+
│ └── template.yaml # CloudFormation template
199+
├── multi-agent-runtime/ # Multi-agent sample
200+
│ └── template.yaml # CloudFormation template
201+
└── end-to-end-weather-agent/ # Weather agent sample
202+
└── end-to-end-weather-agent.yaml # CloudFormation template
202203
```
203204

204205

@@ -242,5 +243,3 @@ aws service-quotas list-service-quotas \
242243
- [CloudFormation Best Practices](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/best-practices.html)
243244
- [CloudFormation Template Reference](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/AWS_BedrockAgentCore.html)
244245
- [Original Tutorials](../01-tutorials/)
245-
246-
File renamed without changes.

04-cfn-samples/weather-agent-runtime/README.md renamed to 04-infrastructure-as-code/cloudformation/end-to-end-weather-agent/README.md

Lines changed: 27 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Weather-Based Activity Planning Agent
2-
ded in this repository are for experimental and educational purposes only. They demonstrate concepts and techniques but are not intended for direct use in production environments.
1+
# End-to-End Weather Agent with Tools and Memory
32

43
This CloudFormation template deploys a complete, production-ready Amazon Bedrock AgentCore Runtime with a sophisticated weather-based activity planning agent. This demonstrates the full power of AgentCore by integrating Browser tool, Code Interpreter, Memory, and S3 storage in a single deployment.
54

@@ -52,62 +51,30 @@ The Weather Activity Planner agent can:
5251

5352
## Architecture
5453

55-
```
56-
┌──────────────────────────────────────────────────────────────────────┐
57-
│ CloudFormation Stack │
58-
│ │
59-
│ ┌─────────────────────────────────────────────────────────────────┐ │
60-
│ │ AgentCore Runtime │ │
61-
│ │ ┌───────────────────────────────────────────────────────────┐ │ │
62-
│ │ │ Weather Activity Planner Agent │ │ │
63-
│ │ │ │ │ │
64-
│ │ │ Workflow: │ │ │
65-
│ │ │ 1. Extract city from query │ │ │
66-
│ │ │ 2. Scrape weather data (Browser Tool) ──────────┐ │ │ │
67-
│ │ │ 3. Generate analysis code (LLM) │ │ │ │
68-
│ │ │ 4. Execute code (Code Interpreter) ─────────┐ │ │ │ │
69-
│ │ │ 5. Get preferences (Memory) ────────────┐ │ │ │ │ │
70-
│ │ │ 6. Generate recommendations │ │ │ │ │ │
71-
│ │ │ 7. Store in S3 (use_aws tool) ──────┐ │ │ │ │ │ │
72-
│ │ └──────────────────────────────────────│───│───│───│───────┘ │ │
73-
│ └───────────────────────────────────────────│───│───│───│─────────┘ │
74-
│ │ │ │ │ │
75-
│ ┌────────────────────────────────────────────│───│───│───│─────────┐ │
76-
│ │ Browser Tool │ │ │ │ │ │
77-
│ │ - WebSocket connection │ │ │ │ │ │
78-
│ │ - Puppeteer automation │ │ │ │ │ │
79-
│ │ - Weather.gov scraping │ │ │ │ │ │
80-
│ └────────────────────────────────────────────┘ │ │ │ │ │
81-
│ │ │ │ │
82-
│ ┌─────────────────────────────────────────────────│───│───│────────┐ │
83-
│ │ Code Interpreter Tool │ │ │ │ │
84-
│ │ - Weather classification logic │ │ │ │ │
85-
│ │ - Data analysis │ │ │ │ │
86-
│ └────────────────────────────────────────────────┘ │ │ │ │
87-
│ │ │ │
88-
│ ┌──────────────────────────────────────────────────────│───│───────┐ │
89-
│ │ Memory │ │ │ │
90-
│ │ - Activity preferences by weather type │ │ │ │
91-
│ │ - User session data │ │ │ │
92-
│ │ - 30-day retention │ │ │ │
93-
│ └────────────────────────────────────────────────────┘ │ │ │
94-
│ │ │
95-
│ ┌──────────────────────────────────────────────────────────│──────┐ │
96-
│ │ S3 Bucket (Results Storage) │ │ │
97-
│ │ - Markdown activity recommendations │ │ │
98-
│ │ - Versioning enabled │ │ │
99-
│ │ - Private access only │ │ │
100-
│ └─────────────────────────────────────────────────────────┘ │ │
101-
│ │
102-
│ ┌─────────────────────────────────────────────────────────────────┐ │
103-
│ │ Supporting Infrastructure │ │
104-
│ │ - ECR Repository (ARM64 container image) │ │
105-
│ │ - CodeBuild (automated image building) │ │
106-
│ │ - Lambda (custom resources & memory initialization) │ │
107-
│ │ - IAM Roles (comprehensive permissions) │ │
108-
│ └─────────────────────────────────────────────────────────────────┘ │
109-
└──────────────────────────────────────────────────────────────────────┘
110-
```
54+
![End-to-End Weather Agent Architecture](architecture.png)
55+
56+
The architecture demonstrates a complete AgentCore deployment with multiple integrated tools:
57+
58+
**Core Components:**
59+
- **User**: Sends weather-based activity planning queries
60+
- **AWS CodeBuild**: Builds the ARM64 Docker container image with the agent code
61+
- **Amazon ECR Repository**: Stores the container image
62+
- **AgentCore Runtime**: Hosts the Weather Activity Planner Agent
63+
- **Weather Agent**: Strands agent that orchestrates multiple tools
64+
- Invokes Amazon Bedrock LLMs for reasoning and code generation
65+
- **Browser Tool**: Web automation for scraping weather data from weather.gov
66+
- **Code Interpreter Tool**: Executes Python code for weather analysis
67+
- **Memory**: Stores user activity preferences (30-day retention)
68+
- **S3 Bucket**: Stores generated activity recommendations
69+
- **IAM Roles**: Comprehensive permissions for all components
70+
71+
**Workflow:**
72+
1. User sends query: "What should I do this weekend in Richmond VA?"
73+
2. Agent extracts city and uses Browser Tool to scrape 8-day forecast
74+
3. Agent generates Python code and uses Code Interpreter to classify weather
75+
4. Agent retrieves user preferences from Memory
76+
5. Agent generates personalized recommendations
77+
6. Agent stores results in S3 bucket using use_aws tool
11178

11279
## Prerequisites
11380

@@ -164,7 +131,7 @@ The script will:
164131
# Deploy the stack
165132
aws cloudformation create-stack \
166133
--stack-name weather-agent-demo \
167-
--template-body file://template.yaml \
134+
--template-body file://end-to-end-weather-agent.yaml \
168135
--capabilities CAPABILITY_NAMED_IAM \
169136
--region us-west-2
170137

@@ -184,7 +151,7 @@ aws cloudformation describe-stacks \
184151

185152
1. Navigate to [CloudFormation Console](https://console.aws.amazon.com/cloudformation/)
186153
2. Click "Create stack" → "With new resources"
187-
3. Upload the `template.yaml` file
154+
3. Upload the `end-to-end-weather-agent.yaml` file
188155
4. Enter stack name: `weather-agent-demo`
189156
5. Review parameters (or use defaults)
190157
6. Check "I acknowledge that AWS CloudFormation might create IAM resources"
@@ -376,5 +343,3 @@ aws cloudformation wait stack-delete-complete \
376343
5. Select the `weather-agent-demo` stack
377344
6. Click "Delete"
378345
7. Confirm deletion
379-
380-
43.2 KB
Loading

04-cfn-samples/weather-agent-runtime/deploy.sh renamed to 04-infrastructure-as-code/cloudformation/end-to-end-weather-agent/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -e
88
# Configuration
99
STACK_NAME="${1:-weather-agent-demo}"
1010
REGION="${2:-us-west-2}"
11-
TEMPLATE_FILE="template.yaml"
11+
TEMPLATE_FILE="end-to-end-weather-agent.yaml"
1212

1313
echo "=========================================="
1414
echo "Deploying Weather Agent Runtime"

0 commit comments

Comments
 (0)