* Fix invoke-agent-runtime CLI syntax in CloudFormation README files - Update CLI commands to use --agent-runtime-arn instead of --agent-runtime-id - Add ARN construction from CloudFormation AgentRuntimeId output - Fix base64 encoding to use echo -n flag to avoid newlines - Update all three CloudFormation README files: - basic-runtime/README.md - multi-agent-runtime/README.md - end-to-end-weather-agent/README.md These changes align with AWS CLI v2.31.23+ requirements for bedrock-agentcore service. Tested and verified working with existing CloudFormation deployments. * Update basic-runtime README.md with additional changes
Basic AgentCore Runtime
This CloudFormation template deploys a basic Amazon Bedrock AgentCore Runtime with a simple Strands agent. This is the simplest possible AgentCore deployment, perfect for getting started and understanding the core concepts without additional complexity.
Table of Contents
- Overview
- Architecture
- Prerequisites
- Deployment
- Testing
- Sample Queries
- Cleanup
- Cost Estimate
- Troubleshooting
- 🤝 Contributing
- 📄 License
Overview
This template creates a minimal AgentCore deployment that includes:
- AgentCore Runtime: Hosts a simple Strands agent
- ECR Repository: Stores the Docker container image
- IAM Roles: Provides necessary permissions
- CodeBuild Project: Automatically builds the ARM64 Docker image
- Lambda Functions: Custom resources for automation
This makes it ideal for:
- Learning AgentCore basics
- Quick prototyping
- Understanding the core deployment pattern
- Building a foundation before adding complexity
Architecture
The architecture consists of:
- User: Sends questions to the agent and receives responses
- AWS CodeBuild: Builds the ARM64 Docker container image with the agent code
- Amazon ECR Repository: Stores the container image
- AgentCore Runtime: Hosts the Basic Agent container
- Basic Agent: Simple Strands agent that processes user queries
- Invokes Amazon Bedrock LLMs to generate responses
- IAM Roles:
- IAM role for CodeBuild (builds and pushes images)
- IAM role for Agent Execution (runtime permissions)
- Amazon Bedrock LLMs: Provides the AI model capabilities for the agent
Prerequisites
AWS Account Setup
-
AWS Account: You need an active AWS account with appropriate permissions
-
AWS CLI: Install and configure AWS CLI with your credentials
aws configure -
Bedrock Model Access: Enable access to Amazon Bedrock models in your AWS region
- Navigate to Amazon Bedrock Console
- Go to "Model access" and request access to:
- Anthropic Claude models
- Bedrock Model Access Guide
-
Required Permissions: Your AWS user/role needs permissions for:
- CloudFormation stack operations
- ECR repository management
- IAM role creation
- Lambda function creation
- CodeBuild project creation
- BedrockAgentCore resource creation
Deployment
Option 1: Using the Deploy Script (Recommended)
# Make the script executable
chmod +x deploy.sh
# Deploy the stack
./deploy.sh
The script will:
- Deploy the CloudFormation stack
- Wait for stack creation to complete
- Display the AgentCore Runtime ID
Option 2: Using AWS CLI
# Deploy the stack
aws cloudformation create-stack \
--stack-name basic-agent-demo \
--template-body file://template.yaml \
--capabilities CAPABILITY_NAMED_IAM \
--region us-west-2
# Wait for stack creation
aws cloudformation wait stack-create-complete \
--stack-name basic-agent-demo \
--region us-west-2
# Get the Runtime ID
aws cloudformation describe-stacks \
--stack-name basic-agent-demo \
--region us-west-2 \
--query 'Stacks[0].Outputs[?OutputKey==`AgentRuntimeId`].OutputValue' \
--output text
Option 3: Using AWS Console
- Navigate to CloudFormation Console
- Click "Create stack" → "With new resources"
- Upload the
template.yamlfile - Enter stack name:
basic-agent-demo - Review parameters (or use defaults)
- Check "I acknowledge that AWS CloudFormation might create IAM resources"
- Click "Create stack"
Deployment Time
- Expected Duration: 10-15 minutes
- Main Steps:
- Stack creation: ~2 minutes
- Docker image build (CodeBuild): ~8-10 minutes
- Runtime provisioning: ~2-3 minutes
Testing
Using AWS CLI
# Get the Runtime ID from stack outputs
RUNTIME_ID=$(aws cloudformation describe-stacks \
--stack-name basic-agent-demo \
--region us-west-2 \
--query 'Stacks[0].Outputs[?OutputKey==`AgentRuntimeId`].OutputValue' \
--output text)
# Get account ID and construct the ARN
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
REGION="us-west-2"
RUNTIME_ARN="arn:aws:bedrock-agentcore:${REGION}:${ACCOUNT_ID}:runtime/${RUNTIME_ID}"
# Prepare the payload (base64 encoded, note the -n flag to avoid newlines)
PAYLOAD=$(echo -n '{"prompt": "What is 2+2?"}' | base64)
# Invoke the agent
aws bedrock-agentcore invoke-agent-runtime \
--agent-runtime-arn $RUNTIME_ARN \
--qualifier DEFAULT \
--payload $PAYLOAD \
--region us-west-2 \
response.json
# View the response
cat response.json
Using AWS Console
- Navigate to Bedrock AgentCore Console
- Go to "Runtimes" in the left navigation
- Find your runtime (name starts with
basic_agent_demo_) - Click on the runtime name
- Click "Test" button
- Enter test payload:
{ "prompt": "What is 2+2?" } - Click "Invoke"
Sample Queries
Try these queries to test your basic agent:
-
Simple Math:
{"prompt": "What is 2+2?"} -
General Knowledge:
{"prompt": "What is the capital of France?"} -
Explanation Request:
{"prompt": "Explain what Amazon Bedrock is in simple terms"} -
Creative Task:
{"prompt": "Write a haiku about cloud computing"} -
Reasoning:
{"prompt": "If I have 5 apples and give away 2, how many do I have left?"}
Cleanup
Using the Cleanup Script (Recommended)
# Make the script executable
chmod +x cleanup.sh
# Delete the stack
./cleanup.sh
Using AWS CLI
aws cloudformation delete-stack \
--stack-name basic-agent-demo \
--region us-west-2
# Wait for deletion to complete
aws cloudformation wait stack-delete-complete \
--stack-name basic-agent-demo \
--region us-west-2
Using AWS Console
- Navigate to CloudFormation Console
- Select the
basic-agent-demostack - Click "Delete"
- Confirm deletion
