AWS for Industries
Automate customer complaint classification with AI agents on AWS
Financial institutions process thousands of customer complaints daily, and classifying each one correctly determines whether it reaches the right team within regulatory deadlines. Misclassified complaints land in wrong queues, miss regulatory deadlines, and erode customer trust. Beyond accuracy, regulators expect institutions to demonstrate why a complaint was classified, who owns remediation, and what evidence supports the resolution path — making defensibility as critical as speed.
In this post, you’ll learn how financial institutions can use Amazon Bedrock AgentCore and Strands Agents SDK — an open source framework for building intelligent, model-driven AI agents — to automate their complaint management process through a near real-time agentic solution that classifies complaints with defensible rationale, captures evidence at each decision point, tracks SLA compliance, assigns clear remediation ownership, and improves mean time to resolution.
Regulatory context
Regulatory requirements across multiple jurisdictions mandate strict timelines and documentation standards. FINRA Rule 4530 requires quarterly complaint reporting with supporting evidence of classification rationale. The Federal Reserve’s Regulation AA mandates acknowledgment within 15 business days, and the FDIC requires acknowledgment within 14 days with final responses generally within 60 days. Internationally, the UK’s FCA enforces strict DISP rules and Canada’s FCAC requires a 56-day resolution timeline. Each framework demands not only timely responses but auditable proof that institutions applied consistent, defensible classification logic throughout the complaint lifecycle.
A strong complaint management program surfaces patterns before they become systemic and demonstrates clear ownership at every stage. Yet call center agents must accurately categorize issues, determine severity, identify resolution paths, capture supporting evidence, and track SLA compliance across jurisdictions — all while maintaining positive customer interactions. Financial institutions receive complaints through phone, email, chat, mobile, and branch channels where siloed intake processes force multiple handoffs, multiply costs, and obscure systemic patterns regulators expect institutions to detect. Traditional manual classification creates bottlenecks, produces inconsistent experiences, and leaves institutions without the audit trails needed to defend decisions during regulatory examinations.
Solution Overview
This solution uses AWS services and Agentic AI to create an automated, intelligent complaint processing system specifically for call centers. The architecture implements:
- Real-time complaint analysis during customer calls
- AI-powered classification and severity assessment
- Context-aware resolution suggestions
- Integration with existing ticketing and knowledge base systems
Figure 1: AWS Cloud Contact Center AI Agent Architecture
Architecture steps
- Customer Initiates Call: Customer contacts the call center through the voice channel. The Call Center Application receives the incoming call and prepares it for processing.
- Real-Time Transcription: The call audio is sent to Amazon Transcribe Streaming for real-time speech-to-text conversion. This enables the AI agents to process customer requests as text.
- Initial Routing to Supervisor Agent: The Call Center Application generates an Inbound Auth Access Token. It routes the transcribed conversation to the Supervisor Agent for initial assessment and routing decisions.
- Runtime Authentication: The Amazon Bedrock AgentCore Runtime authenticates with Amazon Bedrock AgentCore Identity by sending its token for verification. This ensures the agent’s runtime is authorized to operate within the system.
- Authenticated Gateway Connection: The Supervisor Agent establishes a connection to the Amazon Bedrock AgentCore Gateway via the
/mcpendpoint with the Inbound Auth Access Token. The Gateway serves as the central orchestration point for routing requests. - Gateway Authentication: The Amazon Bedrock AgentCore Gateway independently authenticates with Amazon Bedrock AgentCore Identity, managing both Inbound Auth and Outbound Auth flows. This ensures the central orchestration component is properly authorized before routing requests.
- Specialized Agent Invocation: Based on the customer’s needs (e.g., complaint handling), the Gateway invokes the appropriate specialized agent (Complaints Agent) using AWS Identity and Access Management (IAM)-based access control. The agent processes the specific request within its own authenticated Runtime environment.
- CRM Integration: The Gateway connects to external Case Management/CRM systems using API keys or tokens. This enables the system to retrieve customer history, create cases, and update records in the business systems.
How Classification Works
Not every call is a complaint — some are balance inquiries or account changes. The Supervisor Agent evaluates intent and routes only confirmed complaints to the specialized Complaints Agent, enabling independent testing and auditing of each concern, and allowing institutions to add agents (fraud, account services) without modifying existing workflows.
The Complaints Agent uses LLM reasoning guided by classification criteria stored in the Amazon Bedrock Knowledge Base. When a transcript arrives, the agent evaluates it against a configurable taxonomy and assigns a category, severity level, and routing group. Institutions customize these by updating the Knowledge Base — no code changes required.
The default taxonomy includes categories such as fee_dispute, unauthorized_transaction, service_degradation, account_access, and regulatory_escalation. Severity (critical, high, medium, low) is derived from financial impact, regulatory deadline proximity, customer sentiment intensity, and complaint recurrence. For example, a repeat billing complaint with explicit regulatory threat is classified as critical, while a first-time minor service issue is low.
Data Protection considerations
Complaint transcripts may sometimes contain personally identifiable information (PII) such as national identification numbers or account details. The following controls protect sensitive data across the solution lifecycle.
Encryption. Amazon Transcribe Streaming encrypts audio and transcript data in transit using TLS 1.2. Amazon Bedrock AgentCore encrypts all data at rest using AWS Key Management Service (AWS KMS) customer managed keys, ensuring institutions retain full control over encryption key rotation and access policies. The Amazon Bedrock Knowledge Bases stores complaint classification reference data with server-side encryption enabled by default.
Access controls and least-privilege access. Amazon Bedrock AgentCore Identity enforces identity-based policies at the Gateway layer, ensuring only authenticated principals invoke the Complaints Agent. Each component — the Supervisor Agent, Complaints Agent, and Knowledge Base — operates under a dedicated AWS Identity and Access Management (IAM) role scoped to minimum required permissions. The AgentCore Gateway separates inbound authentication (call center application to agent) from outbound authentication (agent to CRM/ticketing system), preventing lateral credential reuse.
PII redaction and masking. Amazon Comprehend PII detection integrates with the transcript pipeline to identify and redact sensitive entities — account numbers, national identification numbers, and financial details — before the Complaints Agent processes classification logic. This ensures the agent runtime operates on redacted transcripts while the original record remains available under restricted access for audit purposes.
Logging and audit trail. AWS CloudTrail captures API invocations across AgentCore Gateway, the Complaints Agent runtime, and Knowledge Base queries. Amazon CloudWatch Logs records classification decisions, confidence scores, and routing actions — providing the defensible audit trail regulators require during examinations. To further strengthen the audit trail, you can instrument the Strands Agent code to log the input hash and classification rationale to Amazon CloudWatch Logs at each decision point.
Solution Implementation
This solution is an agentic application using Amazon Bedrock AgentCore as the agent runtime with AgentCore Runtime and, optionally, the authorization layer using AgentCore Identity. To skip the AgentCore deployment steps and test the agent locally, use the Streamlit application provided in the repository. The demo calls the agent locally but still requires AWS credentials with access to Amazon Bedrock.
Prerequisites
This post assumes familiarity with Python, AWS CDK, and basic AWS service concepts. Before deploying, ensure you have the following installed and configured:
- Python 3.10 or later
- AWS Command Line Interface (AWS CLI) 2.x configured with credentials that have access to Amazon Bedrock and Amazon Bedrock AgentCore
- Node Package Manager (npm) version 18.x or later
- AWS Cloud Development Kit (AWS CDK) CLI — install with
npm install -g aws-cdkversion 2.106 or later - The AgentCore starter toolkit:
python3 -m pip install bedrock-agentcore-starter-toolkit - AWS CDK bootstrapped in your target account and Region:
cdk bootstrap aws://ACCOUNT_ID/REGION
Note: Replace ACCOUNT_ID and REGION with the respective values from your setup.
Accessing the Code
The complete solution code, including the Streamlit testing interface and AWS CDK deployment scripts, is available in our GitHub repository.
Deploying the Infrastructure
Install the infrastructure dependencies and deploy:
python3 -m pip install -e ".[infra]"
cd infra
cdk deploy --all
Deploying the Agent to AgentCore Runtime
With the IAM roles provisioned, use the AgentCore starter toolkit to configure and launch the supervisor agent. From the project root:
cd ..
agentcore configure --entrypoint agent.py --non-interactive
agentcore launch
Invoking the Deployed Agent
Once agent is running in AgentCore Runtime, you invoke it by calling the InvokeAgentRuntime API with the agent’s ARN and a JSON payload containing the transcript to analyze.
IAM SigV4 is the default authentication mechanism for AgentCore Runtime. It requires no additional configuration beyond standard AWS credentials. Any IAM principal with the bedrock-agentcore:InvokeAgentRuntime permission can call the agent. This is the same signing process used by AWS APIs.
The following example uses AWS SDK for Python (Boto3) to invoke the agent with IAM authentication:
import boto3
import json
import uuid
from botocore.exceptions import ClientError
agent_core_client = boto3.client("bedrock-agentcore")
agent_arn = "arn:aws:bedrock-agentcore:us-east-1:111122223333:runtime/agent-XXXXXXXXXXXX"
session_id = str(uuid.uuid4())
payload = json.dumps({
"transcript": (
"Customer: I am extremely frustrated right now. "
"I was charged an overdraft fee even though I had sufficient funds. "
"This is unacceptable. I want this fee to be reversed immediately."
)
}).encode()
[Optional] Authentication using JWT
For applications where end users authenticate through an identity provider rather than through IAM, AgentCore Runtime supports JWT bearer token authentication. This is well suited for web and mobile applications that already use OpenID Connect providers such as Amazon Cognito, Auth0, or Okta. The following table describes when to use each authentication method:
| Consideration | IAM SigV4 | JWT Bearer |
|---|---|---|
| Best for | Service-to-service calls, internal tooling, AWS-native workloads | Web/mobile apps, end-user-facing applications |
| Setup complexity | None beyond standard AWS credentials | Requires an identity provider (Cognito, Auth0, Okta, etc.) |
| User identity propagation | Via X-Amzn-Bedrock-AgentCore-Runtime-User-Id header |
Extracted from JWT claims automatically |
| Outbound OAuth (3LO) | Supported with user ID header | Native support via AgentCore Identity token exchange |
| SDK support | Full AWS SDK support (boto3, CLI) | HTTPS requests required, not managed by AWS SDKs |
For this solution, IAM SigV4 is used as the primary invocation method since the agent is called from backend infrastructure. If you later need to expose the agent to end users through a web application, you can configure a separate runtime version with JWT authorization backed by Amazon Cognito or another OpenID Connect provider, and use AgentCore Identity’s credential provider support to enable the agent to access third-party APIs on behalf of authenticated users.
Verifying the Response
A successful invocation returns a streaming response. For a complaint transcript, the supervisor agent classifies the interaction, routes it to the complaints agent, and returns a structured result containing the severity, category, routing group, actions taken, and recommended next steps:
{
"result": {
"is_complaint": true,
"summary": "Complaint identified: The customer is disputing an overdraft fee...",
"complaint": {
"classification_result": "complaint",
"matched_criteria": ["frustrated", "overdraft", "overcharged"]
},
"complaint_response": {
"severity": "high",
"category": "fee_dispute",
"routing_group": "billing_and_fees",
"actions_taken": [
"Logged complaint",
"Initiated fee review",
"Flagged for priority handling"
],
"next_steps": [
"Follow up within 24 hours",
"Escalate if unresolved within 48 hours"
]
}
}
}
For non-complaint transcripts, the agent returns a classification of non_complaint with a brief explanation of why no complaint indicators were found.
For the complete deployment walkthrough — including IAM policy configuration, session management, and individual stack deployment options — see the GitHub repository README.
Testing and Validation
The project includes a Streamlit interface for testing the complaint analysis workflow locally before deploying to AgentCore. The UI presents a three-panel layout: a conversation panel that displays the customer transcript, an evaluation panel that streams the supervisor and complaints agent reasoning in real time, and an actions panel that simulates downstream API calls such as case creation and ticket routing.
We evaluated the agent against a synthetic dataset of 50 call transcripts spanning five complaint categories and routine non-complaint interactions. The agent correctly identified complaints with a 97.5% accuracy rate and a false negative rate of 2.5% — a metric particularly important for regulated environments where a missed complaint can trigger deadline violations and audit findings. Classification time for non-complaint interactions averaged under 5 seconds, allowing routine inquiries to pass through without burdening compliance queues.
Classification accuracy improved with Knowledge Base specificity — the agent achieved 100% category accuracy on fee disputes where detailed rubrics were provided, demonstrating that institutions can tune performance by investing in their classification reference data. Average end-to-end processing time for complaint transcripts was 18 seconds, compared to the 5–9 minutes typically required for manual triage, supporting measurable reductions in mean time to resolution.
Figure 2: Screen recording of Complaints Agent Demo
To start the demo, install the project dependencies and launch the app:
cd
python3 -m pip install -e .
streamlit run streamlit_app.py
The application opens in your browser and provides three ways to submit a transcript: upload a .txt file containing a call transcript using the sidebar file uploader, select one of the built-in demo conversations from the sidebar, or paste transcript text directly into an uploaded file.
When you submit a transcript, the Supervisor Agent classifies the interaction and streams its reasoning to the evaluation panel. If the agent classifies the transcript as a complaint, the Complaints Agent processes it. The UI then presents a human-in-the-loop approval gate before executing the recommended actions. This approval step mirrors the human oversight you should implement in a production workflow — the agent proposes a severity, routing group, and set of actions. A human reviewer approves or dismisses the recommendation before the system executes anything.
The demo requires AWS credentials configured with access to Amazon Bedrock. Both agents invoke large language models (LLMs) through the Amazon Bedrock API. No AgentCore deployment is needed to run the Streamlit interface because it calls the models directly.
Clean up
To avoid incurring charges for Amazon Bedrock model invocations, AgentCore runtime sessions, and Amazon CloudWatch logs, delete the resources you created:
Delete the AgentCore runtime:
agentcore delete
Remove the AWS CDK stacks:
cdk destroy --all
- Delete any Amazon Simple Storage Service (Amazon S3) buckets created during testing.
- Remove Amazon CloudWatch log groups if no longer needed.
Possible expansions
This solution provides a foundation for broader AI-powered customer experience improvements. Looking ahead, you can extend it to handle email and chat channels, integrate sentiment analysis, or enable end-to-end resolution for low-complexity cases. This includes:
- Expanding to multi-channel processing across email, social media, and mobile apps ensuring consistent AI-powered analysis regardless of contact method.
- Integrating real-time sentiment analysis using Amazon Comprehend to detect frustration escalation patterns and trigger immediate supervisor alerts for at-risk interactions.
- Enabling agentic AI to autonomously resolve low-risk cases like account updates, document requests, or schedule calls with support, while implementing human-in-the-loop workflows for financial decisions such as fee reversals.
- Reducing after-call work by using agentic AI to automate document generation.
Conclusion
In this post, we built an intelligent complaint processing system using Amazon Bedrock AgentCore and the Strands Agents SDK. You can deploy the infrastructure with AWS CDK, configure AI agents to classify complaints in real time, reducing processing from 5–10 minutes of manual triage to 18 seconds as evaluated, achieving the following outcomes:
- Reduce mean time to resolution
- Meet regulatory deadlines (FINRA, CFPB, FCA) consistently
- Lower operational costs through automated routing
- Improve customer satisfaction with faster and more accurate responses
Disclaimer: This blog post is for informational purposes only and does not constitute legal, regulatory, or compliance advice. Consult your legal and compliance teams for guidance specific to your organization and jurisdictions.

