A full-stack AI chat application powered by Amazon Bedrock, Strands Agents, and Bedrock AgentCore
This is a sample application that serves as a base implementation for chat applications utilizing Strands Agents.
ποΈ Simple Architecture - Clean, maintainable codebase with serverless scalability
π¨ Rich UI/UX - Polished chat interface with intuitive user experience
π§ Extensible with Strands Agents - Ready for customization with MCP, A2A, Multi Agents, Bedrock AgentCore, and more
πΌοΈ Gallery Mode - Visual gallery for viewing and managing uploaded images and files
π± Responsive Design - Optimized for both desktop and mobile usage
π‘ Perfect Starting Point: If you want to build a governance-enabled, self-hosted, high-functionality generative AI chat application on AWS, using this application as your base implementation is an excellent starting point.
| Tool | Description | Technology |
|---|---|---|
| π¬ Multi-modal Chat | Support for images, videos, and documents | Amazon Bedrock |
| π§ Deep Reasoning | Advanced AI reasoning for complex problem solving | Amazon Bedrock |
| π¨ Image Generation | AI-powered image creation | Nova Canvas MCP |
| π AWS Documentation Search | Search and access AWS documentation | AWS Documentation MCP |
| π Web Search | Real-time web search capabilities | Tavily API |
| π» CodeInterpreter | Execute and analyze code in real-time | Bedrock AgentCore |
| π Web Browser | Browse web pages and analyze content | Bedrock AgentCore |
Click to expand Tavily API setup instructions
- Open AWS Secrets Manager
- Click "Store a new secret"
- Select "Other type of secret"
- Choose "Plaintext" and paste your Tavily API Key
- Create the secret and copy the Secret ARN
# Navigate to CDK directory
cd cdk
# Install dependencies
npm ci
# Copy the parameter template
cp parameter.template.ts parameter.ts
# Edit parameter.ts with your configuration
# Note: If tavilyApiKeySecretArn is null, web search tool will be disabled# Bootstrap CDK (run once per AWS account/region)
npx cdk bootstrap
# Deploy all stacks
npx cdk deploy --all --require-approval neverπ Access your application using the WebUrl from the deployment output!
For frontend development, you can run the development server locally while connecting to your deployed backend:
# Navigate to web directory
cd web
# Install dependencies
npm ci
# Start development server
npm run devThe development server will:
- π Start at
http://localhost:5173 - π Automatically import necessary values from the
StrandsChatstack output - π Enable hot reload for rapid development
Before committing your changes, ensure code quality by running the pre-check script:
# Run pre-commit checks
./pre_check.shThis script will validate your code formatting, run tests, and ensure everything is ready for commit.
The WAF settings are defined in cdk/lib/waf-stack.ts. Customize this file to modify security rules.
Default behavior: Allows access from all IP addresses and countries
IP Restriction Example:
// Modify IP addresses in waf-stack.ts (line 15)
const allIpv4 = new wafv2.CfnIPSet(this, 'AllowedIpv4Set', {
name: 'StrandsChatIpv4',
scope: 'CLOUDFRONT',
ipAddressVersion: 'IPV4',
addresses: ['192.168.1.0/24', '10.0.0.0/8'], // Replace with your allowed IP ranges
});GEO Restriction Example:
// Add country-based rule to the rules array in waf-stack.ts (line 34)
{
name: 'GeoRestriction',
priority: 1,
action: { allow: {} },
statement: {
geoMatchStatement: {
countryCodes: ['US', 'JP', 'CA'], // Allow only these countries
},
},
visibilityConfig: {
cloudWatchMetricsEnabled: true,
metricName: 'GeoRestriction',
sampledRequestsEnabled: true,
},
},Country Codes: Use ISO 3166-1 alpha-2 country codes (e.g., 'US' for United States, 'JP' for Japan)
If you want to disable the Cognito signup functionality and restrict user registration:
Backend Configuration:
- Open
cdk/lib/strands-chat-stack.ts - Find the UserPool configuration
- Change
selfSignUpEnabledfromtruetofalse
// In strands-chat-stack.ts (line 66-78)
const userPool = new UserPool(this, 'UserPool', {
selfSignUpEnabled: false, // Change from true to false
signInAliases: {
username: false,
email: true,
},
passwordPolicy: {
requireUppercase: true,
requireSymbols: true,
requireDigits: true,
minLength: 8,
},
});Frontend Configuration:
- Open
web/src/components/AuthWithUserPool.tsx - Add the
hideSignup={true}option to the<Authenticator>component
// In AuthWithUserPool.tsx (line 75)
<Authenticator
hideSignup={true}
components={{
Header() {
return (
<div className="my-8 text-center">
<h1 className="text-3xl font-bold text-blue-600 transition-colors duration-300 dark:text-blue-400">
Strands Chat
</h1>
</div>
);
},
}}>Note: After making these changes, redeploy the CDK stack for backend changes to take effect.
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | React 19 + TypeScript + Tailwind CSS | Modern, responsive UI |
| Backend | Python 3.13 + FastAPI + Strands Agents | AI-powered API |
| Infrastructure | AWS CDK + Lambda + DynamoDB + S3 | Serverless architecture |
| AI/ML | Amazon Bedrock + Claude | Advanced language models |
| Authentication | AWS Cognito | Secure user management |
βββ π api/ # Python FastAPI backend
βββ βοΈ cdk/ # AWS CDK infrastructure
βββ βοΈ web/ # React frontend application
βββ π README.md # Project documentation
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.




