
Amazon Connect Custom Bot with Bedrock Multi Agent Collaboration and Human Escalation
Integrate your Bedrock Agents as Contact Center Agents providing long-running invocations and free form interactions.
Enrique Rodriguez
Amazon Employee
Published Feb 26, 2025
While Amazon Lex could be suitable for basic chatbot integration in Amazon Connect that offers native Amazon Q integration, which is ideal for companies without extensive generative AI expertise seeking quick deployment of AI-powered customer service capabilities (see Amazon Q in Connect documentation), some organizations require more flexibility and control over their AI capabilities, custom reasoning workflows, or sophisticated multi-agent architectures.
This project implements a custom chatbot solution for Amazon Connect that leverages Amazon Bedrock Agents, providing advanced capabilities for companies that need to:
- Execute long-running reasoning or multi-agent workflows
- Integrate with custom knowledge bases and Bedrock Agents
- Implement asynchronous bot interactions
- Build complex, customized conversation flows
The system is designed to provide AI responses and interactions, while maintaining the ability to escalate to human agents when necessary, ensuring optimal customer service delivery.
The solution architecture consists of several key components:
Amazon Connect Instance (existing) for customer interaction management
AWS Lambda functions, DynamoDB tables and SNS Topic for chat processing and bot initialization.
Amazon Bedrock Agent (this repo) for AI-powered responses

- Customer initiates chat in Connect
- a Inside the contact flow start Bot Lambda initializes the session and store contact id
- b For every customer message Chat Bot Lambda process that message and responds.
- Bedrock Agent is invoked, it could be a single agent or multi agent in a collaboration scheme.
- Escalation is handled by specific Agent or Action Group. With RETURN CONTROL the agent signal the application the specific action (escalation) and parameters needed for escalation (order_id, issue, ticket, or other defined)
- Amazon Connect identifies the action and moves the contact to a human agent, to continue the interaction with the customer.

For every turn the ChatBot Lambda function parses the message content and invokes the Bedrock Agent. Then it sends the response back to the chat session.
If the response is a dictionary, meaning
RETURN_CONTROL
type of response, that will be signaled to Amazon Connect using Contact Attributes:You need a Amazon Connect Instance. If you don't have one already you can follow this guide.
A Bedrock agent is needed and it's not deployed in this stack.If you dont have at least 1 working agent you can easily create one. Here are some options:
- Multi-Agent Collaboration System with escalation using CDK. Recommended, this are the agents in the diagram and in the demo.
- Create and configure agent manually (manually)
- Amazon Bedrock Agent Samples For mor examples and dive deep.
New to CDK? Start here to learn how to:
- Install CDK and dependencies
- Configure your environment
- Bootstrap your AWS account and region
Clone the repo:
Set up environment:
Deploy the stack:
Replace
<YOUR INSTANCE ID>
with your Amazon Connect Instance IdAfter deployed, go to the ChatBot Lambda function and update the
AGENT_ALIAS_ID
and AGENT_ID
environment variables :
The
AGENT_ID
can be seen in bedrock agent console, and TSTALIASID is the default alias ID for the first agent (Draft version).If you passed a instance_id to the stack deployment, a contact flow called
Custom Bot Flow via CDK
will be created in that instance with CDK.If you want to do it manually, download the Flow Definition and import that in your Amazon Connect Instance. After importing, make sure you are invoking your
StartBot
Lambda function and using BasicQueue
in Set Working Queue
block.Invoke AWS Lambda function Block

Set working Queue Block

Then save and publish the flow.
In order to test the chatbot, go to your Amazon Connect Instance and Test Chat using the newly created
Custom Bot Flow via CDK

Just interact with your chatbot, in this example we have a multi agent order support and escalation agent.

For information about securing your implementation, please refer to the Amazon Bedrock Security documentation. This will help you configure Amazon Bedrock according to your security and compliance requirements.
The main cost components for this project include:
- Amazon Connect Chat: 0,004 USD per message
- AWS Lambda: Likely covered by free tier for this demo (1 million free requests and 400,000 GB-seconds of compute time per month)
- Amazon SNS (no charges for lambda delivery)
To remove all resources:
- Using CDK CLI: Run
cdk destroy
- Using AWS Console: Navigate to CloudFormation and select "Delete"
Enjoy building!
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.