使用 Amazon Connect 构建餐厅电话 AI 接待员
英文标题:Building a restaurant telephony AI host with Amazon Connect
本文介绍如何构建一套面向餐厅的电话语音点餐系统:顾客只需拨打电话,即可在无需 App、网站或登录的情况下完成从问候、菜单咨询到订单确认的全流程。方案以 Amazon Connect 提供电话能力,结合 Amazon Lex V2、Amazon Connect Agentic Voice、Amazon Connect AI agent、MCP 和 Amazon Bedrock AgentCore,实现实时语音交互、对话推理及后端工具调用。系统将电话渠道、AI 对话编排与菜单、购物车、订单和门店等后端能力解耦,便于后续替换或扩展。文章还给出了基于 AWS CDK 的部署前提、架构说明和入站电话呼叫流程。
1.3 MB
101.1 KB
124.1 KB
345.0 KB
141.2 KB
346.5 KB
457.4 KB
199.6 KB
379.4 KB
208.3 KB
4.9 KB
9.5 KB
7.0 KB
128.7 KB
中文
在许多餐厅中,相当大比例的订单仍然通过电话到达,而这些来电通常会由一名已经在柜台服务顾客的员工接听。来电者需要等待,订单由人工记录,繁忙时段会使这两个问题都更加严重。增加 App 或网站能够帮助偏好在线点餐的顾客,但对于希望通过电话下单的人来说并无帮助。
本文将介绍如何构建一套语音点餐系统:它能接听一个电话号码,并从问候到确认完整完成点餐流程,无需 App、无需网站,也无需登录。来电者拨打电话号码后,AI 接待员会向其问候、回答菜单问题、查找附近的自提门店,并通过语音确认订单。该系统使用 Amazon Connect Customer 提供电话渠道,使用 Amazon Lex V2 和 Amazon Connect Agentic Voice 提供实时语音能力,并使用 Amazon Connect Customer AI agents 编排对话;系统再通过 Model Context Protocol (MCP) 和 Amazon Bedrock AgentCore 连接餐厅后端。
该方案专门处理电话渠道。音频通过电话网络而非浏览器传入,系统通过电话号码而非登录账号识别来电者。该方案将 Agent 逻辑和后端服务构建为独立模块,因此点餐逻辑可以独立于调用它的渠道。
本演练将展示如何:
- 使用 AWS Cloud Development Kit (AWS CDK) 部署系统
- 使用 Amazon Connect 接听入站电话,并通过联系流程(contact flow)进行路由。
- 使用 Amazon Connect Agentic Voice(高级 ASR 和 TTS)提供实时语音识别和合成
- 使用 Amazon Connect AI agent 编排对话和后端工具调用。
- 使用 Amazon Connect AI Guardrail 确保对话安全且不偏离主题。
- 通过 AgentCore Gateway 和 MCP,将 Agent 连接到可发现的后端服务工具。
Amazon Connect Agentic Voice 在 Amazon Connect 中原生提供语音层,负责用于听取语音的语音识别,以及用于说话的文本转语音。Amazon Lex V2 bot 同时使用它完成这两项功能,而 Amazon Connect AI agent 负责推理和调用后端。后文将介绍 Agentic Voice 如何加快对话轮次切换。
解决方案概览
该设计将三类职责分离:Amazon Connect 处理电话呼叫,Amazon Connect AI agent 运行对话,后端则保存菜单、购物车、订单和门店信息。电话通过 Amazon Connect 接入后,联系流程会打开一个 Amazon Connect AI agent 会话,并将来电者连接至该 Agent。Amazon Connect Agentic Voice 在整个通话期间提供语音识别和语音合成,AI agent 基于对话进行推理,并通过由 AgentCore Gateway 暴露的 MCP 工具访问后端。由于 MCP 是用于将 Agent 连接至外部工具的开放标准,后端可以在不改动 Agent 的情况下进行变更。
在该方案中,联系流程、Amazon Lex V2 语音层(Amazon Connect Agentic Voice)和 Amazon Connect AI agent 都由 Amazon Connect 配置和管理。你无需将它们作为独立服务单独部署。一次 Amazon Connect 部署即可将电话、语音和 AI agent 整合在一起。AgentCore Gateway 和餐厅后端则是需要你自行构建和集成的部分。
该方案部署以下组件:
- Amazon Connect Customer 提供入站电话、联系流程以及用于接听电话的电话号码。
- Amazon Lex V2 托管联系流程所连接的语音 bot。它使用 Amazon Connect Agentic Voice 处理语音,并将每个对话轮次路由至 AI agent。
- Amazon Connect Agentic Voice 在 Amazon Connect 中原生处理高级 ASR(具有基于置信度的语音结束检测)和富表现力的 TTS。
- Amazon Connect Customer AI agents 提供驱动对话的编排 AI agent,由 Amazon Bedrock 中的 Anthropic Claude Haiku 4.5 提供支持。
- Amazon Connect AI Guardrails 通过内容过滤器、禁止主题和脏话过滤,确保对话安全且不偏离主题。
- AgentCore Gateway 将后端 API 作为 Agent 可发现并可按名称调用的 MCP 工具暴露出来。
- Amazon AppIntegrations 将 AgentCore Gateway 注册为 AI agent 可使用的 MCP 应用程序。
- Amazon API Gateway 为后端提供 REST 端点,并通过 AWS Identity and Access Management (IAM) 进行安全保护。
- AWS Lambda 运行菜单、购物车、订单和门店查询的业务逻辑,并将来电者电话号码写入 Agent 会话。
- Amazon DynamoDB 存储客户档案、订单、菜单项、购物车和门店信息。
- Amazon Location Service 为自提推荐提供地理编码和路线计算能力。
架构图
图 1 展示了该解决方案,其分为四个部分。

图 1:分为四个部分的电话语音点餐解决方案。
A 部分:后端基础设施。 此部分部署餐厅后端。Amazon DynamoDB 保存客户、订单、菜单、购物车和门店数据,Amazon Location Service 处理地址和路线。AWS Lambda 运行业务逻辑,Amazon API Gateway 通过 IAM 授权将其暴露出来。资源按依赖关系顺序部署。
B 部分:AgentCore Gateway。 此部分预置一个 AgentCore Gateway,该网关会在部署时读取 REST API 的 OpenAPI 架构,并将每个端点注册为具名 MCP 工具。该网关使用自定义 JSON Web Token(JWT)授权,并根据 Amazon Connect 实例验证入站令牌。
C 部分:Amazon Connect 实例和 AI agent。 此部分创建 Amazon Connect 实例、Amazon Connect AI Agents 助手和编排 AI agent。它将 AgentCore Gateway 作为 MCP server 注册到 Amazon AppIntegrations 中,并创建一个使用 Amazon Connect Agentic Voice 进行高级 ASR 的 Amazon Lex V2 bot。随后,它定义具有内容安全策略的 AI Guardrail,使用 Anthropic Claude Haiku 4.5 系统提示词定义 AI agent 并附加该 Guardrail,发布 Agent 版本,并关联一个允许 Agent 访问后端工具的安全配置文件。
D 部分:Amazon Connect 电话服务。 此部分创建联系流程并申领电话号码。联系流程是每次入站呼叫的入口。它启用日志记录,将 Agentic Voice 设置为文本转语音,并捕获来电者电话号码。随后,它打开一个 Amazon Connect AI agent 会话,通过 Lambda 函数将来电者电话号码写入该会话,以便 Agent 识别来电者,播放问候语,并将来电者连接至 Amazon Lex V2 bot。Lex bot 提供实时语音层,使用 Agentic Voice Advanced ASR 进行聆听、使用 Agentic Voice TTS 进行说话,而 AI agent 则负责推理和工具调用。
图 1 中的编号标注从端到端追踪该方案:
- 客户拨打由 Amazon Connect 预置的电话号码,或者从其他线路转接至该号码,从而发起通话。
- Amazon Connect 联系流程设置 Agentic Voice,捕获来电者电话号码,打开 Amazon Connect AI Agents 会话,将来电者电话号码写入会话,并向来电者播放问候语。
- 联系流程将来电者连接至 Amazon Lex V2 bot,并在整个对话过程中使用 Amazon Connect Agentic Voice 进行语音识别和合成。
- Amazon Lex V2 将对话路由至 Amazon Connect AI Agents,把对话逻辑委托给编排 AI agent。
- 由 Amazon Bedrock 中 Anthropic Claude Haiku 4.5 驱动、并由用于内容安全的 AI Guardrail 保护的 Amazon Connect AI agent 推动对话,解析来电者位置、获取菜单、管理购物车并下单。
- AI agent 使用 MCP 协议通过 Amazon Bedrock AgentCore Gateway 调用可用工具。
- AgentCore Gateway 将每次工具调用转发至 Amazon API Gateway,后者将请求路由到相应的 AWS Lambda 函数。
- AWS Lambda 针对购物车、订单、菜单和门店数据读写 Amazon DynamoDB,并调用 Amazon Location Service 进行地理编码和最近门店查询。
- AWS CDK 通过一个脚本部署全部八个 stack。
- Amazon CloudWatch 为所有服务提供集中监控、日志记录和告警,所有静态数据均使用 AWS Key Management Service (AWS KMS) 加密。
标注 1 至 8 发生在一次电话通话期间,标注 9 涵盖解决方案的构建和部署方式,标注 10 则涵盖监控和安全保护方式。下一节将暂时搁置部署和运维,进一步聚焦通话本身。
入站呼叫流程
本节从来电者视角跟踪一次通话,从第一次响铃到语音回复。这与图 1 中标注 1 至 6 的运行时路径相同。图 2 将其展示为一个时序流程,因此更容易看清事件的先后顺序。

图 2:入站呼叫流程,Amazon Connect 边界内的组件。
虚线边界标示了由 Amazon Connect 提供的部分。联系流程、Amazon Lex V2 语音层(Amazon Connect Agentic Voice)和 Amazon Connect AI agent 都来自同一次 Amazon Connect 部署,因此你需要通过 Amazon Connect 配置它们,而非将其作为独立服务进行配置。AgentCore Gateway 位于该边界之外,负责将 Agent 连接到你的后端。
图 2 中的编号步骤对应以下通话阶段:
- 来电者拨打电话号码,Amazon Connect 接听电话。
- Amazon Connect 联系流程设置 Agentic Voice,捕获来电者电话号码,打开 Amazon Connect AI agent 会话,将电话号码写入该会话,并在将来电者连接到语音层之前播放问候语。
- Amazon Connect Agentic Voice 在整个对话过程中提供语音识别和合成,将每个对话轮次传递给 Amazon Connect AI agent。
- 当需要菜单、购物车、订单或门店数据时,AI agent 会通过 AgentCore Gateway 调用后端工具,语音回复随后返回给来电者。
前提条件
开始前,请确认你已具备以下条件:
- 一个 AWS 账户
- 已在部署所在 AWS Region 中获得 Anthropic Claude Haiku 4.5 的 Amazon Bedrock 模型访问权限;可在 Amazon Bedrock 控制台的模型访问页面申请。
- 你的账户和 Region 中拥有至少一个 Amazon Connect 电话号码配额;如果你从未申领过号码,请通过 Service Quotas 控制台申请。
- Node.js 18.x 或更高版本,建议使用 24.x。
- 已配置凭证的 AWS Command Line Interface (AWS CLI) 2.x。
- 用于克隆仓库的 git。
- 已在目标账户和 Region 中完成 AWS CDK bootstrap(
npx cdk bootstrap aws://<ACCOUNT_ID>/<REGION>)
部署过程会为你在 Amazon Connect 实例上启用 Contact Lens 和 bot 管理设置,使用 Agentic Voice 的 Amazon Lex V2 bot 以及 Amazon Connect AI agent 均需要这些设置。无需 Docker 或 Python。请在 Amazon Connect Agentic Voice、Anthropic Claude Haiku 4.5、带 AI agents 的 Amazon Connect 和 AgentCore Gateway 均已可用的 Region 部署。美国东部(弗吉尼亚北部)us-east-1 是一个适合开始的区域。
使用 AWS CDK 部署解决方案
完整方案位于 GitHub 上的示例仓库。克隆该仓库并进入项目目录。
git clone https://github.com/aws-samples/sample-restaurant-telephony-ai-host-using-amazon-connect-customer.git
cd sample-restaurant-telephony-ai-host-using-amazon-connect-customer
使用部署前缀运行部署脚本。此前缀会添加到每个资源名称中,因此你可以在同一账户中多次部署该方案。
./scripts/deploy-all.sh --deploymentPrefix qsr-cn
该脚本会运行预检,然后按依赖关系顺序部署每个 AWS CDK stack,并将一个 stack 的输出传递给下一个 stack。它首先构建后端,包括 Amazon DynamoDB 表、Amazon Location Service 资源、AWS Lambda 函数和 Amazon API Gateway REST API,并植入示例菜单和门店数据。随后它会创建
English / 原文
At many restaurants, a large share of orders still arrive by phone, and those calls usually land on a staff member who is already taking care of customers at the counter. Callers wait on hold, orders get written down by hand, and busy periods make both worse. Adding an app or a website helps customers who prefer to order online, but it does nothing for the person who wants to call and order.
In this post, we show you how to build a voice ordering system that answers a phone number and takes the order from greeting to confirmation, with no app, no website, and no sign-in. A caller dials a phone number, and an AI host greets them, answers menu questions, finds a nearby pickup location, and confirms the order out loud. The system uses Amazon Connect Customer for the telephony channel, Amazon Lex V2 with Amazon Connect Agentic Voice for real-time speech, and Amazon Connect Customer AI agents to orchestrate the conversation, connected to a restaurant backend through the Model Context Protocol (MCP) and Amazon Bedrock AgentCore.
This solution handles the telephony channel specifically. The audio arrives over the phone network rather than a browser, and the system identifies the caller by phone number rather than by a login. The solution builds the agent logic and the backend services as separate modules, so the ordering logic stays independent from the channel that calls it.
The walkthrough shows you how to:
- Deploy the system with AWS Cloud Development Kit (AWS CDK)
- Answer an inbound phone call with Amazon Connect and route it through a contact flow.
- Provide real-time speech recognition and synthesis with Amazon Connect Agentic Voice (Advanced ASR and TTS)
- Orchestrate the conversation and backend tool calls with an Amazon Connect AI agent.
- Keep the conversation safe and on topic with an Amazon Connect AI Guardrail.
- Connect the agent to backend services as discoverable tools through AgentCore Gateway and MCP.
Amazon Connect Agentic Voice provides the speech layer natively in Amazon Connect, handling speech recognition for listening and text-to-speech for speaking. The Amazon Lex V2 bot uses it for both, while an Amazon Connect AI agent handles the reasoning and the calls to the backend. A later section covers how Agentic Voice speeds up turn-taking.
Solution overview
The design keeps three things apart. Amazon Connect handles the call, an Amazon Connect AI agent runs the conversation, and the backend holds the menu, carts, orders, and locations. A call comes in through Amazon Connect, a contact flow opens an Amazon Connect AI agent session and connects the caller to the agent. Amazon Connect Agentic Voice provides speech recognition and synthesis throughout the call, the AI agent reasons over the conversation, and it reaches the backend through MCP tools exposed by AgentCore Gateway. Because MCP is an open standard for connecting an agent to external tools, the backend can change without touching the agent.
In this solution, the contact flow, the Amazon Lex V2 speech layer (Amazon Connect Agentic Voice), and the Amazon Connect AI agent are all provisioned and managed through Amazon Connect. You do not stand them up as separate services. A single Amazon Connect deployment brings the telephony, the speech, and the AI agent together. The AgentCore Gateway and the restaurant backend are the parts you build and integrate yourself.
The solution deploys the following:
- Amazon Connect Customer provides the inbound telephony, the contact flow, and the phone number that accepts calls.
- Amazon Lex V2 hosts the voice bot that the contact flow connects the caller to. It uses Amazon Connect Agentic Voice for speech and routes each turn to the AI agent.
- Amazon Connect Agentic Voice handles Advanced ASR (with confidence-based end-of-turn detection) and expressive TTS, natively in Amazon Connect.
- Amazon Connect Customer AI agents provide the orchestration AI agent that drives the conversation, powered by Anthropic Claude Haiku 4.5 in Amazon Bedrock.
- Amazon Connect AI Guardrails keep the conversation safe and on topic with content filters, denied topics, and profanity filtering.
- AgentCore Gateway exposes the backend APIs as MCP tools the agent can discover and call by name.
- Amazon AppIntegrations registers the AgentCore Gateway as an MCP application the AI agent can use.
- Amazon API Gateway fronts the backend with REST endpoints secured by AWS Identity and Access Management (IAM).
- AWS Lambda runs the business logic for menus, carts, orders, and location lookups, and pushes the caller’s phone number into the agent session.
- Amazon DynamoDB stores customer profiles, orders, menu items, carts, and locations.
- Amazon Location Service provides geocoding and route calculation for pickup recommendations.
Architecture diagram
Figure 1 shows the solution, which is organized into four sections.

Figure 1: The telephony voice ordering solution, organized into four sections.
Section A, backend infrastructure. This section deploys the restaurant backend. Amazon DynamoDB holds the customer, order, menu, cart, and location data, and Amazon Location Service handles addresses and routing. AWS Lambda runs the business logic, and Amazon API Gateway exposes it with IAM authorization. Resources deploy in dependency order.
Section B, AgentCore Gateway. This section provisions an AgentCore Gateway that reads the REST API’s OpenAPI schema at deploy time and registers each endpoint as a named MCP tool. The gateway uses custom JSON Web Token (JWT) authorization and validates inbound tokens against the Amazon Connect instance.
Section C, Amazon Connect instance and AI agent. This section creates the Amazon Connect instance, the Amazon Connect AI Agents assistant, and the orchestration AI agent. It registers the AgentCore Gateway as an MCP server in Amazon AppIntegrations and creates an Amazon Lex V2 bot with Amazon Connect Agentic Voice for Advanced ASR. It then defines the AI Guardrail with content safety policies, defines the AI agent with the Anthropic Claude Haiku 4.5 system prompt and the guardrail attached, publishes the agent version, and associates a security profile that grants the agent access to the backend tools.
Section D, Amazon Connect telephony. This section creates the contact flow and claims the phone number. The contact flow is the entry point for every inbound call. It enables logging, sets Agentic Voice for text-to-speech, and captures the caller’s phone number. It then opens an Amazon Connect AI agent session, pushes the caller’s phone number into that session with a Lambda function so the agent can identify the caller, plays the greeting, and connects the caller to the Amazon Lex V2 bot. The Lex bot provides the real-time speech layer, using Agentic Voice Advanced ASR to listen and Agentic Voice TTS to speak, while the AI agent handles reasoning and tool calls.
The numbered callouts in Figure 1 trace the solution end to end:
- A call is initiated to the phone number provisioned by Amazon Connect , either by a customer or forwarded from another line.
- The Amazon Connect contact flow sets the Agentic Voice, captures the caller’s phone number, opens an Amazon Connect AI Agents session, pushes the caller’s phone number into the session, and plays the greeting to the caller.
- The contact flow connects the caller to the Amazon Lex V2 bot with Amazon Connect Agentic Voice for speech recognition and synthesis throughout the conversation.
- Amazon Lex V2 routes the conversation to Amazon Connect AI Agents , delegating the conversation logic to the orchestration AI agent.
- The Amazon Connect AI agent, powered by Anthropic Claude Haiku 4.5 in Amazon Bedrock and protected by an AI Guardrail for content safety, drives the conversation, resolving the caller’s location, fetching the menu, managing the cart, and placing the order.
- The AI agent calls the available tools through Amazon Bedrock AgentCore Gateway using the MCP protocol.
- AgentCore Gateway forwards each tool call to Amazon API Gateway , which routes the request to the appropriate AWS Lambda function.
- AWS Lambda reads and writes Amazon DynamoDB for cart, order, menu, and location data, and calls Amazon Location Service for geocoding and nearest-location lookup.
- AWS CDK deploys all eight stacks in a single script.
- Amazon CloudWatch provides centralized monitoring, logging, and alerting across all services, and all data at rest is encrypted using AWS Key Management Service (AWS KMS).
Callouts 1 through 8 happen during a single phone call, callout 9 covers how the solution is built and deployed, and callout 10 covers how it is monitored and secured. The following section sets deployment and operations aside and gets closer to the call itself.
Inbound call flow
This section follows one call from the caller’s side, from the first ring to the spoken reply. It is the same runtime path as callouts 1 through 6 in Figure 1. Figure 2 shows it as a sequence so the order of events is more straightforward to see.

Figure 2: Inbound call flow, with the components inside the Amazon Connect boundary.
The dashed boundary marks what Amazon Connect provides. The contact flow, the Amazon Lex V2 speech layer (Amazon Connect Agentic Voice), and the Amazon Connect AI agent all come from one Amazon Connect deployment, so you configure them through Amazon Connect rather than as standalone services. The AgentCore Gateway sits outside the boundary and connects the agent to your backend.
The numbered steps in Figure 2 correspond to these stages of the call:
- The caller dials the phone number, and Amazon Connect answers.
- The Amazon Connect contact flow sets the Agentic Voice, captures the caller’s phone number, opens an Amazon Connect AI agent session, pushes the number into that session, and plays the greeting before connecting the caller to the speech layer.
- Amazon Connect Agentic Voice provides speech recognition and synthesis throughout the conversation, passing each turn to the Amazon Connect AI agent.
- The AI agent calls backend tools through AgentCore Gateway when it needs menu, cart, order, or location data, and the spoken reply flows back to the caller.
Prerequisites
Before you begin, verify you have the following in place:
- An AWS account
- Amazon Bedrock model access for Anthropic Claude Haiku 4.5 in the AWS Region where you deploy, requested on the model access page in the Amazon Bedrock console
- An Amazon Connect phone number quota of at least one in your account and Region, requested through the Service Quotas console if you have never claimed a number.
- Node.js 18.x or later, with 24.x recommended.
- AWS Command Line Interface (AWS CLI) 2.x configured with credentials.
- git to clone the repository.
- AWS CDK bootstrapped in your target account and Region (
npx cdk bootstrap aws://<ACCOUNT_ID>/<REGION>)
The deployment enables the Contact Lens and bot management settings on the Amazon Connect instance for you, which the Amazon Lex V2 bot with Agentic Voice and the Amazon Connect AI agent require. No Docker or Python is needed. Deploy in a Region where Amazon Connect Agentic Voice, Anthropic Claude Haiku 4.5, Amazon Connect with AI agents, and AgentCore Gateway are all available. US East (N. Virginia), us-east-1, is a good place to start.
Deploy the solution with AWS CDK
The full solution is available in the sample repository on GitHub. Clone the repository and change into the project directory.
git clone https://github.com/aws-samples/sample-restaurant-telephony-ai-host-using-amazon-connect-customer.git
cd sample-restaurant-telephony-ai-host-using-amazon-connect-customer
Run the deployment script with a deployment prefix. The prefix is added to every resource name, so you can deploy the solution more than once in the same account.
./scripts/deploy-all.sh --deploymentPrefix qsr-cn
The script runs a preflight check and then deploys each AWS CDK stack in dependency order, passing the outputs of one stack to the next. It builds the backend first, with the Amazon DynamoDB tables, the Amazon Location Service resources, the AWS Lambda functions, and the Amazon API Gateway REST API, and seeds sample menu and location data. It then creates the Amazon Connect instance and the Amazon Connect AI Agents assistant, adds the AgentCore Gateway in front of the backend APIs, defines the Amazon Lex V2 bot, the AI Guardrail, and the orchestration AI agent, and finally creates the contact flow and claims the phone number. The gateway is deployed after the Connect instance because it validates tokens against that instance.
When the script completes, it prints the number to dial:
Your restaurant AI host is live at +1XXXXXXXXXX — dial to test.
The job of the telephony layer is narrow. Amazon Connect answers the call, and a contact flow decides what happens next. The contact flow runs a short sequence of steps for every inbound call.

Figure 3: Contact flow steps, from the inbound call to the disconnect.
It first enables Contact Lens logging, so each step is recorded in Amazon CloudWatch for debugging. It sets the voice for the call to Amazon Connect Agentic Voice, so every spoken response uses the agentic text-to-speech engine. It captures the caller’s phone number as a contact attribute. It opens an Amazon Connect AI agent session tied to the assistant, which the Lex bot requires, and stores the session so the rest of the call can reference it. It then invokes a Lambda function that pushes the caller’s phone number into the AI agent session, so the agent can identify the caller without asking. Finally, it plays a short greeting and connects the caller to the Amazon Lex V2 bot, which provides the real-time speech layer for the rest of the call, using Agentic Voice Advanced ASR to listen and Agentic Voice TTS to speak.
When the AI agent finishes, the bot returns control to the contact flow, which reads the outcome and ends the call. The agent signals the end with one of two outcomes. Complete ends a finished order, and Escalate is available when a caller asks for a person. In this solution both outcomes disconnect the call, but because the call lives in Amazon Connect, you can wire the Escalate path to an Amazon Connect queue to transfer the caller to a live agent with the full conversation context.
Storing menus, carts, and orders
Five Amazon DynamoDB tables cover the ordering workflow. The Customers table stores profiles, including name, phone, and loyalty information, which you can use to recognize a returning caller. The Orders table keeps order history along with the pickup location. The Menu table holds items, prices, and availability, which can differ by location. The Carts table holds in-progress carts and uses a time-to-live value so abandoned carts clean themselves up. The Locations table holds restaurant details such as coordinates, hours, and tax rates that the agent uses for totals and recommendations. DynamoDB on-demand capacity scales with traffic, so there is no throughput to manage.
Finding a pickup location
Amazon Location Service helps a caller find a convenient pickup spot without typing anything. A phone caller has no browser to share a location, so the agent asks for a ZIP code or a cross-street and uses Amazon Location Service to turn that into coordinates. From there, the backend can do a few things with those coordinates. It can find the nearest restaurants, rank them by driving time rather than straight-line distance so it favors a short detour along the caller’s route, or geocode a specific address. That lets the agent say something a caller can act on, such as “the closest location is on Main Street, about five minutes away,” instead of reading back an internal code.
Running the conversation with Amazon Connect AI Agents and Agentic Voice
Two managed capabilities run the conversation. Amazon Connect Agentic Voice through the Amazon Lex V2 bot provides the voice, and an Amazon Connect AI agent provides the reasoning.
Amazon Connect Agentic Voice handles the speech work within the call, natively in Amazon Connect. Its Advanced ASR recognizes speech across a range of accents and tolerates the background noise that comes with a phone line, and it uses confidence-based end-of-turn detection to tell when the caller has finished, rather than waiting out a fixed silence window. That shortens the pause between the caller finishing a sentence and the agent responding, so the conversation feels more natural. Its text-to-speech generates expressive voice for the agent’s replies, and a caller can interrupt the way people do on real calls. Because the contact flow selects the voice, the bot itself carries no voice setting, and changing how the agent sounds is an edit to the contact flow rather than a redeployment of the bot. The end-of-turn confidence and silence thresholds can be tuned per intent for cases such as reading back a payment card number or an address. For guidance, see Agentic voice best practices.
The Amazon Connect AI agent, powered by Anthropic Claude Haiku 4.5, decides what to do at each turn. Its system prompt is written for voice, so responses stay short, prices are spoken naturally, such as “five ninety-nine,” and internal IDs are never read out loud. The agent greets the caller, answers menu questions, resolves a pickup location, builds the cart, reads it back for confirmation, and places the order. It reaches the backend only through the tools that AgentCore Gateway exposes, so the conversation logic stays separate from the backend.
The AI agent never calls the backend Lambda functions directly. AgentCore Gateway sits in between and presents the backend endpoints as MCP tools that the agent discovers and calls by name, covering menu lookups, cart operations, order placement, customer and order history, geocoding, and location search. The gateway is registered with the Amazon Connect AI Agents assistant as an MCP application through Amazon AppIntegrations, and it authorizes each call with a JSON Web Token that it validates against the Amazon Connect instance.
That layer is what keeps the design loosely coupled. When the agent calls a tool such as PlaceOrder, the gateway turns it into a REST request to Amazon API Gateway, which routes it to the matching AWS Lambda function. Because the agent talks to named tools rather than to specific functions, you can change a backend handler or add a tool without changing the agent. The same backend can also serve other channels, since they all place orders against the same tools and data.
Figure 4 shows how a single tool call travels from the agent to the backend.

Figure 4: A single tool call, from the AI agent to the backend.
Recognizing a caller without a login
A phone caller does not sign in, so the system uses the caller’s phone number as the basis for identity. The Amazon Connect contact flow captures the caller’s phone number, and a Lambda function pushes it into the AI agent session, where the agent reads it as a session attribute. The agent turns that number into a customer ID and uses it for every tool call in the conversation.
That ID keeps each caller’s cart separate and stamps the finished order with the number it came from, so an order can be matched back to a caller afterwards. If no number is available at all, because the caller blocks caller ID, the agent generates an anonymous ID for the session and the order still goes through. Each caller gets an isolated cart, so concurrent calls never interfere with one another. The sample also exposes customer profile and order history as tools, so you can extend the agent to greet a returning caller by name or offer their last order.
This recognizes a returning caller without asking for a login, but it is not identity verification, and the caller’s phone number should not be treated as proof of who is calling. A production deployment that needs verified identity can add a step such as a one-time passcode.
Keeping the conversation safe with AI Guardrails
The AI agent has an Amazon Connect AI Guardrail attached that keeps the conversation safe and on topic. The guardrail applies content filters for harmful categories such as hate, insults, sexual content, violence, misconduct, and prompt attacks. It blocks a set of denied topics such as political discussion and financial investment advice, and it filters profanity with both a managed list and a custom word list.
When a caller says something off topic or unsafe, the guardrail intervenes and the agent replies with a set message, such as “I am sorry, I can only help with restaurant orders,” and steers the conversation back to the order. The guardrail is defined and attached to the agent in the same AWS CDK stack, so it deploys with the rest of the solution and needs no console steps.
Guardrail strength is worth tuning against your own prompt rather than setting as high as it goes. Filters that are too broad will block legitimate turns, and personally identifiable information filters in particular can catch the address or ZIP code a caller has to give to find a pickup location.
Ordering walkthrough
Dial the number from the deploy output. The agent greets you and asks what you would like. You can speak naturally, ask about the menu, give a ZIP code for pickup, and confirm the order, all by voice. While the caller talks, the agent calls backend tools in the background, so there are no pauses while data loads.
You can follow the call in Amazon CloudWatch Logs. The contact flow logs show the call setup, the Amazon Connect AI agent logs show the conversation turns and the tool calls, and the order lands in the Orders table with its total and estimated ready time.
Cost
You pay for the AWS services the system uses. As of July 2026, running this solution with the default settings in US East (N. Virginia) costs about $35 per month for 1,000 voice orders that average five minutes each.
The largest line items are the inbound call minutes on Amazon Connect, the Anthropic Claude Haiku 4.5 tokens for orchestration, and the Amazon Lex V2 speech requests. The solution claims a local Direct Inward Dialing (DID) number by default, which keeps the per-minute rate low. Switching to a toll-free number raises it. There are no always-on compute charges, because Amazon Connect and the AI services bill by usage. Prices change, so check the pricing page for each service and set up a budget in AWS Cost Explorer to track spend.
Clean up
To avoid ongoing charges, remove the resources when you are done. The cleanup script deletes the stacks in reverse order so each stack is removed before the ones it depends on.
./scripts/cleanup-all.sh --force --deploymentPrefix qsr-cn
Cleanup is destructive. It releases the phone number, deletes the order history in Amazon DynamoDB, and removes the Amazon Connect instance, the Amazon Connect AI Agents assistant, the AI agent, the AI Guardrail, the Amazon Lex V2 bot, and the AgentCore Gateway. Back up anything you want to keep first. When the script finishes, confirm in the AWS CloudFormation console that all eight stacks show as deleted and that the phone number has been released.
Conclusion
In this post, we showed you how to build a telephony voice ordering system that answers a phone call and takes an order end to end. Amazon Connect answers the call and runs a contact flow, Amazon Connect Agentic Voice provides real-time speech recognition and synthesis, an Amazon Connect AI agent handles the reasoning with an AI Guardrail keeping it safe and on topic, and AgentCore Gateway connects the agent to the backend through MCP tools. Because the agent talks to tools rather than to specific functions, you can change the backend or add tools without touching the agent, and the same backend can serve other channels.
To get started, visit the sample repository on GitHub and adapt it to your menu and locations.
Additional resources
About the authors
Sergio Barraza
Sergio is a Senior Technical Account Manager at AWS, helping customers design and optimize cloud solutions. With more than 25 years in software development, he guides customers through AWS service adoption. Outside work, Sergio plays guitar, piano, and drums, and practices Wing Chun Kung Fu.
Salman Ahmed
Salman is a Senior Technical Account Manager at AWS, specializing in helping customers design, implement, and optimize their AWS environments. He combines deep networking expertise with a passion for exploring emerging technologies to help organizations get the most out of their cloud investments. Outside of work, he enjoys photography, traveling, and watching his favorite sports teams.
Ravi Kumar
Ravi is a Senior Technical Account Manager in AWS Enterprise Support who helps customers in the travel and hospitality industry run their cloud operations. He has more than 20 years of IT experience and explores applications of generative AI in cloud computing. Outside of work, Ravi enjoys painting, cricket, and traveling to new places.