Welcome to the comprehensive developer guide for building AI agents in healthcare and life sciences. This guide will help you choose the right template and deploy your own specialized agents using Amazon Bedrock AgentCore.
Prerequisites
Before getting started, ensure you have:
AWS Account with access to Amazon Bedrock
Model Access - Request access to foundation models (e.g., Claude 3.5 Sonnet, Haiku)
AWS CLI configured with appropriate permissions
Python 3.10+ installed
Node.js 18+ and npm (for FAST template)
Git and GitHub account
Basic knowledge of AWS services and JSON/YAML configuration
Choosing Your Template
We provide two approaches for building agents, each suited for different use cases:
AgentCore Template
Best for : Backend-focused development, rapid prototyping, local testing
Includes :
Backend deployment scripts
Local Streamlit UI
Gateway, Memory, Cognito setup
IAM or OAuth authentication options
Sample tools and observability
Deploy time : ~15-20 minutes
FAST Template
Best for : Production deployments, full-stack applications, end-to-end solutions
Includes :
Complete CDK infrastructure
Production React frontend
Amplify Hosting deployment
Code Interpreter integration
Local development support
Deploy time : ~20-30 minutes
Option 1: AgentCore Template
What is the AgentCore Template? The AgentCore Template provides a streamlined approach to deploying AI agents with:
Backend Infrastructure : Gateway, Memory, Cognito, and Runtime
Local Development : Streamlit UI for rapid testing
Flexible Authentication : Choose between IAM or OAuth
Custom Tools : Easily add Lambda functions or local Python tools
Architecture :
┌─────────────────────────────────────────────┐
└──────────────────┬──────────────────────────┘
┌──────────────────▼──────────────────────────┐
│ AgentCore Runtime (AWS) │
│ ┌──────────┐ ┌────────┐ ┌────────────┐ │
│ │ Gateway │ │ Memory │ │ Cognito │ │
│ └──────────┘ └────────┘ └────────────┘ │
└─────────────────────────────────────────────┘
When to use :
Rapid prototyping and experimentation
Backend-focused development
Internal tools and demos
Research and development workflows
Reference : agentcore_template/
Step-by-Step Deployment 1. Prepare Your Environment git clone https://github.com/aws-samples/amazon-bedrock-agents-healthcare-lifesciences.git
cd amazon-bedrock-agents-healthcare-lifesciences/agentcore_template
# Create virtual environment
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -r dev-requirements.txt
Add your own tools before deployment:
Local Tools (agent_config/tools/sample_tools.py):
from strands.tools import tool
def my_custom_tool ( query : str ) -> str :
""" Description of what your tool does. """
Gateway Lambda Tools (prerequisite/lambda/):
Add new Lambda function code
Update configurations as needed
3. Deploy Infrastructure # Deploy prerequisites (S3, Lambda, etc.)
chmod +x scripts/prereq.sh
# List SSM parameters for reference
chmod +x scripts/list_ssm_parameters.sh
./scripts/list_ssm_parameters.sh
Note : Use a consistent prefix for all resources (e.g., myapp)
4. Create AgentCore Components # Create Gateway (connects to Lambda tools)
python scripts/agentcore_gateway.py create --name myapp-gw
# Create Cognito Identity Provider
python scripts/cognito_credentials_provider.py create --name myapp-cp
python tests/test_gateway.py --prompt " Hello, can you help me? "
python scripts/agentcore_memory.py create --name myapp
python tests/test_memory.py load-prompt " My preferred format is detailed explanations "
python tests/test_memory.py list-memory
5. Deploy Agent Runtime -rf agent/requirements.txt \
-er arn:aws:iam::<ACCOUNT>:role/<ROLE> \
When prompted:
OAuth : Choose ‘yes’ for OAuth or ‘no’ for IAM
Discovery URL : Use value from /app/myapp/agentcore/cognito_discovery_url
Client ID : Use value from /app/myapp/agentcore/web_client_id
# Remove old config and launch
6. Run Local UI # Run Streamlit UI (select agent from dropdown)
streamlit run app.py --server.port 8501
Access at: http://localhost:8501
# Run Streamlit UI with OAuth
streamlit run app_oauth.py --server.port 8501 -- --agent=myapp-agent
You’ll be prompted to authenticate via Cognito.
7. Test Your Agent Try these queries:
“Hello, can you help me with information?”
“What tools do you have available?”
“Can you remember my preferences?”
Enable Observability Amazon Bedrock AgentCore provides built-in observability through CloudWatch:
Setup Steps
Enable Transaction Search in CloudWatch:
View Agent Metrics :
Filter by agent name and time frame
Track latency, token usage, errors
Analyze tool invocations
Reference : Build Trustworthy AI Agents with Observability
Clean Up Resources To avoid ongoing charges, remove all deployed resources:
chmod +x scripts/cleanup.sh
# Delete individual components
python scripts/cognito_credentials_provider.py delete
python scripts/agentcore_memory.py delete
python scripts/agentcore_gateway.py delete
python scripts/agentcore_agent_runtime.py myapp-agent
rm .bedrock_agentcore.yaml
Option 2: FAST Template (Fullstack Solution)
What is FAST? The Fullstack AgentCore Solution Template (FAST) is a production-ready framework for deploying complete AI agent applications with:
End-to-End Infrastructure : CDK deployment of backend and frontend
Production React UI : Modern, responsive web interface with authentication
Amplify Hosting : Automatic frontend deployment with CloudFront CDN
Code Interpreter : Built-in Python code execution capabilities
Local Development : Docker Compose for local testing
Architecture :
┌───────────────────────────────────────────────────────┐
└────────────────────┬──────────────────────────────────┘
┌────────────────────▼──────────────────────────────────┐
│ API Gateway + Cognito Auth │
└────────────────────┬──────────────────────────────────┘
┌────────────────────▼──────────────────────────────────┐
│ AgentCore Runtime (Container) │
│ ┌─────────────┐ ┌──────────┐ ┌─────────────────┐ │
│ │ Gateway │ │ Memory │ │ Code Interpreter│ │
│ │ (Lambda) │ │ (DynamoDB│ │ (Sandboxed) │ │
│ └─────────────┘ └──────────┘ └─────────────────┘ │
└───────────────────────────────────────────────────────┘
When to use :
Production deployments
Customer-facing applications
Full-stack solutions with frontend
Scalable, secure applications
Reference :
Step-by-Step Deployment 1. Get Started with FAST Option A : Start with the Terminology Agent example
git clone https://github.com/aws-samples/amazon-bedrock-agents-healthcare-lifesciences.git
cd amazon-bedrock-agents-healthcare-lifesciences/agents_catalog/35-Terminology-agent
pip install -r requirements-dev.txt
Option B : Fork the official FAST template
git clone https://github.com/YOUR-USERNAME/fullstack-solution-template-for-agentcore.git
cd fullstack-solution-template-for-agentcore
Edit infra-cdk/config.yaml:
stack_name_base : " my-agent " # Your stack name
aws_region : " us-west-2 " # Your AWS region
cognito_domain_prefix : " my-agent " # Must be globally unique
3. Deploy Backend (Creates Cognito) # Install CDK dependencies
# Bootstrap CDK (once per account/region)
What gets deployed :
✅ Cognito User Pool (authentication)
✅ AgentCore Runtime (Docker container)
✅ AgentCore Gateway (Lambda tools)
✅ AgentCore Memory (DynamoDB)
✅ API Gateway (REST endpoints)
✅ Code Interpreter (sandboxed Python)
Deploy time : ~15-20 minutes
4. Deploy Frontend # Deploy to Amplify Hosting
python scripts/deploy-frontend.py
The script will:
Build the React app
Upload to S3
Configure Amplify Hosting
Set up CloudFront CDN
Frontend URL : Check CloudFormation outputs or run:
aws cloudformation describe-stacks --stack-name my-agent \
--query ' Stacks[0].Outputs[?OutputKey==`FrontendURL`].OutputValue ' \
5. Create Test User # Create a test user in Cognito
aws cognito-idp admin-create-user \
--user-pool-id <USER_POOL_ID> \
--user-attributes Name=email,Value=test@example.com \
--temporary-password " TempPass123! " \
--message-action SUPPRESS
aws cognito-idp admin-set-user-password \
--user-pool-id <USER_POOL_ID> \
--password " MySecurePass123! " \
6. Access Your Agent
Navigate to the Frontend URL
Log in with your test user credentials
Start interacting with your agent!
Customize Your Agent Update Agent Logic File : patterns/strands-single-agent/basic_agent.py (or create new file)
from strands import Agent
from strands.tools import tool
# Define your system prompt
You are a specialized agent for [YOUR DOMAIN].
def my_domain_tool ( query : str ) -> str :
""" Description of what this tool does. """
model = " anthropic.claude-3-5-sonnet-20241022-v2:0 " ,
system_prompt = SYSTEM_PROMPT ,
Update Frontend Branding File : frontend/src/components/chat/ChatInterface.tsx
Change welcome message and title:
< p >Your agent description </ p >
File : frontend/index.html
Update page title:
< title > Your Agent Name </ title >
Add MCP Servers Add external MCP servers (like OLS for ontologies):
url = os. getenv ( " MCP_SERVER_URL " ) ,
auth_token = os. getenv ( " MCP_AUTH_TOKEN " )
tools = [ mcp_client, my_local_tools ],
See agents_catalog/35-Terminology-agent/ for complete MCP example.
Update CDK Configuration File : infra-cdk/lib/backend-stack.ts
Point to your custom agent:
entrypoint: " patterns/strands-single-agent/my_custom_agent.py "
Redeploy:
Local Development with Docker FAST supports local development while connecting to deployed AWS resources:
Prerequisites You must deploy the stack first (Cognito, Memory, Gateway require AWS):
Get Required Values aws cloudformation describe-stacks --stack-name my-agent \
--query ' Stacks[0].Outputs[?OutputKey==`MemoryArn`].OutputValue ' \
# Extract ID from: arn:aws:bedrock-agentcore:region:account:memory/MEMORY_ID
# Set environment variables
export MEMORY_ID = your-memory-id
export STACK_NAME = my-agent
export AWS_DEFAULT_REGION = us-west-2
Run Locally docker-compose up --build
Access :
Benefits :
Fast iteration on agent logic
No redeployment needed for code changes
Full integration with AWS services
Hot reload for frontend
Clean Up Resources # Delete CloudFormation stack (removes all resources)
aws cloudformation delete-stack --stack-name my-agent
What gets deleted :
✅ Frontend (Amplify Hosting, CloudFront, S3)
✅ Backend (Lambda, API Gateway, AgentCore Runtime)
✅ Cognito User Pool (including users)
✅ Memory (DynamoDB tables)
✅ Gateway resources
Preserved :
CloudWatch Logs (for audit)
ECR images (for rollback)
To delete logs and images:
aws logs delete-log-group --log-group-name /aws/lambda/my-agent- *
aws ecr delete-repository --repository-name my-agent-runtime --force
Agent Development Best Practices
System Prompt Design
Craft effective system prompts for HCLS agents:
You are a [DOMAIN] expert agent specializing in [SPECIFIC AREA].
- [Capability 1]: [Description]
- [Capability 2]: [Description]
- [Capability 3]: [Description]
You have deep knowledge of:
- Cite authoritative sources
- Clarify ambiguities before responding
- Use domain-specific terminology correctly
- Provide confidence levels when uncertain
- Provide medical advice or diagnosis
- Make claims about insurance or billing
- Share patient-identifiable information
- Guarantee outcomes or results
- Use [tool_name] when [condition]
- Prefer [authoritative_source] over [secondary_source]
- Always indicate data source in responses
Best Practices :
✅ Single Responsibility : One tool, one clear purpose
✅ Descriptive Docstrings : Help the LLM understand when to use
✅ Type Hints : Enable better validation and documentation
✅ Error Handling : Return meaningful error messages
✅ Logging : Track usage and debug issues
Example :
from strands.tools import tool
from typing import Optional
def search_medical_database (
database : str = " pubmed " ,
Search medical literature databases for research articles.
Use this tool when the user asks about:
- Recent research findings
- Medical literature references
query: Search query using medical terminology
database: Which database to search (pubmed, clinicaltrials, etc.)
max_results: Maximum number of results to return
Dictionary with search results and metadata
results = perform_search ( query , database , max_results )
Security Considerations
Authentication :
✅ Use Cognito for user authentication
✅ Implement M2M auth for service-to-service
✅ Never hardcode credentials
✅ Rotate secrets regularly
Data Protection :
✅ Use environment variables for sensitive data
✅ Enable encryption at rest (DynamoDB, S3)
✅ Use VPC endpoints for private connectivity
✅ Implement least-privilege IAM roles
HIPAA Compliance (if applicable):
✅ Sign Business Associate Agreement (BAA) with AWS
✅ Use HIPAA-eligible services only
✅ Enable CloudTrail logging
✅ Implement audit trails for PHI access
Testing Strategy
Unit Tests :
def test_search_medical_database () :
result = search_medical_database ( " diabetes treatment " )
assert result[ " success " ] == True
assert len ( result [ " results " ]) > 0
Integration Tests :
def test_agent_response () :
response = agent. invoke ( " What is the ICD-10 code for diabetes? " )
End-to-End Tests :
python test-scripts/test-agent.py --test-suite
Contributing Your Agent
Once you’ve built and tested your agent, contribute it to the catalog:
Contribution Checklist
Submission Process
Fork the repository :
git clone https://github.com/YOUR-USERNAME/amazon-bedrock-agents-healthcare-lifesciences.git
cd amazon-bedrock-agents-healthcare-lifesciences
Create your agent directory :
mkdir -p agents_catalog/XX-YourAgentName
cd agents_catalog/XX-YourAgentName
Add required files :
│ └── strands-single-agent/
Create pull request :
git checkout -b add-your-agent-name
git commit -m " Add: YourAgentName for [use case] "
git push origin add-your-agent-name
Fill out PR template with:
Agent description and use cases
Key capabilities
Sample queries
Testing performed
Screenshots/demo video (optional)
Next Steps
Learn More
Get Help
Example Agents
Explore production-ready examples:
Ready to build? Choose your template and start deploying your AI agent today! 🚀