AWS Builder Center
Weekend Creative Agent Challenge: “SecretarIA”

Weekend Creative Agent Challenge: “SecretarIA”

AI Receptionist Agent for WhatsApp with Amazon Bedrock.

Vision: The Problem It Solves

Small businesses lose customers when they don't respond outside business hours. In Brazil alone, WhatsApp has over 197 million active users and is the #1 channel for business communication. Clinics, barbershops, pet shops, and restaurants receive dozens of messages daily — but most operate only during business hours.
When a customer sends a message at 8 PM asking to schedule an appointment, nobody answers. Research shows that 78% of consumers buy from whoever responds first. Every unanswered message is a lost customer.
SecretarIA is an autonomous AI agent that acts as a receptionist via WhatsApp — not just a chatbot that answers questions, but an agent that makes decisions: it retains undecided customers, redirects sensitive topics, and escalates to a human when it detects frustration or complex requests. It responds 24/7, knows the business schedule in real time, enforces compliance rules (never gives diagnoses or prices), and costs less than $10/month. Built entirely with AWS services and presented at the AWS Community Day Southeast Brazil 2026.

How It Works

  1. Customer sends a WhatsApp message
  1. Backend receives it and applies a 3-second debounce (consolidates rapid messages)
  1. Message is queued in Amazon SQS (async processing)
  1. AWS Lambda processes: checks idempotency → loads context → calls Amazon Bedrock → returns response
  1. Customer receives a natural, helpful reply in 2-5 seconds
The agent doesn't just answer questions — it behaves as an autonomous agent that makes real-time decisions:
  • Retention: If someone is undecided, it proactively explains benefits and offers a no-commitment evaluation
  • Redirection: If someone asks for prices or diagnoses, it steers the conversation toward scheduling
  • Escalation: If it detects frustration or a request beyond its scope, it transfers to a human
  • Context-aware: It remembers previous interactions and adapts its tone accordingly
It never says "I can't help you" — it always offers an alternative path.



How I Built It

Process and Key Decisions

The project started from a real need: dental and medical clinics in Brazil receive 200+ WhatsApp messages/day and can't keep up — especially outside business hours. I went through several iterations:
1. Database choice: DynamoDB over RDS
  • Pay-per-request ($0 when idle) vs. RDS running 24/7 (~$15-30/month)
  • Native TTL for automatic data expiration (privacy compliance)
  • No VPC needed = faster cold starts
2. Lambda outside VPC
  • Cold start ~600ms (vs. 2-5s inside VPC with ENI attachment)
  • $0 extra cost (no VPC Endpoints or NAT Gateway needed)
  • DynamoDB, Bedrock, S3 all accessible via IAM — no private subnet required
3. Debounce strategy
  • Users often send 3-4 messages in sequence ("Hi" → "I want to schedule" → "orthodontics")
  • 3-second debounce consolidates into one Bedrock call
  • Saves 40-60% on API costs during peak hours
4. Model selection: Amazon Nova Micro
  • WhatsApp responses are short (2-3 lines) — no need for a large model
  • ~R$ 0.0004 per message (~$0.00008 USD)
  • 1-2 second latency — perfect for chat

Challenges

  • Prompt engineering for safety: Getting the AI to never provide diagnoses or prices while still being warm and helpful required extensive testing
  • Idempotency: SQS can deliver messages more than once; DynamoDB conditional writes prevent duplicate responses
  • Context management: Sending full conversation history is expensive; limiting to last 6 messages keeps costs low while maintaining conversational coherence



AWS Services Used

Architecture Overview

Customer (WhatsApp)
│
▼
┌──────────────────────────────────┐
│ Backend (NestJS on VPS) │
│ Receives message → Debounce 3s │
│ Queues to SQS │
└────────────┬─────────────────────┘
▼
┌──────────────────────────────────┐
│ Amazon SQS (retry 3x + DLQ) │
└────────────┬─────────────────────┘
▼
┌──────────────────────────────────────────────────┐
│ AWS Lambda (Python 3.12, 512MB) │
│ Idempotency → Context → Bedrock → Response │
└───────┬──────────┬──────────┬────────────────────┘
▼ ▼ ▼
┌────────┐ ┌────────┐ ┌──────┐
│Bedrock │ │DynamoDB│ │ S3 │
│Nova │ │3 tables│ │audit │
│Micro + │ │+ TTL │ │trail │
│Guards │ │ │ │ │
└────────┘ └────────┘ └──────┘

Services Breakdown

Service
Role
Amazon Bedrock (Nova Micro)
AI inference + Guardrails for content safety
AWS Lambda
Serverless message processing
Amazon SQS
Async queue with retry + Dead Letter Queue
Amazon DynamoDB
Patient context, conversation history, idempotency (all with TTL)
Amazon S3
Anonymized audit trail
AWS Secrets Manager
API keys and credentials
Amazon CloudWatch
Metrics, alarms, structured logs
AWS IAM
Least-privilege policies per Lambda

Amazon Bedrock Guardrails

This is the component that makes the system production-ready:
  • Topic filters: Blocks medical diagnoses, pricing, off-topic conversations
  • PII protection: Anonymizes emails/phone numbers, blocks credit card numbers
  • Prompt injection defense: Detects and blocks manipulation attempts
  • Cost benefit: When Guardrails block at pre-processing, the model is never invoked — zero token cost

Infrastructure as Code

Everything is declared in Terraform. A single  terraform apply  provisions the entire stack in 3-5 minutes.



What I Learned

1. Guardrails are non-negotiable for production AI Without them, it's a demo. With them, it's a product. Bedrock Guardrails saved weeks of manual filtering implementation.
2. Serverless + AI is incredibly cost-effective The entire AWS stack costs ~$2.30/month for 50 messages/day. The expensive part is the VPS for WhatsApp connectivity ($6/month), not the AI.
3. Prompt engineering > model size Amazon Nova Micro (the cheapest Bedrock model) performs excellently for short, objective responses. A well-crafted prompt with clear rules matters more than throwing a larger model at the problem.
4. Privacy compliance can be architectural DynamoDB TTL automatically deletes data after the retention period. No cron jobs, no cleanup Lambdas — compliance by design.
5. Debounce is essential for messaging apps Without it, you pay 3-4x more in API calls during peak hours. A simple 3-second wait saves 40-60% on costs.



Results

Metric
Value
Response time
2-5 seconds
Availability
24/7
Monthly cost
~$8.50 (AWS + VPS)
Human escalation rate
<5%
Cost per message
$0.00008


Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article