
Building a Multi-Agent AI Customer Support Assistant on AWS with Strands Agents SDK and Amazon Bedrock
14:59Claude responded: A five-agent customer support pipeline on AWS that automates intent classification, semantic KB retrieval, AI response generation with auto-actions, sentiment-…A five-agent customer support pipeline on AWS that automates intent classification, semantic KB retrieval, AI response generation with auto-actions, sentiment-triggered human escalation via Amazon Connect, and post-resolution CSAT follow-up.
Building a Multi-Agent AI Customer Support Assistant on AWS with Strands Agents SDK and Amazon Bedrock
GitHub: https://github.com/its-me-sweta/Customer_Supprt_AI_Assistant.git
Introduction
Customer support is one of the highest-volume, highest-stakes workflows in any product company. Every ticket carries a customer's frustration, expectation, or urgency — and the speed and quality of the response directly drives retention and CSAT scores.
In this post I'll walk through a production-ready, five-agent AI pipeline that handles the full customer support lifecycle — from the moment a ticket arrives to the CSAT survey and profile update — using:
- Strands Agents SDK with
@tooldecorators - Amazon Bedrock Nova Pro for AI response generation
- Amazon Comprehend for sentiment analysis and NER
- FAISS + Amazon Titan Embed v2 for semantic KB search
- Amazon OpenSearch Serverless for full-text KB fallback
- Amazon Connect for live human agent handoff
- Amazon DynamoDB for pipeline state and customer 360 profiles
- Amazon SES + SNS for resolution emails and alerts
- Amazon EventBridge Scheduler for proactive follow-ups
- AgentCore Runtime for serverless deployment
Architecture Overview
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
┌───────────────────────────────────┐
│ FastAPI / REST Layer │
│ POST /support/ticket │
└─────────────────┬─────────────────┘
│
┌─────────────────▼─────────────────┐
│ Orchestrator Agent │
│ Triage · Route · Audit · State │
└──┬──────────────────────────┬─────┘
│ │
┌────────────▼────┐ ┌───────────▼──────────┐
│ Intent & │ │ Knowledge Retrieval │
│ Sentiment Agent │ │ Agent │
│ Comprehend │ │ FAISS + Titan Embed │
└────────────┬────┘ └───────────┬──────────┘
└──────────┬───────────────┘
│
┌─────────────▼───────────────────┐
│ Resolution Agent │
│ Nova Pro · Auto-actions · HITL │
└─────────────┬───────────────────┘
│
┌──────────────────┼──────────────────┐
│ │ │
┌──────────▼──────┐ ┌────────▼───────┐ ┌──────▼──────────────┐
│ Escalation │ │ Auto-resolved │ │ VIP / P1 Fast-track │
│ Agent │ │ │ │ │
│ Connect · SNS │ │ │ │ │
└──────────┬──────┘ └────────────────┘ └─────────────────────┘
│
┌──────────▼──────────────────────────────────────────┐
│ Follow-up Agent │
│ SES · CSAT Survey · Scheduler · Customer 360 │
└─────────────────────────────────────────────────────┘The Five Agents
| Agent | Role | AWS Services |
|---|---|---|
| Orchestrator Agent | Triages, routes, and maintains state | DynamoDB, SNS |
| Intent & Sentiment Agent | Classifies intent, detects sentiment | Comprehend, DynamoDB |
| Knowledge Retrieval Agent | Semantic KB search and article ranking | Titan Embed v2, OpenSearch, FAISS |
| Resolution Agent | Generates responses + executes actions | Bedrock Nova Pro, SES, DynamoDB |
| Escalation Agent | Routes to human agents with SLA timers | Connect, SNS, DynamoDB |
| Follow-up Agent | CSAT surveys, proactive check-ins, profiles | SES, Scheduler, DynamoDB |
Pipeline Deep Dive
Stage 1 — Intent & Sentiment Agent
The first thing the pipeline does is understand the customer — not just what they're asking, but how they're feeling.
Sentiment via Amazon Comprehend:
1
2
3
4
5
6
7
8
9
10
11
12
def detect_sentiment(text: str, language_code: str = "en") -> dict:
"""Analyzes sentiment using Amazon Comprehend."""
response = comprehend.detect_sentiment(Text=text[:5000], LanguageCode=language_code)
scores = response["SentimentScore"]
# Compute scalar: Positive pulls toward +1, Negative toward -1
scalar = scores["Positive"] - scores["Negative"]
return {
"sentiment_label": response["Sentiment"],
"sentiment_score": round(scalar, 4),
"escalation_flag": scalar <= -0.6, # immediate escalation threshold
}Intent classification uses keyword scoring across 8 categories: billing, technical, account, shipping, feature_request, complaint, compliment, legal.
VIP check queries DynamoDB for enterprise tier or LTV ≥ $10,000 customers, giving them priority routing throughout the pipeline.
Stage 2 — Knowledge Retrieval Agent
The Knowledge Agent uses a two-tier RAG architecture:
Tier 1 — Dense retrieval (primary):
1
2
3
4
5
6
7
8
9
10
embedding = get_embedding(query) # Amazon Titan Embed v2 → 1024-dim vector
# kNN search on OpenSearch Serverless index
search_body = {
"query": {
"bool": {
"must": [{"knn": {"content_vector": {"vector": embedding, "k": 3}}}],
"filter": [{"term": {"intent_category": intent}}],
}
}
}Tier 2 — BM25 keyword fallback:
If the top dense retrieval score is < 0.65, the agent falls back to DynamoDB scan for keyword matching — ensuring coverage even for edge-case queries.
If the top dense retrieval score is < 0.65, the agent falls back to DynamoDB scan for keyword matching — ensuring coverage even for edge-case queries.
Similar ticket lookup searches resolved historical tickets for the same intent + error code combination, giving the agent real resolution patterns to draw from.
Every KB hit is logged to
support-kb-analytics for continuous improvement — so articles that consistently fail to resolve tickets get flagged for review.Stage 3 — Resolution Agent
The Resolution Agent is the heart of the pipeline. It decides whether to auto-resolve, act, or escalate.
Confidence scoring:
1
2
3
4
5
6
7
8
9
10
11
def check_resolution_confidence(kb_score, intent_confidence, is_vip, priority) -> dict:
# VIP and P1/P2 tickets need 80% confidence for auto-resolve (vs 65% standard)
threshold = 0.80 if (is_vip or priority in ("P1","P2")) else 0.65
composite = (kb_score * 0.60) + (intent_confidence * 0.40)
return {
"resolution_confidence": composite,
"recommended_action": "auto_resolve" if composite >= threshold
else "resolve_with_followup_offer" if composite >= 0.50
else "escalate_to_human"
}Automated actions the agent can execute without human involvement:
| Action | Auto-limit | Tool |
|---|---|---|
| Refund | ≤ $500 | execute_refund |
| Courtesy credit | ≤ $50 | apply_account_credit |
| Password reset | Always safe | reset_customer_password |
| Account unlock | If no fraud flag | unlock_account |
| Order status update | Always safe | update_order_status |
Response generation uses Bedrock Nova Pro directly, with tone calibrated to the customer's sentiment:
1
tone = "warm and reassuring" if sentiment_label == "NEGATIVE" else "friendly and helpful"Stage 4 — Escalation Agent
The Escalation Agent handles the human handoff with precision. It doesn't just "route to a human" — it selects the right queue, finds the right agent, sets an SLA timer, and generates a briefing.
Queue routing:
1
2
3
4
5
6
7
QUEUE_MAP = {
"billing": "billing_specialists",
"legal": "legal_compliance",
"technical":"technical_tier2",
"account": "account_security",
}
# VIP customers always route to "vip_support" regardless of intentSLA timers:
| Priority | SLA |
|---|---|
| P1 | 15 minutes |
| P2 | 2 hours |
| P3 | 8 hours |
| P4 | 24 hours |
Case summary (5-bullet handoff note generated for the human agent):
1
2
3
4
5
6
7
CASE SUMMARY — TKT-A1B2C3D4 [VIP CUSTOMER — PRIORITISE]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Customer: Jane Smith (VIP)
Issue type: Billing
Frustration: High (score: -0.72)
AI attempted: Yes — no resolution achieved
Recommended: Apologise first, then investigate account directly.Live chat escalations transfer directly to Amazon Connect for seamless agent takeover.
Stage 5 — Follow-up Agent
The Follow-up Agent closes the loop on every ticket — whether AI-resolved or human-escalated.
CSAT survey timing:
- Chat tickets: sent immediately after resolution
- Email tickets: scheduled 30 minutes post-resolution via EventBridge Scheduler
- P1 tickets: scheduled 24 hours later with a personal outreach note
1
2
3
4
5
scheduler.create_schedule(
Name=f"csat-{survey_id}",
ScheduleExpression=f"at({send_at.strftime('%Y-%m-%dT%H:%M:%S')})",
Target={"Arn": "arn:aws:lambda:...:function:send-csat-email", ...},
)Customer 360 profile is updated in DynamoDB on every interaction:
- Last interaction date and channel
- Issue history and resolution type
- Sentiment trend over time
KB feedback loop — if the resolution confidence was < 0.80, the KB article is flagged for review. This creates a self-improving knowledge base over time.
Escalation Decision Tree
1
2
3
4
5
6
7
8
9
10
11
Incoming ticket
│
├─ Sentiment <= -0.6 OR intent=legal/data_breach → IMMEDIATE ESCALATION (P1/P2)
│
├─ is_vip = True → VIP fast-track queue, confidence threshold = 0.80
│
├─ KB confidence >= threshold → Auto-resolve + follow-up
│
├─ KB confidence 0.50–0.65 → Resolve with "reply if unresolved" offer
│
└─ KB confidence < 0.50 after 2 attempts → Human escalationAWS Infrastructure Summary
| Resource | Purpose |
|---|---|
| Amazon Bedrock Nova Pro | AI response generation |
| Amazon Comprehend | Sentiment analysis, NER, language detection |
| Amazon Titan Embed v2 | Semantic embeddings for KB search |
| OpenSearch Serverless | Dense + BM25 KB retrieval |
| DynamoDB (6 tables) | Tickets, customers, KB, cases, agents, analytics |
| Amazon Connect | Live chat/call human agent handoff |
| Amazon SES | Resolution emails, CSAT surveys |
| Amazon SNS | Escalation alerts, supervisor notifications |
| EventBridge Scheduler | CSAT surveys, proactive follow-ups |
| AgentCore Runtime | Serverless agent deployment |
Key Design Patterns
Dual-threshold confidence — VIP and P1/P2 tickets need 80% confidence for auto-resolve vs 65% for standard tickets. Never compromise resolution quality for high-value customers.
Auto-action limits — Hard limits on automated refunds ($500) and credits ($50) prevent runaway automation while keeping routine resolutions instant.
KB feedback loop — Every resolution outcome feeds back into the KB analytics. Articles that fail to resolve tickets get flagged automatically.
Sentiment-calibrated tone — The Resolution Agent adjusts its communication style based on the detected sentiment score, not just the intent category.
Tiered SLA with escalation — SLA timers start the moment a ticket escalates. Supervisors are notified for P1 and VIP tickets automatically.
Try It Yourself
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
git clone https://github.com/its-me-sweta/Customer_Supprt_AI_Assistant.git
cd customer-support-assistant
pip install -r requirements.txt
uvicorn main:app --reload
# Submit a support ticket
curl -X POST http://localhost:8000/support/ticket \
-H "Content-Type: application/json" \
-d '{
"customer_id": "CUST-001",
"customer_name": "Jane Smith",
"customer_email": "jane@example.com",
"channel": "email",
"message": "I was charged twice for my subscription this month. This is unacceptable.",
"product": "Premium Plan"
}'Built with Strands Agents SDK · Amazon Bedrock Nova Pro · AgentCore Runtime
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article