

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 Strands Agents SDK 和 AWS Fargate 部署多客服人員會議智慧平台
<a name="deploy-meeting-intelligence-strands-agents-fargate"></a>

*Aishita Batra 和 Muskan。，Amazon Web Services*

## 摘要
<a name="deploy-meeting-intelligence-strands-agents-fargate-summary"></a>

此模式會在 上部署多客服人員會議智慧平台 AWS Fargate ，從會議文字記錄自動產生結構化會議記錄、執行摘要、音訊敘述和格式化的 PDF 報告。解決方案使用 Strands Agents SDK 來協調四個特殊 AI 代理器、用於語言模型推論的 Amazon Bedrock，以及用於text-to-speech Amazon Polly。

使用者透過 Streamlit Web 界面上傳會議文字記錄，系統會透過協調的客服人員管道以非同步方式處理文字記錄。基礎設施會透過 GitHub Actions with AWS AWS Cloud Development Kit (AWS CDK) 自動部署，並包含內建監控、自動擴展和高可用性。

## 先決條件和限制
<a name="deploy-meeting-intelligence-strands-agents-fargate-prereqs"></a>

*先決條件*
+  AWS 帳戶 具有管理許可的作用中
+ AWS CDK 已安裝 2.114.1 版或更新版本
+ AWS CLI 安裝並設定適當的 AWS Identity and Access Management (IAM) 許可
+ Node.js 18 或更新版本
+ Python 3.12 或更新版本
+ 已安裝 Git
+ 已安裝 Docker （選用，用於本機測試）
+ 已設定儲存庫秘密的 GitHub 帳戶： `AWS_ACCESS_KEY_ID` 和 `AWS_SECRET_ACCESS_KEY`
+ 可存取您區域中啟用 Anthropic Claude 3 Sonnet 模型的 Amazon Bedrock
+ 已啟用 Amazon Polly 存取 （在大多數區域中預設為啟用）
+ Amazon Simple Storage Service (Amazon S3)、Amazon Elastic Container Service (Amazon ECS)、Fargate、Elastic Load Balancing、Amazon Virtual Private Cloud (Amazon VPC) 的 IAM 許可
+ Amazon VPC、IAM、Amazon CloudWatch 和 Amazon Simple Notification Service (Amazon SNS)

*限制*
+ 根據文字記錄的複雜性，每次會議的處理時間為 2-7 分鐘。
+ 每個請求的轉錄長度上限為 50，000 個字元。
+ 音訊摘要會自動壓縮為 3，000 個字元 (Amazon Polly 字元限制）。
+ Amazon Bedrock Claude 3 Sonnet 可用性會因而異 AWS 區域。
+ 除非您設定以 S3-based持久性，否則任務狀態會存放在記憶體中，且在容器重新啟動期間不會持續存在。
+ 直接上傳僅支援`.txt`檔案。
+ Application Load Balancer 會強制執行處理請求的 15 分鐘逾時。
+ 有些 AWS 服務無法全部使用 AWS 區域。如需區域可用性，請參閱[AWS 依區域列出的 服務](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services/)。如需特定端點，請參閱[服務端點和配額](https://docs.aws.amazon.com/general/latest/gr/aws-service-information.html)頁面，然後選擇服務的連結。

## Architecture
<a name="deploy-meeting-intelligence-strands-agents-fargate-architecture"></a>

**目標架構 **

解決方案使用 Strands Agents SDK 在 AWS Fargate 上使用下列架構部署多代理程式 AI 系統：

![](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/dfd870ca-7a7d-48cc-a62a-b14c8c3c7bb6/images/8f9c0497-153f-4361-80cd-791dc0fec8c5.png)


1. 使用者透過本機或遠端伺服器上託管的 Streamlit Web 應用程式上傳會議文字記錄。

1. 公有子網路中的 Application Load Balancer 會將流量分配到兩個可用區域的 Fargate 服務。

1. Fargate 任務透過 NAT Gateway 存取在私有子網路中執行，並託管 FastAPI 後端和 Strands 代理程式協同運作邏輯。

1. Strands 多代理程式系統透過四個循序代理程式處理文字記錄：結構化分鐘產生、簡潔摘要產生、音訊敘述和 PDF 報告建立。

1. Amazon Bedrock 提供分鐘和摘要產生代理程式的語言模型推論 (Claude 3 Sonnet)。

1. Amazon Polly 會將簡潔摘要轉換為 MP3 音訊敘述。

1. Amazon S3 使用生命週期管理政策存放上傳的文字記錄、產生的輸出檔案和任務狀態。

1. Amazon CloudWatch 提供集中式記錄、CPU 和記憶體警示，以及具有 Amazon SNS 通知的服務運作狀態監控。

1. GitHub Actions 透過 AWS CDK 運作狀態驗證測試，提供自動化 CI/CD 部署。

*自動化和擴展*
+ **ECS **Fargate** 自動擴展** – 根據 70% CPU 和記憶體使用率閾值，從 1 到 3 個執行個體自動擴展容器。
+ CloudWatch **監控** – 與 Amazon SNS 通知整合的 CPU (65%)、記憶體 (80%) 和服務運作狀態警示。
+ **Application Load Balancer** – 流量分佈，其中包含每 60 秒一次的運作狀態檢查，以及長時間執行 AI 處理任務的 15 分鐘閒置逾時。
+ **背景任務處理** – 使用 FastAPI BackgroundTasks 執行並行任務的非同步會議分析。
+ **S3-based任務持久性** – Amazon S3 中的持久性任務狀態儲存，可確保容器重新啟動和擴展事件之間的任務連續性。
+ **GitHub Actions CI/CD** – 具有 CDK 基礎設施佈建和運作狀態驗證測試的自動化部署管道。

## 工具
<a name="deploy-meeting-intelligence-strands-agents-fargate-tools"></a>

*AWS 服務*
+ Amazon Bedrock – 為會議分析和摘要客服人員提供語言模型推論 (Claude 3 Sonnet)。請參閱 [Amazon Bedrock 文件](https://docs.aws.amazon.com/bedrock/)。
+ Amazon CloudWatch – 監控容器效能、擷取應用程式日誌，以及觸發 CPU、記憶體和服務運作狀態閾值的警示。請參閱 [Amazon CloudWatch CloudWatch 文件](https://docs.aws.amazon.com/cloudwatch/)。
+ Amazon Elastic Container Service (Amazon ECS) – 透過運作狀態檢查和服務探索協調 Fargate 容器任務。請參閱[ Amazon ECS 文件](https://docs.aws.amazon.com/ecs/)。
+ Amazon Polly – 將簡潔的會議摘要轉換為 MP3 音訊敘述。請參閱 [Amazon Polly 文件](https://docs.aws.amazon.com/polly/)。
+ Amazon Simple Notification Service (Amazon SNS) – 從 CloudWatch 監控傳送警示通知。請參閱 [Amazon SNS 文件](https://docs.aws.amazon.com/sns/)。
+ Amazon Simple Storage Service (Amazon S3) – 使用生命週期管理存放上傳的文字記錄、產生的輸出檔案和任務狀態。請參閱 [Amazon S3 文件](https://docs.aws.amazon.com/s3/)。
+ AWS CDK – 將所有基礎設施定義為程式碼並進行部署。請參閱 [AWS CDK 文件](https://docs.aws.amazon.com/cdk/)。
+ AWS Fargate – 執行容器化應用程式工作負載而不管理伺服器，並自動擴展 1 到 3 個執行個體。請參閱 [AWS Fargate 文件](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html)。
+ Elastic Load Balancing – 將傳入流量分散至跨可用區域的 Fargate 任務。請參閱 [Elastic Load Balancing 文件](https://docs.aws.amazon.com/elasticloadbalancing/)。

*其他工具*
+ **Docker** – 建置容器映像以進行本機測試。請參閱 [Docker 文件](https://docs.docker.com/)。
+ **FastAPI** – 為任務提交、狀態檢查和檔案操作提供 REST API 後端。請參閱 [FastAPI 文件](https://fastapi.tiangolo.com/)。
+ **GitHub 動作** – 自動化 CI/CD 部署管道。請參閱 [GitHub 動作文件](https://docs.github.com/en/actions)。
+ **ReportLab** – 從結構化會議記錄中產生格式化的 PDF 報告。請參閱 [ReportLab 文件](https://docs.reportlab.com/)。
+ **Strands Agents SDK** – 使用`@tool`裝飾器模式，以最少的程式碼協調多代理程式工作流程。請參閱 [Strands SDK 文件](https://strandsagents.com/)。
+ **Streamlit** – 提供用於文字記錄上傳和輸出下載的 Web 型使用者介面。請參閱 [Streamlit 文件](https://docs.streamlit.io/)。

*程式碼儲存庫*

此模式的程式碼可在 GitHub [sample-ai-meeting-minutes-generator](https://github.com/aws-samples/sample-ai-meeting-minutes-generator) 儲存庫中使用。

## 最佳實務
<a name="deploy-meeting-intelligence-strands-agents-fargate-best-practices"></a>
+ 為每個客服人員使用清晰、聚焦的系統提示，以確保一致的輸出格式和專業會議文件。
+ 實作具有 90 天保留期的 Amazon S3 生命週期管理，以實現成本最佳化和自動化檔案清除。
+ 使用 Amazon S3 型任務追蹤來維持容器重新啟動和擴展事件的狀態，以實現可靠的處理。
+ 使用 Amazon SNS 通知設定 CPU、記憶體和服務運作狀態的 CloudWatch 警示，以進行主動監控。
+ 在處理之前驗證並淨化檔案上傳和內容格式，以防止系統錯誤和安全問題。
+ 遵循最低權限原則，並授予執行任務所需的最低許可。如需詳細資訊，請參閱 IAM 文件中的[授予最低權限](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege)和[安全最佳實務](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)。
+ 適用於需要受管協同運作和簡化操作開銷之生產部署的 Consider AWS AgentCore。當您需要更佳的客服人員互動自訂和專用工作流程控制時，建議使用 Strands SDK。
+ 針對人工產生的會議記錄實作客服人員輸出的系統性評估，以持續改善系統提示和客服人員效能。

## 史詩
<a name="deploy-meeting-intelligence-strands-agents-fargate-epics"></a>

### 部署基礎設施
<a name="deploy-the-infrastructure"></a>


| 任務 | 說明 | 所需的技能 | 
| --- | --- | --- | 
| 複製儲存庫 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html)<pre>git clone https://github.com/aws-samples/sample-ai-meeting-minutes-generator.git<br /></pre>[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html)<pre>cd meeting-minutes-app<br /></pre> | AWS DevOps | 
| 建立您自己的 Git 儲存庫 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html)<pre>git remote set-url origin https://<your-git-platform>.com/<your-username>/<your-repo-name>.git<br /></pre>[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html)<pre>git push -u origin main<br /></pre> | 應用程式開發人員 | 
| 設定 CI/CD 的儲存庫秘密。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html) | DevOps 工程師 | 
| 使用 CI/CD 工作流程部署基礎設施。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html)<pre>git add .<br />git commit -m "Deploy multi-agent meeting intelligence platform"<br />git push origin main<br /></pre>[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html) | DevOps 工程師 | 
| 驗證基礎設施部署。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html) | DevOps 工程師、雲端管理員 | 

### 設定和啟動應用程式
<a name="configure-and-launch-the-application"></a>


| 任務 | 說明 | 所需的技能 | 
| --- | --- | --- | 
| 設定本機開發環境 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html)<pre>cd meeting_minutes_agent/app<br /></pre>[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html)<pre>python -m venv venv<br />source venv/bin/activate  # Linux/Mac<br /># Or on Windows: venv\Scripts\activate<br /></pre>[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html)<pre>pip install -r requirements.txt<br />pip install streamlit<br /></pre> | 應用程式開發人員 | 
| 擷取後端服務 URL。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html) | 雲端管理員 | 
| 啟動應用程式並驗證連線。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html)<pre>BACKEND_URL="http://<your-service-url>.us-east-1.elb.amazonaws.com" streamlit run meeting_minutes_agent/app/streamlit_app.py<br /></pre>[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html) | 應用程式開發人員 | 

### 驗證解決方案
<a name="verify-the-solution"></a>


| 任務 | 說明 | 所需的技能 | 
| --- | --- | --- | 
| 處理會議文字記錄並驗證輸出。 | [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html) | 應用程式開發人員 | 

## 疑難排解
<a name="deploy-meeting-intelligence-strands-agents-fargate-troubleshooting"></a>


| 問題 | 解決方案 | 
| --- | --- | 
| Amazon Bedrock 模型存取錯誤 | 確認您的區域已啟用 Anthropic Claude 3 Sonnet 模型。開啟 Amazon Bedrock 主控台，選擇**模型存取**，並確認 Claude 3 Sonnet 顯示**授予的存取**。 | 
| CDK 引導失敗 |  在部署之前`cdk bootstrap aws://<account-id>/<region>`手動執行 。確認您的 AWS CLI 登入資料具有 CloudFormation、Amazon S3 和 IAM 的許可。 | 
| [See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/deploy-meeting-intelligence-strands-agents-fargate.html) |  檢查 Amazon ECS 主控台是否有已停止的任務詳細資訊。常見原因包括不正確的 IAM 角色許可、缺少 Amazon Bedrock 存取或 VPC 組態問題。檢閱任務的 CloudWatch 日誌。 | 
| 處理逾時 (15 分鐘 ALB 逾時） | Application Load Balancer 具有 15 分鐘的閒置逾時。對於非常長的文字記錄，請將輸入大小減少到 50，000 個字元以下，或增加 CDK 組態中的 ALB 逾時。 | 
| 音訊產生失敗 | Amazon Polly 有 3，000 個字元的限制。簡潔摘要代理程式會自動將內容壓縮為低於此限制。如果音訊產生仍然失敗，請確認您的區域已啟用 Amazon Polly 存取。 | 
| GitHub 動作部署失敗 | 確認 `AWS_ACCESS_KEY_ID`和 `AWS_SECRET_ACCESS_KEY`儲存庫秘密已正確設定。檢查 IAM 使用者是否具有 CDK 部署 (CloudFormation、Amazon ECS、Amazon S3、IAM) 的許可。 | 
| 後端未連線 （串流顯示中斷連線） | 確認`BACKEND_URL`環境變數符合 CloudFormation 輸出索引標籤中的 ServiceURL。在 Amazon ECS 主控台中確認 Fargate 服務正在執行且運作狀態良好。 | 
| 容器重新啟動後任務狀態遺失 | 透過設定環境`S3_JOB_TRACKING`變數來啟用 Amazon S3 型任務持續性。如果沒有這樣做，任務狀態只會儲存在記憶體中，並在容器重新啟動時遺失。 | 

## 相關資源
<a name="deploy-meeting-intelligence-strands-agents-fargate-resources"></a>

*參考*
+ [Amazon Bedrock 使用者指南](https://docs.aws.amazon.com/bedrock/latest/userguide/)
+ [Amazon Polly 開發人員指南](https://docs.aws.amazon.com/polly/latest/dg/)
+ [Amazon ECS 開發人員指南](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/)
+ [AWS Fargate 使用者指南](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html)
+ [AWS CDK CDK 開發人員指南](https://docs.aws.amazon.com/cdk/v2/guide/)
+ [Elastic Load Balancing User Guide](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/) (《Elastic Load Balancing 使用者指南》)

*工具*
+ [Strands Agents SDK 文件](https://strandsagents.com/)
+ [FastAPI 文件](https://fastapi.tiangolo.com/)
+ [串流文件](https://docs.streamlit.io/)
+ [GitHub 動作文件](https://docs.github.com/en/actions)

## 其他資訊
<a name="deploy-meeting-intelligence-strands-agents-fargate-additional-information"></a>

*多代理程式處理工作流程*

解決方案透過在 Fargate 任務中循序執行的四個專門代理程式協調會議處理。每個任務都會指派唯一的任務 ID，並以非同步方式執行，以實現可擴展性和故障隔離。

1. **結構化分鐘產生器 **(`generate_structured_minutes`) – 將原始會議文字記錄和標題作為輸入。使用 Amazon Bedrock Claude 3 Sonnet 產生全面的會議記錄，包括會議資訊、議程項目、討論摘要、具有被指派者和截止日期的動作項目，以及後續步驟。將輸出儲存為純文字檔案。

1. **精簡摘要產生器** (`concise_minutes_agent`) – 從客服人員 1 取得完整的結構化分鐘作為輸入。使用 Amazon Bedrock Claude 3 Sonnet 建立低於 3，000 個字元的執行摘要，以進行音訊產生和快速讀取。

1. **音訊產生器** (`audio_generator_agent`) – 從客服人員 2 取得簡潔分鐘作為輸入。搭配 Amazon Polly 使用 Strands `speak`工具來產生說明簡潔摘要的 MP3 音訊檔案。

1. **PDF 報告產生器** (`create_comprehensive_pdf`) – 從客服人員 1 取得完整的結構化分鐘作為輸入。使用 ReportLab 程式庫來產生具有自訂標題樣式、區段標頭、可讀取文字配置和中繼資料的專業 PDF 報告。

*資料流程*

1. **使用者上傳** – 透過 Streamlit UI 或直接 API 呼叫上傳的會議文字記錄。

1. **任務初始化** – FastAPI 會建立唯一的任務 ID，並立即傳回以進行非同步處理。

1. **背景處理** – 四個步驟的 Strands 代理程式工作流程會循序執行。

1. **檔案管理** – 產生的檔案會以預先簽章的下載 URLs 上傳至 Amazon S3。

1. **任務完成** – 使用所有產生輸出的下載連結來更新狀態。

*未來的增強考量*
+ 使用 Amazon DynamoDB 持續追蹤任務，以獲得跨容器可靠性
+ 多格式輸入支援 (`.docx`、`.pdf`、音訊轉錄檔案）
+ 即時 WebSocket 進度更新

**End-to-End處理流程**
+ 解決方案透過 Fargate 任務中執行的特殊客服人員協調序列來協調會議處理。
+ 每個任務都會指派**唯一的任務 ID**，並以非同步方式執行，以確保可擴展性和故障隔離。
+ 工作流程包含**文字記錄擷取 → 結構化分鐘產生 → 執行摘要 → 音訊敘述 → PDF 報告建立**，並**即時驗證和記錄**每個步驟。

**四步驟代理程式處理**

1. **結構化分鐘產生器 – **產生詳細的會議分鐘。

1. **簡潔摘要產生器** – 建立執行摘要以進行快速檢閱和音訊敘述。

1. **音訊產生器** – 產生摘要的 MP3 敘述。

1. **PDF 報告產生器** – 產生精細的格式化 PDF 報告。

**自動化檔案管理和雲端整合**
+ **自動輸出上傳：**結構化文字、音訊和 PDF 報告會自動上傳到 **Amazon S3**，並**依任務 IDs進行適當的分割。**
+ **完整性檢查和生命週期管理：**記錄上傳確認、檔案驗證和清除，以確保操作透明度和可靠性。
+ **FastAPI **背景任務會管理非同步任務執行。

**UI 整合與輸出**
+ 串流使用者介面會顯示後端連線、文字記錄輸入區域，以及透過** S3 預先簽章 URL** 上傳會議文字記錄以啟動任務後的產生分鐘數。  
![](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/dfd870ca-7a7d-48cc-a62a-b14c8c3c7bb6/images/f608a187-91bf-4524-a849-907eb5efb182.png)
+ 一旦處理完成，即可透過**預先簽章的 S3 URL** 下載結構化文字、音訊和 PDF 輸出，可透過 UI 中的可點選按鈕存取。  
![](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/dfd870ca-7a7d-48cc-a62a-b14c8c3c7bb6/images/b4fa32f4-32c3-43ae-b140-0f6a58ebe245.png)  
![](http://docs.aws.amazon.com/zh_tw/prescriptive-guidance/latest/patterns/images/pattern-img/dfd870ca-7a7d-48cc-a62a-b14c8c3c7bb6/images/eb878259-f90e-4d9f-8a4d-42627d04bdd1.png)