Amazon Bedrock AgentCoreとNova 2 Sonicを活用したマルチチャネル注文システム
AWS公式ブログは、Amazon Bedrock AgentCoreとAmazon Nova 2 Sonicを用いたマルチチャネル音声注文システムの構築手順、CDK・MCPを活用したスケーラブルなアーキテクチャ設計について解説している。
キーポイント
マルチチャネル音声AIインフラの構築
AWS CDKを用いてフロントエンド、AIエージェント、バックエンドを分離した注文システム基盤をデプロイし、自動スケーリングで運用負荷を低減する手順を示す。
リアルタイム音声処理エージェントの実装
StrandsフレームワークとAmazon Nova 2 Sonic(Speech-to-Speechモデル)を組み合わせ、AgentCore Runtime上で双方向音声ストリームの処理と会話コンテキストの維持を実現する。
バックエンド連携のためのMCP活用
Model Context Protocol(MCP)をAgentCore Gateway経由で採用し、認証・注文処理・ロケーション推奨など既存バックエンドサービスと緊密な結合を避けつつ標準化された連携を行う。
モジュール化された実装とテスト
認証、注文処理、推奨機能を独立モジュールとして提供し、サンプルメニューデータ付きのバックエンドで実際の注文シナリオ(ルート別ピックアップ推奨など)をテスト可能にする。
影響分析・編集コメントを表示
影響分析
本記事は、音声エージェントの実用化において「双方向音声モデル」と「MCPによる標準化されたバックエンド連携」を組み合わせる実装パターンを示しており、企業内のAIプロジェクトの基盤設計に直接応用できる。AWSエコシステム内でのエージェント構築コストを下げ、音声AIのビジネス展開を加速させる指針となる。
編集コメント
公式チュートリアル形式ではあるが、Nova 2 Sonicの音声対話性能とMCPによるバックエンド連携の実装例は、現在進行形のエージェント構築ベストプラクティスを可視化しており実務参考价值が高い。AWSエコシステム限定の解説ではあるものの、音声エージェントの実装パターンとして他プラットフォームにも応用可能な知見が含まれる。
Introduction
モバイルアプリ、ウェブサイト、音声インターフェース across に対応する音声対応注文システムを構築する(オムニチャネル (omnichannel) アプローチ)には、現実的な課題が伴います。双方向の音声ストリームを処理し、複数回のやり取りを通じて会話の文脈を維持し、密結合を避けてバックエンドサービス (backend services) と統合し、ピーク時のトラフィックに対応できるようスケーリングする必要があります。
この記事では、Amazon Bedrock AgentCore(エージェントプラットフォーム (agentic platform))と Amazon Nova 2 Sonic を使用して、完全なオムニチャネル注文システムを構築する方法をご紹介します。このプラットフォームは、任意のフレームワークと基盤モデルを用いて、大規模かつ安全に高効率なAIエージェントを構築・デプロイ・運用するために設計されています。認証の処理、注文の処理、場所に基づくレコメンデーションの提供を行うインフラストラクチャをデプロイします。このシステムは自動的にスケーリングするマネージドサービスを使用しており、音声AIアプリケーション構築時の運用オーバーヘッドを削減します。最終的には、複数の顧客接点で音声注文を処理する動作中のシステムが完成します。AIオーケストレーションレイヤーはサンプルメニューデータ付きのサンプルバックエンドアーキテクチャに接続しており、この種のプロジェクトの実装において初期優位性をもたらします。このプロジェクトはモジュール化されており、既存のバックエンドAPIとの統合にコンポーネントを再利用したい場合に柔軟性をもたらします。
この記事では、以下の方法について学びます:
- AWS Cloud Development Kit(AWS CDK)を使用して、マルチチャネルの音声AI注文インフラストラクチャをデプロイする
- AgentCore Runtime にホストされた Amazon Nova 2 Sonic を使用して Strands でエージェントを実装し、リアルタイム音声処理を行う
- AgentCore Gateway を介して Model Context Protocol(MCP)を使用して、AIエージェントをバックエンドサービスに接続する
- ルートに基づくピックアップレコメンデーションを含む現実的な注文シナリオでシステムをテストする
Amazon Nova 2 Sonic は、Amazon Bedrock を通じて利用可能なスピーチ・トゥ・スピーチ基盤モデル (speech-to-speech foundation model) であり、リアルタイムの音声対話に使用できます。Amazon Bedrock AgentCore と組み合わせることで、すべての顧客接点で自然な音声注文が可能になります。
Solution overview
このソリューションアーキテクチャは、フロントエンド (frontend)、AIエージェント、バックエンドサービス (backend services) を独立したコンポーネントとして分離します。この分離により、各コンポーネントを個別に開発・スケーリングできます。MCP は、AIアプリケーションを外部データソース、ツール、ワークフローに接続するためのオープン標準です。これはエージェントとバックエンドサービス間の標準化された通信を提供します。
このソリューションは以下のものをデプロイします:
- Amazon Cognito – ユーザー認証を処理し、安全なAPIアクセス用の一時的なAWS資格情報を提供します。OAuth 2.0に準拠している限り、お好みのIDP(Identity Provider)に変更することも可能です。
- Amazon Bedrock AgentCore Runtime – microVM(マイクロ仮想マシン)分離機能でAIエージェントをホストします。各ユーザーセッションは独立した仮想マシン上で実行されるため、高負荷時でも顧客セッションのセキュリティとパフォーマンスが維持されます。これにより、ある顧客のセッションが他のセッションのパフォーマンスに影響を与えたり、データをアクセスしたりするのを防ぎます。
- Amazon Bedrock AgentCore Gateway – 大規模なツール構築、デプロイ、検出、接続のための安全な開発者向け機能を提供し、エージェントとビジネスロジック間の標準化された通信を実現します。これにより、密結合を避けつつバックエンドの変更や新ツールの追加を統合コードの書き換えなしで行うことができます。
- Amazon API Gateway – AWS Identity and Access Management(IAM)ベースの認可を用いて、Representational State Transfer(REST)エンドポイントを介してバックエンドサービスを公開します。
- AWS Lambda – メニュー取得、注文処理、ロケーションサービス用のビジネスロジックを実行します。
- Amazon DynamoDB – 顧客プロファイル、注文、メニュー項目、ショッピングカートを単一桁ミリ秒のレイテンシ(Single-digit millisecond latency)で保存します。
- AWS Location Services – ピックアップ推奨のためのロケーションベースの機能を提供します。
- AWS Amplify – フロントエンドアプリケーションをホストします。
Architecture diagram
The following diagram represents the solution architecture, which contains three key sections:
Section A: Backend infrastructure
このセクションでは、インフラストラクチャ・アズ・コード(Infrastructure as Code)を使用してサンプルレストランのアーキテクチャをバックエンドサービスとしてデプロイします。顧客情報、注文、メニュー、カート、ロケーションのデータストレージをプロビジョニングします。また、住所処理とマッピング用のロケーションベースサービス、ビジネスロジック用のLambda関数、外部アクセス用のAPIレイヤー、ユーザー認証・認可サービスも設定します。リソースは適切な依存関係の順序でデプロイされます。
Section B: AgentCore Gateway
このセクションではAgentCore Gatewayのインフラストラクチャをデプロイします。必要なIAMサービス権限(IAM service permissions)をプロビジョニングし、AgentCore Gatewayサービスを作成し、バックエンドエンドポイントをエージェントがアクセス可能なツールとして公開するためのAPI統合(API integration)を設定します。
Section C: AgentCore Runtime and ECR image
このセクションではAgentCore Runtime環境をデプロイします。コンテナストレージ(Container Storage)用のAmazon ECR、ソースアップロード(Source Uploads)用のAmazon S3、ビルド自動化(Build Automation)用のAWS CodeBuild、および必要なIAM権限をプロビジョニングします。AgentCore RuntimeサービスはWebSocketプロトコル(WebSocket protocol)で構成されます。
Section D: AWS Amplify
このセクションではAWS Amplifyを使用してフロントエンドアプリケーションをデプロイします。デプロイ設定でAmplifyホスティングサービスをプロビジョニングし、バックエンドの出力から必要なフロントエンド設定を生成します。ビルドされたWebアプリケーションがデプロイされ、完了後にAmplify URL経由でアクセス可能になります。
ユーザーリクエストフロー:
- ユーザーは、ブラウザまたはモバイルデバイスからAWS AmplifyでホストされているWebアプリケーションにアクセスします。
- ユーザーは、ユーザー名とパスワードを使用してAmazon Cognitoで認証し、JWTトークン(Access TokenおよびID Token)を受信します。
- フロントエンドは、Cognito Identity PoolとID Tokenを交換し、一時的なAWS認証情報(Access Key、Secret Key、Session Token)を取得します。
- フロントエンドは、AgentCore Runtimeに対してSigV4署名付きWebSocket接続を開き、ID確認のために最初のメッセージとしてAccess Tokenを送信します。
- AgentCore Runtimeにホストされたエージェントは、Cognito GetUser APIを呼び出してAccess Tokenを検証し、顧客の認証済み名前、メールアドレス、customerIdを取得します。
- AgentCore Runtimeは、Amazon Bedrock上でNova 2 Sonicモデルを初期化し、認証済み顧客のコンテキストを含むパーソナライズされたシステムプロンプト(system prompt)を構築します。
- AgentCore Runtimeは、SigV4認証を使用してMCPクライアント(MCP)としてAgentCore Gatewayに接続し、利用可能なツールを検出します。
- ユーザーが発注内容を音声で入力します。エージェントはNova 2 Sonicを通じて音声入力を処理し、MCPを使用してAgentCore Gateway経由でツールを非同期に呼び出します。
- AgentCore Gatewayは、バックエンドのREST API(REST APIs)をMCPツールとして公開し、エージェントが名前で検出して呼び出せるようにします。エージェントがツールを呼び出すと、AgentCore GatewayはそのリクエストをREST APIコールとしてAPI Gatewayに転送し、API Gatewayは適切なLambda関数(Lambda function)へルーティングします。Lambda関数はDynamoDBテーブル(DynamoDB tables)およびAWS Location Servicesをクエリします。
- Nova 2 Sonicは、ツールの結果を反映した文脈付きの音声応答を生成し、WebSocket接続経由でユーザーへストリーミング配信します。
前提条件
開始する前に、以下の準備が整っていることを確認してください。
- AWSアカウント
- このソリューションをデプロイするのと同じAWS Regionにおいて、Amazon Nova 2 Sonic用の基盤モデル(Foundation Model, FM)へのアクセス権限
- Node.js 20.x以降(AWS CDKデプロイに必要)
- Python 3.13以降(エージェントランタイムおよびデプロイスクリプトに必要)
- 認証情報が設定されたAWS Command Line Interface(AWS CLI)2.x
- AWS CDK CLI 2.x:
npm install -g aws-cdk(インフラストラクチャのデプロイに必要)
- 対象のアカウント/RegionでのCDKブートストラップ:
npx cdk bootstrap
- Boto3 1.38.0以降(bedrock-agentcore-controlサービスサポートに必要)。
python3 -m pip install --upgrade boto3 botocore --break-system-packagesを使用してインストール
- 追加のPythonパッケージ:
python3 -m pip install email-validator pyyaml --break-system-packages
- aws-samples GitHubリポジトリからダウンロードされた関連コード
AWS CDKを使用したソリューションリソースのデプロイ
関連コードを格納したGitHubリポジトリをクローンし、プロジェクトディレクトリに移動します。
git clone https://github.com/aws-samples/sample-omnichannel-ordering-with-amazon-bedrock-agentcore-and-nova-soniccd sample-omnichannel-ordering-with-amazon-bedrock-agentcore-and-nova-sonic
deployment scriptを実行してください。両方のパラメータが必要です。メールアドレスには、初期のCognitoテストユーザー用の一時的なパスワードが送信されます。
./deploy-all.sh --user-email --user-name ""
スクリプトはまず、Node.js、Python、AWS CLI、CDK、認証情報、CDK bootstrap(初期化)、およびBedrock Nova 2 Sonicモデルへのアクセスがすべて準備されているかを確認する事前チェック(preflight checks)を実行します。いずれかのチェックに失敗した場合、不足しているものを報告し、可能なものは自動インストールするかどうかを尋ねます。
事前チェックが完了すると、スクリプトは5つのステップを実行します。ステップ1から3は完全に自動化されています。ステップ4(Synthetic Data)では、近くの飲食店を検索するための中心点として使用する都市名、郵便番号、または住所、検索する食品の種類(例:ピザ、ハンバーガー、カフェ、サンドイッチ、タコス)、顧客の住所として同じアドレスを再利用するかどうか、および生成されたデータをDynamoDBに書き込む前の確認について入力を求められます。ステップ5(Password Setup)では、メールで送信された一時的なCognitoパスワードを任意に変更するかどうかを尋ねられます。はいを選択した場合、メールから一時的なパスワードを入力し、Cognitoのポリシー(8文字以上、大文字、小文字、数字、記号を含む)を満たす新しい恒久的なパスワードを設定します。
完了後、スクリプトはアプリケーションにアクセスするために使用するフロントエンドURL(例:https://main..amplifyapp.com)を出力します。
Understanding serverless data management
API Gatewayは、8つのIAM認証済みエンドポイントとLambda統合を備え、フロントエンドをバックエンドサービスに接続するREST APIを作成します。
バックエンドは、完全な注文ワークフローをサポートする5つのDynamoDBテーブルを使用します。Customers Tableには、パーソナライズされたレコメンデーション用のプロフィール(名前、メール、電話番号、ロイヤルティティア、ポイント)が保存されます。Orders Tableには、位置データ付きの注文履歴が保存され、Global Secondary Index(GSI)を使用して位置でクエリを実行し、人気アイテムを特定します。Menu Tableには、飲食店によって価格と在庫状況が異なる場所固有のアイテムが保存されます。Carts Tableには、自動クリーンアップ用の24時間TTL(Time To Live)付きの一時ショッピングカートが保存されます。Locations Tableには、注文計算とレコメンデーション用の飲食店データ(座標、営業時間、税率)が保存されます。DynamoDB on-demand capacity(オンデマンド容量)はトラフィックに応じて自動的にスケーリングします。
Understanding location-based services
Location Servicesは、お客様が便利な受け取り場所を見つけられるよう支援する位置情報ベースの機能を提供します。システムは3つのリソースを展開します:Place Index(Esri)はジオコーディング(geocoding)と住所検索用、Route Calculator(Esri)は運転ルートと迂回時間の計算用、Map(VectorEsriNavigation style スタイル)は運転最適化されたインタラクティブな可視化用です。
Lambda関数は3つの機能を提供します。Nearest Location Search(最寄りの場所検索)は、GPS座標とハヴェルサイヌ公式(haversine formula)を用いて距離順に並べ替えた最寄りのレストランを検索します。Route-Based Search(ルートベース検索)は、直線距離ではなく実際の走行時間に基づき、指定された迂回時間(デフォルト10分)内のレストランを特定します。Address Geocoding(住所ジオコーディング)は、GPSが利用できない場合に街路名を座標に変換します。
これらの機能により、「ルートの2分先に場所を見つけました」や「お気に入りの店舗は5マイル先です」といった文脈に即したレコメンデーションが可能になります。
Understanding voice AI processing with Amazon Bedrock AgentCore
あなたのAIエージェントは、Amazon Bedrock AgentCoreを通じて音声インタラクションを処理します。各ユーザーセッションは分離されたマイクロ仮想マシン(microVM)で実行され、高負荷下でも顧客セッションを安全かつ高性能に保ちます。これにより、ある顧客のセッションが別の顧客のパフォーマンスに影響を与えたり、データをアクセスしたりするのを防ぎます。AgentCoreは自動スケーリング、組み込みモニタリング、リアルタイム音声用のWebSocketサポートを提供します。
エージェントはStrands frameworkを使用してシステムプロンプト、ツール、会話フローを定義します。Nova 2 Sonicは以下の機能を提供します:
- アクセント横断的な音声認識(背景ノイズ耐性付き)
- ユーザーのトーンや感情に合わせた音声応答の適応
- 低レイテンシ応答時間を備えた双方向ストリーミング
- 会話をブロックせずに並列でデータを取得する非同期ツール呼び出し
- 自然なターンオーバーを実現する割り込み処理
- 複数の会話ターンにわたる文脈認識
音声処理フロー:フロントエンドからのオーディオストリーム(16 kHz PCM)がWebSocket経由でAgentCore Runtimeに送信されます。Nova 2 Sonicは音声を文字起こしし、エージェントが意図を判断してツールを選択します。Model Context Protocol(MCP)経由で非同期にそれらを呼び出し、AgentCore GatewayがMCP呼び出しをREST API(REST API)呼び出しに変換します。Lambda関数はビジネスロジックを実行して結果を返し、エージェントはそれらの結果を応答に組み込みます。Nova 2 Sonicが音声出力を生成し、フロントエンドへストリーミングして返します。
このアーキテクチャは、会話型注文のレイテンシを最小限に抑えます。
User authentication
本ソリューションは、安全なロールベースのアクセス制御のためにユーザープール(user pools)とアイデンティティプール(identity pools)を使用します。User poolsは認証とグループを管理します。Identity poolsはIAMロール(IAM roles)にリンクされた一時的なAWS資格情報を提供します。ユーザーはCognito User Poolにユーザー名とパスワードでログインし、JSON Web Token(JWT)トークン(Access TokenおよびID Token)を受け取ります。フロントエンドは、Cognito Identity PoolとID Tokenを交換して一時的なAWS資格情報(Access Key、Secret Key、Session Token)を取得します。これらの資格情報は、AgentCore RuntimeへのWebSocket接続およびAPI GatewayリクエストにSignature Version 4(SigV4)を使用して署名します。このアーキテクチャにより、認証されたユーザーのみがアプリケーションおよび注文APIにアクセスできることが保証されます。
WebSocket接続フロー
以下のシーケンス図は、前節の認証情報(Authentication Credentials)がどのようにブラウザからAgentCoreへの直接接続を確立するかを示しています。一時AWS認証情報(Temporary AWS Credentials)を用いて、フロントエンドはAgentCore Runtime(エージェントコアランタイム)に対してSigV4署名付きWebSocket接続を開き、ID検証用のアクセストークン(Access Token)を送信します。その後、ブラウザは同一の接続経由で16kHz PCMオーディオをストリーミングし、音声応答、文字起こし(Transcriptions)、およびツール呼び出し通知を受信します。これにより、サーバーサイドのプロキシが不要になります。
音声インタラクションと動的注文
以下のシーケンス図は、顧客の注文クエリ(Order Query)のフローを示しており、自然言語によるリクエストがどのように処理されて同期された応答を返すかを示しています:
原文を表示
Introduction
Building a voice-enabled ordering system that works across mobile apps, websites, and voice interfaces (an omnichannel approach) presents real challenges. You need to process bidirectional audio streams, maintain conversation context across multiple turns, integrate backend services without tight coupling, and scale to handle peak traffic.
In this post, we’ll show you how to build a complete omnichannel ordering system using Amazon Bedrock AgentCore, an agentic platform, to build, deploy, and operate highly effective AI agents securely at scale using any framework and foundation model and Amazon Nova 2 Sonic. You’ll deploy infrastructure that handles authentication, processes orders, and provides location-based recommendations. The system uses managed services that scale automatically, reducing the operational overhead of building voice AI applications. By the end, you’ll have a working system that processes voice orders across multiple customer touchpoints. The AI orchestration layer connects to a sample backend architecture with sample menu data, giving you a head start while implementing a project of this nature. This project was divided into modules giving you flexibility if you are looking to reuse components for integrating with your existing backend APIs.
In this post, you’ll learn how to:
- Deploy a multi-channel Voice AI ordering infrastructure using AWS Cloud Development Kit (AWS CDK)
- Implement an agent using Strands with Amazon Nova 2 Sonic for real-time speech processing hosted on AgentCore Runtime
- Connect your AI agent to backend services using Model Context Protocol (MCP) through AgentCore Gateway
- Test your system with realistic ordering scenarios including route-based pickup recommendations
Amazon Nova 2 Sonic is a speech-to-speech foundation model available through Amazon Bedrock that you can use for real-time voice interactions. When combined with Amazon Bedrock AgentCore, you get natural voice ordering across all customer touchpoints.
Solution overview
This solution architecture separates your frontend, AI agent, and backend services into distinct components. This separation allows you to develop and scale each component independently. The MCP is an open standard for connecting AI applications to external data sources, tools, and workflows. It provides standardized communication between your agent and backend services.
The solution will deploy:
- Amazon Cognito – Handles user authentication and provides temporary AWS credentials for secure API access. You can change this to your IDP of your choice as long as it is OAuth 2.0 compliant.
- Amazon Bedrock AgentCore Runtime – Hosts your AI agent with microVM isolation. Each user session runs in an isolated virtual machine, which keeps your customer sessions secure and performant even under high load. It prevents one customer’s session from affecting another’s performance or accessing their data.
- Amazon Bedrock AgentCore Gateway – Provides a secure way for developers to build, deploy, discover, and connect to tools at scale, which provides standardized communication between the agent and your business logic without tight coupling, so that you can modify backends or add new tools without rewriting integration code
- Amazon API Gateway – Exposes your backend services through Representational State Transfer (REST) endpoints with AWS Identity and Access Management (IAM) based authorization
- AWS Lambda – Executes your business logic for menu retrieval, order processing, and location services
- Amazon DynamoDB – Stores customer profiles, orders, menu items, and shopping carts with single-digit millisecond latency
- AWS Location Services – Provides location-based features for pickup recommendations
- AWS Amplify – Hosts the frontend application
Architecture diagram
The following diagram represents the solution architecture, which contains three key sections:
Section A: Backend infrastructure
This section deploys a sample restaurant architecture as backend services using infrastructure as code. It provisions data storage for customer information, orders, menus, carts, and locations. It also sets up location-based services for address handling and mapping, Lambda functions for business logic, an API layer for external access, and user authentication and authorization services. Resources are deployed in the appropriate dependency sequence.
Section B: AgentCore Gateway
This section deploys the AgentCore Gateway infrastructure. It provisions the necessary IAM service permissions, creates the AgentCore Gateway service, and configures API integration to expose backend endpoints as agent-accessible tools.
Section C: AgentCore Runtime and ECR image
This section deploys the AgentCore Runtime environment. It provisions Amazon ECR for container storage, Amazon S3 for source uploads, AWS CodeBuild for build automation, and required IAM permissions. The AgentCore Runtime service is configured with WebSocket protocol.
Section D: AWS Amplify
This section deploys the frontend application using AWS Amplify. It provisions the Amplify hosting service with deployment configuration and generates the necessary frontend configuration from backend outputs. The built web application is deployed and becomes accessible via the Amplify URL upon completion.
User request flow:
- The user accesses the web application hosted on AWS Amplify from their browser or mobile device.
- The user authenticates with Amazon Cognito using their username and password and receives JWT tokens (Access Token and ID Token).
- The frontend exchanges the ID Token with the Cognito Identity Pool for temporary AWS credentials (Access Key, Secret Key, Session Token).
- The frontend opens a SigV4-signed WebSocket connection to AgentCore Runtime and sends the Access Token as the first message for identity verification.
- The agent hosted in AgentCore Runtime validates the Access Token by calling the Cognito GetUser API and extracts the customer’s verified name, email, and customerId.
- AgentCore Runtime initializes the Nova 2 Sonic model on Amazon Bedrock and builds a personalized system prompt with the verified customer context.
- AgentCore Runtime connects to AgentCore Gateway as an MCP client using SigV4 authentication and discovers the available tools.
- The user speaks their order. The agent processes the voice input through Nova 2 Sonic and invokes tools asynchronously through the AgentCore Gateway using MCP.
- AgentCore Gateway exposes the backend REST APIs as MCP tools, so that the agent can discover and invoke them by name. When the agent calls a tool, AgentCore Gateway forwards the request as a REST API call to the API Gateway, which routes it to the appropriate Lambda function. Lambda functions query DynamoDB tables and AWS Location Services.
- Nova 2 Sonic generates a contextual voice response incorporating the tool results and streams it back to the user over the WebSocket connection.
Prerequisites
Before you begin, verify you have the following in place:
- An AWS account
- Foundation model (FM) access in Amazon Bedrock for Amazon Nova 2 Sonic in the same AWS Region where you will deploy this solution
- Node.js 20.x or later (required for AWS CDK deployment)
- Python 3.13 or later (required for agent runtime and deployment scripts)
- AWS Command Line Interface (AWS CLI) 2.x configured with credentials
- AWS CDK CLI 2.x: npm install -g aws-cdk (required for infrastructure deployment)
- CDK bootstrapped in your target account/region: npx cdk bootstrap
- Boto3 1.38.0 or later (required for bedrock-agentcore-control service support). Install using python3 -m pip install --upgrade boto3 botocore --break-system-packages
- Additional Python packages: python3 -m pip install email-validator pyyaml --break-system-packages
- The accompanying code downloaded from the aws-samples GitHub repo
Deploy solution resources using AWS CDK
Clone the GitHub repository and navigate into the project directory.
git clone https://github.com/aws-samples/sample-omnichannel-ordering-with-amazon-bedrock-agentcore-and-nova-sonic
cd sample-omnichannel-ordering-with-amazon-bedrock-agentcore-and-nova-sonicRun the deployment script. Both parameters are required. The email address will receive a temporary password for the initial Cognito test user.
./deploy-all.sh --user-email --user-name ""The script first runs preflight checks to validate that Node.js, Python, AWS CLI, CDK, credentials, CDK bootstrap, and Bedrock Nova 2 Sonic model access are all in place. If any check fails, it will report what’s missing and offer to auto-install what it can.
After preflight passes, the script runs five steps. Steps 1 through 3 are fully automated. Step 4 (Synthetic Data) will prompt you for a location such as a city, zip code, or address to use as the center point for searching nearby restaurants, a food type to search for (e.g., pizza, burgers, coffee shop, sandwich, tacos), whether to reuse the same address as the customer home, and a confirmation before writing the generated data into DynamoDB. Step 5 (Password Setup) will prompt you to optionally change the temporary Cognito password that was emailed to you. If you choose yes, you will enter the temporary password from the email and set a new permanent password that meets the Cognito policy (8+ characters, uppercase, lowercase, digit, symbol).
After completion, the script outputs the front-end URL (e.g., https://main..amplifyapp.com) that you will use to access the application.
Understanding serverless data management
API Gateway creates a REST API that connects your frontend to backend services with eight IAM-authenticated endpoints and Lambda integration.
Your backend uses five DynamoDB tables supporting the complete ordering workflow. The Customers Table stores profiles (name, email, phone, loyalty tier, points) for personalized recommendations. The Orders Table stores order history with location data and uses a Global Secondary Index to query by location for identifying popular items. The Menu Table stores location-specific items with pricing and availability that varies by restaurant. The Carts Table stores temporary shopping carts with 24-hour TTL for automatic cleanup. The Locations Table stores restaurant data (coordinates, hours, tax rates) for order calculations and recommendations. DynamoDB on-demand capacity scales automatically with traffic.
Understanding location-based services
Location Services provides location-based features that help customers find convenient pickup locations. The system deploys three resources: a Place Index (Esri) for geocoding and address search, a Route Calculator (Esri) for calculating driving routes and detour times, and a Map (VectorEsriNavigation style) for interactive visualization optimized for driving.
Lambda functions provide three capabilities: Nearest Location Search finds the closest restaurants sorted by distance using GPS coordinates and the haversine formula. Route-Based Search identifies restaurants within a specified detour time (default 10 minutes) using actual driving times rather than straight-line distances. Address Geocoding converts street addresses to coordinates when GPS isn’t available.
These features enable context-aware recommendations like “I found a location 2 minutes from your route” or “Your usual location is 5 miles away.”
Understanding voice AI processing with Amazon Bedrock AgentCore
Your AI agent processes voice interactions through Amazon Bedrock AgentCore. Each user session runs in an isolated microVM, which keeps customer sessions secure and performant even under high load. It prevents one customer’s session from affecting another’s performance or accessing their data. AgentCore provides automatic scaling, built-in monitoring, and WebSocket support for real-time voice.
The agent uses the Strands framework to define system prompts, tools, and conversation flow. Nova 2 Sonic provides:
- Speech recognition across accents with background noise tolerance
- Speech response adaptation to user tone and sentiment
- Bidirectional streaming with low latency response times
- Asynchronous tool calling that fetches data in parallel without blocking conversation
- Interruption handling for natural turn-taking
- Context awareness across multiple conversation turns
The voice processing flow: Audio streams from the frontend (16 kHz PCM) via WebSocket to AgentCore Runtime. Nova 2 Sonic transcribes speech, the agent determines intent and selects tools, invokes them asynchronously via MCP, and the AgentCore Gateway translates MCP calls to REST API calls. Lambda functions execute business logic and return results, which the agent incorporates into its response. Nova 2 Sonic generates voice output that streams back to the frontend.
This architecture minimizes latency for conversational ordering.
User authentication
The solution uses Amazon Cognito user pools and identity pools for secure, role-based access control. User pools manage authentication and groups. Identity pools provide temporary AWS credentials linked to IAM roles. Users log in with their username and password to the Cognito User Pool, receiving JSON Web Token (JWT) tokens (Access Token and ID Token). The frontend exchanges the ID Token with the Cognito Identity Pool for temporary AWS credentials (Access Key, Secret Key, Session Token). These credentials sign the WebSocket connection to AgentCore Runtime and API Gateway requests using Signature Version 4 (SigV4). This architecture ensures that only authenticated users can access the application and ordering APIs.
WebSocket connection flow
The following sequence diagram illustrates how the authentication credentials from the previous section establish a direct browser-to-AgentCore connection. Using the temporary AWS credentials, the frontend opens a SigV4-signed WebSocket connection to AgentCore Runtime and sends the Access Token for identity verification. The browser then streams 16kHz PCM audio and receives voice responses, transcriptions, and tool invocation notifications over the same connection. This avoids the need for a server-side proxy.
Voice interaction and dynamic ordering
The following sequence diagram illustrates the flow of a customer’s order query, demonstrating how natural language requests are processed to deliver synchronized responses:
<img loading="lazy" class="aligncenter wp-image-127897 size-full" src="https://d2908q01vomqb2.cloudfront.net/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59/2026/04/07/ML-20200-im
関連記事
Amazon Bedrock AgentCore を用いた、組み込みのガードレールによる安全なエージェント決済の実現
AWS は、エージェントが支払いが必要なツールやウェブリソースを利用する際に取引を完了できるよう、Amazon Bedrock AgentCore 決済機能を発表した。この新機能により、エージェントは安全なガードレール内で自動決済を実行可能となる。
コパイロットを超えて、マイクロソフトの AI が運転席を握る
マイクロソフトはビルドカンファレンスで、ユーザーの行動を常時監視して背景で自動実行する新カテゴリ「オートパイロット」を発表し、その第 1 弾エージェント「スカウト」を紹介した。
GitHub Copilot アプリ:エージェントネイティブなデスクトップ体験の提供
GitHub は、開発者ワークフローに複数のエージェントを並列で管理できる専用ツールとして「Copilot アプリ」を発表し、コードレビューやコンテキスト管理の課題解決を目指す。