MoreRSS

site iconThe Practical DeveloperModify

A constructive and inclusive social network for software developers.
Please copy the RSS to your reader, or quickly subscribe to:

Inoreader Feedly Follow Feedbin Local Reader

Rss preview of Blog of The Practical Developer

Building Domain-Specific AI Agents Through Configuration, Not Code

2025-11-24 02:01:06

Building Domain-Specific AI Agents Through Configuration, Not Code

I built a framework where you can create specialized AI agents (like a Compliance Reviewer or Travel Planner) by writing a YAML file instead of coding. Same core, infinite possibilities. Built entirely with Kiro IDE's powerful features.

The Problem: Building AI Agents is Too Code-Heavy

Want to build a compliance reviewer AI? Write hundreds of lines of code.

Need a travel planning assistant? Write hundreds more lines.

Want to add a customer support bot? You guessed it - more code, more complexity, more maintenance.

What if you could create a new AI agent just by writing a configuration file?

That's exactly what I set out to build during the Kiroween Hackathon 2025.

Introducing Agent Skeleton Framework

Agent Skeleton is a configuration-driven framework for building domain-specific AI agents. The same core framework powers completely different specialized agents:

🔍 Compliance Reviewer Agent

  • Reviews documents for regulatory compliance
  • Identifies policy violations with severity ratings
  • Provides specific regulation citations (FLSA, GDPR, OSHA)
  • Generates structured compliance reports

✈️ Travel Planner Agent

  • Creates personalized travel itineraries
  • Provides cost estimates and budget breakdowns
  • Suggests activities based on preferences
  • Offers weather forecasts and local insights

🎯 The Magic: Just YAML

Creating a new agent requires only a YAML file:

domain:
  name: "customer-support"
  description: "AI assistant for customer support"

personality:
  tone: "friendly"
  style: "helpful"

tools:
  allowed:
    - "ticket_search"
    - "knowledge_base_search"
    - "order_lookup"

constraints:
  - "Only respond to customer support questions"
  - "Always be empathetic and patient"
  - "Provide step-by-step solutions"

That's it! No Python, no TypeScript, just configuration.

How It Works: The Architecture

1. Configuration-Driven Core

The framework has a single core that adapts based on YAML configuration:

┌─────────────────────────────────────┐
│         Agent Core                  │
│  • Loads domain config              │
│  • Filters tools by domain          │
│  • Applies personality              │
│  • Enforces constraints             │
└─────────────────────────────────────┘
              ↓
┌─────────────────────────────────────┐
│      Domain Configuration           │
│  • compliance-reviewer.yaml         │
│  • travel-planner.yaml              │
│  • customer-support.yaml            │
└─────────────────────────────────────┘

2. MCP (Model Context Protocol) for Pluggable Tools

Tools are organized into swappable toolsets:

Compliance Toolset:

  • document_parser - Parse and chunk documents
  • policy_search - Search policy database
  • regulation_lookup - Find regulations

Travel Toolset:

  • destination_search - Find destinations
  • weather_lookup - Get weather info
  • price_estimator - Estimate costs
  • currency_converter - Convert currencies

The beauty: Tools are filtered by domain. The travel agent literally cannot access compliance tools - enforced at the code level, not just prompts.

3. Guardrails That Actually Work

One of the biggest challenges was preventing agents from answering out-of-scope questions.

The Problem:

User: "Plan a trip to Paris"
Compliance Agent: "Sure! Here's a 3-day itinerary..." ❌

The Solution:
Place scope restrictions at the TOP of configuration:

constraints:
  - "SCOPE RESTRICTION: Only respond to compliance questions"
  - "If asked about travel, respond: 'I am a Compliance Reviewer. 
     For travel planning, please use the Travel Planner agent.'"

Result:

User: "Plan a trip to Paris"
Compliance Agent: "I am a Compliance Reviewer agent specialized 
in regulatory compliance. For travel planning, please use the 
Travel Planner agent." ✅

LLMs pay more attention to early content - this simple positioning change eliminated 90% of out-of-scope responses.

Built Entirely with Kiro IDE

This project showcases 5 major Kiro features working together:

1. 📋 Spec-Driven Development

I followed Kiro's complete spec workflow:

Requirements Phase:

  • Created requirements.md with EARS (Easy Approach to Requirements Syntax) patterns
  • Defined 12 major requirements with user stories and acceptance criteria
  • Established clear system boundaries

Design Phase:

  • Wrote comprehensive design.md with architecture decisions
  • Defined component interfaces and data models
  • Specified MCP tool architecture

Implementation Phase:

  • Generated tasks.md with 18 step-by-step tasks
  • Executed tasks incrementally with Kiro's assistance
  • Validated each step before proceeding

Impact: Caught architectural issues early, provided clear success criteria, enabled seamless resumption of work.

2. 🎯 Steering Documents

Created steering docs to guide behavior:

Base Steering (base_agent_behavior.md):

## Core Principles
- Always respect domain constraints
- Never fabricate information
- Acknowledge uncertainty when appropriate

## Response Format
- Provide structured, clear responses
- Use appropriate formatting
- Include reasoning for decisions

Domain-Specific Steering:

  • compliance_specific.md - Formal tone, citation-focused
  • travel_specific.md - Friendly tone, creative suggestions

Impact: Consistent behavior without hardcoding personality.

3. ⚡ Vibe Coding

Used Kiro's AI assistance for rapid development:

Most Impressive Generation:
Asked Kiro to create the complete MCP toolset architecture. In one session, it generated:

  • Base MCPToolset class
  • Tool registry with validation
  • Two full domain toolsets (compliance and travel)
  • Proper error handling and JSON schema validation
  • 400+ lines of production-ready code

Impact: Built complete framework with API, CLI, and Web UI in days, not weeks.

4. 🔌 MCP Integration

Implemented Model Context Protocol for pluggable tools:

class MCPToolset:
    def __init__(self, name: str, description: str):
        self.name = name
        self.description = description
        self.tools: List[Tool] = []

    def register_tools(self, registry: ToolRegistry):
        for tool in self.tools:
            registry.register_tool(tool)

Benefits:

  • Add new tools in 15 minutes
  • No core code changes needed
  • Domain-based tool permissions
  • Easy testing with mocks

5. 🔗 Agent Hooks

Implemented event-driven callbacks:

@hook("after_tool_call")
def log_tool_execution(context):
    logger.info(f"Tool: {context['tool_name']}, "
                f"Duration: {context['execution_time_ms']}ms")

@hook("after_response")
def track_metrics(context):
    metrics.record(context['execution_time_ms'])

Impact: Extensible architecture with clean separation of concerns.

Real-World Demo: Compliance Review

Let me show you the framework in action:

User Query:

"Review this employee handbook for overtime policy compliance"

What Happens Behind the Scenes:

  1. Planning Phase:
   Step 1: Parse document using document_parser
   Step 2: Search for overtime policies using policy_search
   Step 3: Lookup FLSA regulations using regulation_lookup
   Step 4: Compare requirements and generate report
  1. Execution Phase:

    • Document parsed into chunks
    • Relevant policies found (Employee Overtime Policy - POL-001)
    • FLSA Section 7 regulation retrieved
    • Comparison performed
  2. Response:

   COMPLIANCE REVIEW REPORT

   Executive Summary:
   The employee handbook's overtime policy is COMPLIANT with 
   federal requirements under FLSA Section 7.

   Findings:
   ✅ Policy correctly states 1.5x rate for hours over 40/week
   ✅ Proper reference to FLSA requirements
   ✅ Clear definition of non-exempt employees

   Regulation References:
   - FLSA-Section-7: Fair Labor Standards Act - Overtime

   Severity: LOW (No violations found)

Total Time: 3-5 seconds

The Technical Stack

Backend:

  • Python 3.10+ with FastAPI
  • Pydantic for data validation
  • OpenAI/Anthropic LLM support
  • In-memory and persistent storage

Frontend:

  • Next.js 14 with TypeScript
  • TailwindCSS for styling
  • Real-time step visualization
  • Domain switching with state isolation

Core Framework:

  • Planner: Goal decomposition and execution
  • Memory: Short-term and long-term strategies
  • Evaluation: Response validation and revision
  • Steering: Behavior guidance system
  • Hooks: Event-driven callbacks
  • Tools: MCP-based registry

Challenges and Solutions

Challenge 1: Tool Response Formatting

Problem: Tool results were showing as raw JSON instead of human-readable text.

Example:

{'policies': [{'id': 'POL-001', 'title': 'Employee Overtime Policy', 
'content': '...', 'relevance_score': 0.25}]} 

Solution:
Modified the response synthesis logic to always format tool results through the LLM, even for single-step plans.

Result:

Based on your query about employee compliance, here are the 
top requirements:

**Employee Overtime Policy (POL-001)**
All non-exempt employees must be paid overtime at 1.5x their 
regular rate for hours worked over 40 in a workweek. ✅

Challenge 2: Domain Switching UX

Problem: When switching between agents, chat history persisted, causing confusion.

Solution:

  1. Clear chat history on domain switch
  2. Clear execution steps and state
  3. Show system message indicating fresh start
  4. Separate memory contexts per domain

Result: Clean separation between domains with clear visual feedback.

Challenge 3: Performance

Initial: 10-15 seconds per query
Optimized: 3-5 seconds per query

Optimizations:

  • Switched to GPT-3.5-turbo (3x faster than GPT-4)
  • Disabled evaluation layer (saves 2-3s)
  • Reduced memory context (5 items vs 10-15)
  • Minimal verbosity in responses

Adding a New Agent: Customer Support Bot

Want to see how easy it is? Here's how to add a customer support bot:

Step 1: Create YAML (5 minutes)

# domains/customer-support.yaml
domain:
  name: "customer-support"
  description: "AI assistant for customer support"

personality:
  tone: "friendly"
  style: "helpful"
  verbosity: "balanced"
  characteristics:
    - "Empathetic and patient"
    - "Solution-oriented"

tools:
  allowed:
    - "ticket_search"
    - "knowledge_base_search"
    - "order_lookup"

constraints:
  - "SCOPE RESTRICTION: Only respond to customer support questions"
  - "Always acknowledge customer frustration"
  - "Provide step-by-step solutions"

Step 2: Create Toolset (15 minutes)

# tools/customer_support_toolset.py
class CustomerSupportToolset(MCPToolset):
    def __init__(self):
        super().__init__("customer-support", "Customer support tools")
        self.tools = [
            self._create_ticket_search(),
            self._create_kb_search(),
            self._create_order_lookup()
        ]

Step 3: Register (2 minutes)

# api/main.py
customer_support_tools = CustomerSupportToolset()
customer_support_tools.register_tools(tool_registry)

Step 4: Update UI (5 minutes)

// ui/web/components/DomainSelector.tsx
const domains = [
  { id: 'compliance-reviewer', name: 'Compliance Reviewer' },
  { id: 'travel-planner', name: 'Travel Planner' },
  { id: 'customer-support', name: 'Customer Support' }, // NEW
];

Total Time: ~30 minutes

Compare that to building a customer support bot from scratch (weeks of work)!

Key Learnings

1. Spec-Driven Development Works

Before: Jump into coding, refactor constantly, miss requirements.

With Kiro's Specs:

  • Requirements phase catches issues early
  • Design phase prevents architectural mistakes
  • Task phase provides clear roadmap
  • Implementation is smooth and predictable

Lesson: Upfront planning saves time overall.

2. Steering Documents Are Powerful

Discovery: Placing scope restrictions at the TOP of steering docs is critical.

Why it matters:

  • LLMs pay more attention to early content
  • Guardrails need maximum visibility
  • Prevents hallucinations effectively

Lesson: Document structure affects AI behavior significantly.

3. Configuration > Code for Flexibility

Insight: Configuration-driven architecture enables rapid iteration.

Benefits:

  • Changed agent personality in seconds
  • Added new tools without core changes
  • Adjusted guardrails without redeployment
  • Tested different configurations easily

Lesson: Separate configuration from logic for maximum flexibility.

4. MCP Protocol Scales

Without MCP:

  • Adding 10 tools = modifying core 10 times
  • Risk of breaking existing functionality
  • 2-3 hours per tool

With MCP:

  • Adding 10 tools = 10 independent toolsets
  • Zero risk to existing tools
  • 15 minutes per toolset

Lesson: Abstraction layers are worth the initial investment.

What's Next

Short-Term (Next Month)

  1. More Domain Examples

    • Customer Support Agent
    • Code Review Agent
    • Data Analysis Agent
    • Content Writer Agent
  2. Visual Configuration Builder

    • Drag-and-drop tool selection
    • Visual personality customization
    • Real-time validation
    • Export to YAML
  3. Enhanced Memory

    • Vector search for semantic retrieval
    • Cross-session persistence
    • Memory summarization

Medium-Term (Next Quarter)

  1. Multi-Agent Collaboration
    • Agent-to-agent communication
    • Task delegation between agents
    • Collaborative problem solving

Example:

   User: "Review this contract and plan a business trip"
   → Compliance Agent reviews contract
   → Travel Agent plans trip based on contract dates
   → Combined response delivered
  1. Streaming Responses

    • Stream LLM responses as they generate
    • Show tool execution progress
    • Reduce perceived latency
  2. Tool Marketplace

    • Share custom toolsets
    • Rate and review tools
    • One-click installation

Long-Term (Next Year)

  1. Enterprise Features

    • Role-based access control
    • Audit logging
    • Multi-tenancy support
    • SSO integration
  2. Agent Analytics

    • Usage metrics per agent
    • Performance dashboards
    • Cost tracking
    • A/B testing framework

Try It Yourself

The framework is open source and ready to use:

GitHub: [Link to repository]

Quick Start:

# Clone the repository
git clone <repository-url>
cd agent-skeleton

# Install dependencies
pip install -e .

# Set up environment
cp .env.example .env
# Add your OpenAI/Anthropic API key

# Start the API
uvicorn api.main:app --reload

# Or use the CLI
python agent_cli.py --domain travel --goal "Plan a weekend getaway"

Documentation:

  • Complete setup guide in README.md
  • Architecture details in ARCHITECTURE.md
  • Kiro usage documented in KIRO_USAGE.md
  • 7 PlantUML diagrams showing system flows

Conclusion

Building AI agents doesn't have to be code-heavy. With the right architecture and tools, you can create specialized agents through configuration alone.

Key Takeaways:

  1. Configuration-driven architecture enables rapid iteration
  2. MCP protocol provides clean, scalable tool integration
  3. Guardrails require intentional design (position matters!)
  4. Kiro's features work synergistically for powerful results
  5. Spec-driven development catches issues early and maintains quality

The Agent Skeleton Framework demonstrates that with proper abstraction and configuration, you can build production-ready AI agents in days, not weeks.

What would you build with this framework? Drop a comment below! 👇

Resources

Built with ❤️ using Kiro IDE for Kiroween Hackathon 2025 🎃

CinemaSins: Everything Wrong With The Wiz In 15 Minutes Or Less

2025-11-24 02:00:15

Everything Wrong With The Wiz in 15 Minutes (Or Less)

CinemaSins is back on the yellow brick road now that Wicked is back in theaters—this time digging into the 1978 classic The Wiz to see if it’s better (or worse) than you remember, all in their trademark snarky “Everything Wrong With” style.

For more sinfully fun content, hit up their website or Linktree for channels like TV Sins and Commercial Sins, fill out their poll, or support them on Patreon. You can also follow the team—Jeremy, Chris, Aaron, Jonathan, Deneé, Ian and Daniel—on Twitter or Instagram, and join the party on Discord, Reddit, TikTok and more.

Watch on YouTube

CinemaSins: Everything Wrong With KPop Demon Hunters In 16 Minutes Or Less

2025-11-24 02:00:08

Everything Wrong With KPop Demon Hunters In 16 Minutes Or Less

CinemaSins dives into the neon-soaked world of KPop Demon Hunters, rattling off every quibble, plot hole and eyebrow-raising moment in under 16 minutes—complete with their trademark snark and “sins” tally.

Along the way they plug their main site and socials (YouTube channels, Discord, Reddit, TikTok, Instagram), invite you to fill out a quick poll, and encourage adoring fans to fuel the sin machine on Patreon.

Watch on YouTube

Building a Location Picker in React Native Maps (with Draggable Marker &amp; Address Lookup)

2025-11-24 01:59:06

Introduction

In my previous post, I covered how to integrate Google Maps and display the user’s live location.

Now let’s take it one step further — by creating a location picker where users can drag a marker or move the map to select an address. This feature is perfect for checkout pages, delivery address setup, or event creation screens.

Step 1: Setup

We’ll continue using:

npx expo install react-native-maps expo-location

Optional (for reverse geocoding):

npx expo install expo-location

Step 2: Display the Map with a Draggable Marker

import React, { useState, useEffect } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import MapView, { Marker } from 'react-native-maps';
import * as Location from 'expo-location';

export default function LocationPicker() {
  const [region, setRegion] = useState(null);
  const [address, setAddress] = useState('');

  useEffect(() => {
    (async () => {
      const { status } = await Location.requestForegroundPermissionsAsync();
      if (status !== 'granted') return;

      const current = await Location.getCurrentPositionAsync({});
      const { latitude, longitude } = current.coords;
      setRegion({
        latitude,
        longitude,
        latitudeDelta: 0.01,
        longitudeDelta: 0.01,
      });
      getAddress(latitude, longitude);
    })();
  }, []);

  const getAddress = async (lat: number, lng: number) => {
    const [place] = await Location.reverseGeocodeAsync({ latitude: lat, longitude: lng });
    if (place) {
      setAddress(`${place.name || ''}, ${place.city || ''}, ${place.region || ''}`);
    }
  };

  const onMarkerDragEnd = (e: any) => {
    const { latitude, longitude } = e.nativeEvent.coordinate;
    setRegion({ ...region, latitude, longitude });
    getAddress(latitude, longitude);
  };

  if (!region) return <Text>Loading map...</Text>;

  return (
    <View style={styles.container}>
      <MapView style={styles.map} region={region}>
        <Marker
          coordinate={region}
          draggable
          onDragEnd={onMarkerDragEnd}
          title="Selected Location"
        />
      </MapView>
      <View style={styles.infoBox}>
        <Text style={styles.label}>Selected Address:</Text>
        <Text style={styles.address}>{address || 'Move marker to select'}</Text>
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  container: { flex: 1 },
  map: { flex: 1 },
  infoBox: {
    position: 'absolute',
    bottom: 40,
    left: 20,
    right: 20,
    backgroundColor: '#fff',
    borderRadius: 12,
    padding: 10,
    shadowColor: '#000',
    shadowOpacity: 0.1,
    shadowRadius: 6,
  },
  label: { fontWeight: '600', marginBottom: 4 },
  address: { fontSize: 14, color: '#333' },
});

What this does:

  • Displays your current location.

  • Lets you drag the marker to a new position.

  • Updates the address in real time.

Step 3: Use Map Pan Instead of Marker Drag

If you prefer to keep the marker fixed and move the map instead:

<MapView
  style={styles.map}
  region={region}
  onRegionChangeComplete={(r) => {
    setRegion(r);
    getAddress(r.latitude, r.longitude);
  }}
>
  <Marker coordinate={region} />
</MapView>

This feels more natural for UX — the marker stays centered while the user pans the map.

Step 4: Save the Selected Location

Once the user confirms the spot, send it back to your backend or state management:

<Button
  title="Confirm Location"
  onPress={() => console.log('Saved location:', region, address)}
/>

Conclusion

And that’s it! You’ve now built a fully functional location picker in React Native using react-native-maps and Expo Location.

Key Takeaways:

Always handle permissions before rendering the map.

Use reverse geocoding to get human-readable addresses.

For better UX, fix the marker and move the map instead of dragging.

🔗 Next Up

In my next post, I’ll explore how to show nearby places and routes using Google Maps APIs in React Native. Stay tuned!

✍️ Written by Dainy Jose — React Native Mobile Application Developer with 3+ years of experience building cross-platform mobile apps using React Native (Expo, TypeScript, Redux).
Currently expanding backend knowledge through the MERN Stack (MongoDB, Express.js, React.js, Node.js) to create more efficient, full-stack mobile experiences.

💼 Tech Stack: React Native · TypeScript · Redux · Expo · Firebase · Node.js · Express.js · MongoDB · REST API · JWT · Jest · Google Maps · Razorpay · PayU · Agile · SDLC · Git · Bitbucket · Jira

📬 Connect with me:
🌐 Portfolio
🔗 LinkedIn
💻 GitHub

Launching EC2 with Git Bash: Why SSH Is Preferable to PuTTY.

2025-11-24 01:50:44

SSH let me copy my .pem key and connect instantly, while PuTTY forced me to convert to .ppk every time SSH saved time, reduced friction, and scaled securely.

This project matters because it teaches secure, real‑world cloud skills: launching EC2, using SSH with .pem keys, avoiding PuTTY conversions, and hosting a webpage. It builds automation habits, scales easily, and mirrors workflows businesses rely on daily.

Step by Step on how to SSH into Ubuntu EC2 from Gitbash.

  • Launch an EC2 Instance
  • Log in to the AWS Management Console.

Search for EC2 and open the EC2 dashboard.

Click Launch Instance.

  • Fill in the details:

Name: e.g., elmaurserver.

  • AMI (Amazon Machine Image): Choose Ubuntu Server 22.04 LTS (or Amazon Linux if you prefer).

I choose Ubuntu.

  • Instance type: Start with t2.micro (free tier eligible).

  • Key pair: Create a new key pair → name it dehnikeypair → download the .pem file.

  • Network settings: Allow SSH (port 22) from your IP. Optionally allow HTTP (port 80) if you plan to run a web server.

Click Launch Instance.

Locate Your Public IP.

  • In the EC2 dashboard, select your instance.

  • Under Details, copy the Public IPv4 address (example: 18.132.3.224).

Open Git Bash.

  • Fix permissions:

Connect via SSH.

  • For Ubuntu:

  • Update Your Server

Common Mistakes I Hit and Fixes.

  • No such file or directory on chmod → Use Git Bash path (/c/...), not Windows path (C:...).

  • Tried to run the .pem file → Never execute the key. Only reference it with -i in ssh.

  • Permission denied (publickey) → Use the right username (ubuntu for Ubuntu AMI).

  • IP keeps changing → Use an Elastic Ip.

Conclusion.

Why I Preferred SSH Over PuTTY
PuTTY is popular on Windows, but here’s why I preferred SSH in Git Bash:

  • No extra conversions — .pem works directly; PuTTY requires .ppk.

  • Fits naturally into my Git workflow.

  • Scriptable and automation-friendly.

  • Industry standard across Linux, macOS, and Windows.

  • Consistent experience across platforms.

  • Security: Strong key‑based authentication, no passwords.

  • Automation: SSH integrates with CI/CD pipelines and config management tools.

  • Collaboration: Developers use SSH keys with GitHub/GitLab for secure code pushes.

  • Resilience: Elastic IPs + SSH allow fast recovery during outages.

  • Scalability: Manage fleets of servers with scripts, not GUIs.

How to Build Your Own Claude Chat App on AWS Bedrock with AWS CDK (Beginner-Friendly Step-by-Step Guide)

2025-11-24 01:49:28

🔗 Original article in Spanish:
“Crea tu propio chat con Claude en AWS Bedrock usando AWS CDK (guía paso a paso para principiantes)”
https://dev.to/chainiz/crea-tu-propio-chat-con-claude-en-aws-bedrock-usando-aws-cdk-guia-paso-a-paso-para-principiantes-20ag

Learn how to build and deploy a serverless AI chat application powered by Claude 3.5 Sonnet (Anthropic) on AWS Bedrock, using AWS CDK (Python) — from scratch.

Perfect for beginners exploring AWS, Infrastructure as Code, and generative AI development in the AWS ecosystem.

🎯 What You Will Build

In this hands-on project you will deploy:

  • A Lambda function that invokes Claude 3.5 on AWS Bedrock
  • A REST API built with API Gateway (/chat)
  • A static web chat interface hosted on S3
  • Fully automated provisioning using AWS CDK (Python)

This tutorial gives you a complete end-to-end AI application running in minutes.

✅ Prerequisites

Make sure you have:

  • AWS account with Bedrock model access enabled → Bedrock Console → Model Access → anthropic.claude-3-5-sonnet-20240620
  • Region: us-east-1
  • AWS CDK installed:
  npm install -g aws-cdk
  • AWS credentials set using aws configure

📦 1. Clone the Project

git clone https://github.com/r3xakead0/aws-cdk-bedrock-claude.git
cd aws-cdk-bedrock-claude

Activate a virtual environment:

uv venv && source .venv/bin/activate

Install dependencies:

uv sync

🧱 2. Architecture Overview

architecture description

Flow:

  1. User sends a chat message
  2. Lambda sends request to Claude (Bedrock Runtime)
  3. Claude generates a response
  4. API Gateway returns the answer to the browser

Technologies used:

  • AWS Lambda
  • Amazon API Gateway
  • Amazon S3 (static hosting)
  • AWS Bedrock Runtime
  • AWS CDK (Python)

💡 3. Key CDK Components

Lambda – calls Claude 3.5 Sonnet

bedrock_rt = boto3.client("bedrock-runtime")

resp = bedrock_rt.invoke_model(
    modelId="anthropic.claude-3-5-sonnet-20240620",
    body=json.dumps({
        "anthropic_version": "bedrock-2023-05-31",
        "messages": [{"role": "user", "content": [{"type": "text", "text": prompt}]}],
        "max_tokens": 512
    })
)

CDK handles IAM, permissions, packaging, and deployment automatically.

🚀 4. Deploy the Full Stack

Bootstrap (first time only):

cdk bootstrap

Deploy:

cdk deploy

You will get:

ApiUrl = https://xxxx.execute-api.us-east-1.amazonaws.com/prod/chat
WebsiteUrl = http://claudechatdemo.s3-website-us-east-1.amazonaws.com

💬 5. How to Test Your Claude Chat App on AWS

Open the website and paste your ApiUrl.

http://claudechatdemo.s3-website-us-east-1.amazonaws.com/

Try this message:

Do you know what a bucket is?

chat web

Claude will respond immediately with the generated output.

Yes, I'm familiar with buckets in various contexts. The term "bucket" can have different meanings depending on the context
1. In everyday usage, a bucket is a container used for carrying or storing liquids or other materials
2. In computer science and cloud computing:
  - A bucket is a fundamental container for storing data in object storage services like Amazon S3 (Simple Storage Service).
  - It's used to organize and control access to data objects
3. In data structures, a bucket is a container that can hold multiple items, often used in hash tables or for sorting algorithms (e.g., bucket sort)
4. In statistics and data analysis, data can be grouped into "buckets" or ranges for easier analysis or visualization
5. In project management, "bucket" might refer to a category or group of related tasks or resources
Given that you're asking about buckets in the context of an AWS expert, I assume you're most likely referring to S3 buckets or similar cloud storage concepts. If you have a more specific question about buckets in a particular context, please feel free to ask.

This is your fully serverless, pay-per-use AI chat app running on AWS ✨

🧪 6. Test Using curl

API="https://xxxx.execute-api.us-east-1.amazonaws.com/prod/chat"

curl -s -X POST "$API" \
  -H 'Content-Type: application/json' \
  -d '{"prompt":"Summarize AWS Bedrock in 3 bullets"}' | jq

🧹 7. Clean Up

To avoid charges:

cdk destroy

This removes Lambda, API Gateway, and S3.

🧭 What You Learned

  • How to deploy AI workloads with AWS Bedrock
  • How to build serverless architectures using AWS CDK
  • How to host frontend apps on Amazon S3
  • How to integrate Claude with your own applications

🌟 Conclusion

This guide shows how easy it is to combine serverless, IaC, and AI to create real, production-ready applications on AWS.

🔗 Source code (open-source): r3xakead0/aws-cdk-bedrock-claude

If this tutorial helped you, leave a ❤️ and tell me which Bedrock model you want to try next!