AWS Builder Center
Building an AI-Powered Call Center with Amazon Connect and Bedrock Agent

Building an AI-Powered Call Center with Amazon Connect and Bedrock Agent

This article demonstrates how to integrate Amazon Connect with Amazon Bedrock Agent to build a generative AI-powered customer call center. The demo showcases a tradesperson booking assistant that helps callers find and book tradespeople through natural voice conversations.

Building an AI-Powered Call Center with Amazon Connect and Bedrock Agent

Have you ever called a business only to navigate through a maze of robotic menu options? "Press 1 for sales, press 2 for support..." We've all been there, and it's rarely a pleasant experience. But what if a voice assistant could understand your needs as naturally as a human would?
In this post, I'll walk you through how we built a voice-based booking system that actually understands callers. Using Amazon Connect and Bedrock Agent, we created a tradesperson booking assistant that can handle complex conversations, maintain context, and execute real business logic—all through natural voice interactions.

The Challenge: Making Machines Converse Like Humans

In order to build a voice assistant that doesn't frustrate callers. Here's what we needed to solve:
  • Understanding Natural Speech: People don't speak in keywords. They say things like "I need someone to fix my leaky faucet sometime next week" rather than "plumber + booking + Tuesday."
  • Remembering Context: When a caller says "I'd prefer the second option," the system needs to remember what options were just presented.
  • Extracting Key Information: The system must identify that "my kitchen sink is clogged" means we need a plumber, not an electrician.
  • Handling Interruptions: Callers might change their minds mid-conversation or ask tangential questions.
  • Connecting to Real Systems: A great conversation is useless if it doesn't result in an actual booking in the database.
These challenges go far beyond the capabilities of traditional IVR systems with their rigid decision trees.

The Architecture: Core Components of the Voice Booking System

Architecture
Our booking system integrates five key AWS services that work together to create a seamless conversational experience:
  • Amazon Connect: Handles all telephony functions including call management, queuing, and audio streaming. Connect provides the phone number that customers dial and manages the entire call lifecycle.
  • Amazon Lex: Processes speech input. Lex bridges the gap between voice communication and text-based processing.
  • Amazon Bedrock Agent: Powers the natural language understanding using large language models (LLMs). This component leverages the LLM to maintain conversation context, interpret user intent, and orchestrate the appropriate actions based on the conversation flow.
  • AWS Lambda: Implements the business logic through API handlers that process requests from Bedrock Agent. Lambda functions perform database operations, apply business rules, and generate structured responses.
  • Amazon DynamoDB: Provides the persistent data layer with tables for customers, tradespeople, and bookings. The database is structured with indexes optimized for the specific query patterns needed by the booking system.
This serverless architecture eliminates infrastructure management overhead while providing automatic scaling capabilities to handle fluctuating call volumes efficiently.

The Amazon Connect Flow: Setting Up Voice and Lex Integration

The heart of our telephony system is the Amazon Connect flow, which defines how calls are handled from the moment they're answered until they're completed.
Connect Flow
This flow diagram illustrates several critical components:
  • Voice Selection: We configure the system to use a specific voice for all responses.
  • Lex Integration: The input block is configured to use Amazon Lex, which is where Connect forwards the caller's speech. This integration is crucial as it allows the system to convert speech to text for processing.
  • Bidirectional Communication: When the caller speaks, Connect streams their audio to Lex. Then Bedrock Agent determines the appropriate response, Connect converts the text response back to speech using the configured voice.
  • Error Handling: The flow includes paths for handling various scenarios, such as when a caller doesn't respond or when the system can't understand the input.
  • Session Attributes: Throughout the call, Connect maintains session attributes that can be used to track the conversation state and pass information between different parts of the system. For example, the caller's phone number is automatically captured as a session attribute and can be used for customer identification or callback purposes.

The Conversation Journey: From "Hello" to Database Record

Let's follow a call through our system to see how it works:
  1. The Call Begins: A customer dials our number, and Amazon Connect answers. The call is routed through the pre-configured flow shown above that connects to our Lex bot.
  2. Speech Becomes Text: When the caller says, "I need a plumber," Lex transcribes the speech into text.
  3. Understanding Intent: The text is passed to our Bedrock Agent, where the Nova-Micro model analyzes it. It recognizes that customer is asking about finding a tradesperson.
  4. Gathering Information: The agent realizes it needs more details. Where does the caller live? When do they need help? It asks follow-up questions, maintaining context throughout.
  5. Taking Action: Once the agent has enough information, it calls our Lambda function with structured data: "Find plumbers in Manchester available this Thursday."
  6. Database Operations: Lambda queries DynamoDB for matching tradespeople, checks their availability, and returns the results.
  7. Crafting a Response: The agent transforms the structured data into natural language: "I found three plumbers available in Manchester this Thursday. The earliest appointment is with John at 9 AM."
  8. Text Becomes Speech: Connect converts this text response into natural-sounding speech.
  9. Back to the Caller: The caller hears the response and the conversation continues until they've successfully booked an appointment.

Behind the Curtain: Teaching AI to Book Appointments

The real magic of our system isn't just in the AWS services—it's in how we configured them to work together. Let's peek behind the curtain.

The Brain of the Operation: Bedrock Agent

Imagine trying to teach someone to book appointments over the phone. You'd need to explain what questions to ask, how to respond to different scenarios, and when to check the calendar. That's essentially what we did with our Bedrock Agent. This is where prompt engineering comes into play - crafting precise instructions that guide the LLM's behavior and responses.
We created detailed instructions that teach the agent how to:
  • Recognize when someone is looking for a specific trade ("I need an electrician" vs. "My lights keep flickering")
  • Ask for missing information in a natural way ("Could you tell me which city you're in?")
  • Confirm details before taking action ("So that's an electrician in Manchester for this Thursday, correct?")
  • Handle unexpected responses ("Actually, I've changed my mind...")

The Contract: API Schema

For our agent to communicate with our business systems, we needed a clear contract. Our API schema defines exactly what actions the agent can take and what information it needs for each. These are organized into action groups that logically group related operations:
  • When searching for tradespeople, it must provide the trade type and location
  • When checking availability, it needs a specific tradesperson ID and date/time
  • When creating a booking, it requires customer details, tradesperson information, and appointment time
This structured approach ensures the agent gathers all necessary information before attempting to take action.

The Data Structure: DynamoDB Tables

The system uses three DynamoDB tables to store all necessary information:
Customers Table: Stores customer profiles including name, location, and contact information.
Tradespeople Table: Contains information about service providers, their specialties, locations, and rates. Indexed to allow searching by trade type and location.
Bookings Table: Records all appointments with references to customers and tradespeople, appointment times, and service details.
This simple data structure supports all the core operations needed for the booking system while maintaining fast query performance.

The Engine Room: Lambda Functions

Behind each action is a specialized Lambda logic that knows exactly how to handle that specific task. When the agent determines a customer wants to book an electrician for Thursday, it doesn't just pass along a vague request—it calls a specific function with structured parameters.
These functions handle all the business logic: finding available tradespeople, checking their schedules, creating booking records, and more. They're designed to be robust, validating inputs and handling edge cases (like what happens when no electricians are available on Thursday).

A Sample Booking Conversation

Here's an example of how a typical booking conversation flows with our system:
Customer: "I need an electrician to fix some wiring in my house."
Assistant: "I'd be happy to help you find an electrician. I see you're not registered with us yet. Could you please provide me with your name and the city that you live in?"
Customer: "My name is Sarah Johnson and I live in Manchester."
Assistant: "Thank you, Sarah. I've registered you. Would you like the cheapest electrician available or the one who can come the soonest?"
Customer: "I'd prefer the soonest available, please."
Assistant: "The soonest available appointment is on Thursday at 10:00 AM with John Smith, who charges £75 per hour. Would you like to book this appointment?"
Customer: "Yes, that works for me."
Assistant: "Could you please describe the problem you're experiencing so I can add it to your booking?"
Customer: "I have some faulty wiring in my kitchen that's causing the lights to flicker."
Assistant: "Great! Your booking with John Smith for Thursday at 10:00 AM is confirmed for your issue with faulty wiring causing flickering lights. You'll receive a confirmation text shortly with all the details. Is there anything else I can help you with today?"
What's remarkable about this conversation is how the system maintains context throughout the entire interaction, just like a human would. It remembers who Sarah is, what she needs, and seamlessly guides her through the booking process without the rigid menu options typical of traditional phone systems.

Deployment: From Code to Working Phone Line in Minutes

The entire system is built using AWS Cloud Development Kit (CDK), allowing for complete infrastructure-as-code deployment. With just a few commands, CDK automatically provisions and configures all necessary resources—from DynamoDB tables and Lambda functions to the Bedrock Agent, Lex bot, and Connect instance.
If you'd like to deploy this system yourself or adapt it for your own use case, the complete source code is available on GitHub . The repository includes detailed instructions for deployment and customization.

Lessons Learned: The Challenges of Teaching Machines to Talk

Building this system taught us valuable lessons. Here are some insights that might help you with similar projects:

When Things Get Slow: Performance Considerations

Even the best-designed system can hit speed bumps:
  • The Cold Start Problem: When Lambda functions haven't been used recently, they can take a moment to "wake up." For production systems handling many calls, we recommend using Provisioned Concurrency to keep functions warm and responsive, or Lambda SnapStart which creates pre-initialized snapshots of your functions to significantly reduce startup times.
  • Database Design Matters: Our DynamoDB tables are specifically designed for booking-related queries. If you're building a different type of system, you'll need to rethink your indexes based on your specific access patterns.
  • LLM Model Selection: There's an important trade-off between model size and response time. Larger models offer more sophisticated understanding but introduce higher latency, while smaller models respond faster but with potentially less nuanced comprehension. Find the right balance where the model is small enough to provide reasonable latency but still smart enough to handle your specific use case effectively.

When Things Go Wrong: Graceful Error Handling

In the real world, errors happen. So it is important to handle them gracefully:
  • When database operations fail, we catch the errors and provide helpful responses rather than technical error messages.
  • If a caller asks for plumbers in a city where we have none, we don't just say "Error: Empty result set"—we say "I'm sorry, we don't have any plumbers available in that area."
  • When callers provide incomplete information, the system asks for clarification rather than failing.
  • If the conversation goes off track, the agent can gently guide it back to the booking process.

What's Next: Future Possibilities

This system is just the beginning. More enhancements could be added like:
  • Support for multiple languages
  • More sophisticated availability management
  • Integration with payment systems
  • Use of Knowledge Base to improve the conversation model with domain-specific knowledge

Wrapping Up: The Future of Voice Interfaces

The days of frustrating automated phone systems are numbered. By combining Amazon Connect's telephony capabilities with the natural language understanding of Bedrock Agent, we've created a voice interface that actually understands callers and helps them accomplish real tasks.
This approach doesn't just make for happier callers—it opens up new possibilities for how businesses interact with customers over the phone. The same architecture could be applied to appointment scheduling, customer service, order processing, and countless other domains.
If you'd like to explore this system further or adapt it for your own needs, the complete source code is available on GitHub .
What voice-based system would you build with these tools?
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