設定內建策略
AgentCore 記憶體為常見使用案例提供預先設定的內建記憶體策略。
使用者偏好設定
使用者偏好設定 () UserPreferenceMemoryStrategy 策略旨在自動識別並從對話中擷取使用者偏好設定、選擇和樣式。這可讓您的代理程式為每個使用者建立持久性設定檔,進而產生更個人化的相關互動。
-
範例使用案例:電子商務代理程式會記住使用者最愛的品牌和偏好的大小,讓它在未來工作階段中提供量身打造的產品建議。
組態範例:
import boto3 # Initialize the Boto3 client for control plane operations control_client = boto3.client('bedrock-agentcore-control', region_name='us-west-2') # Create memory resource with user preference strategy response = control_client.create_memory( name="ECommerceAgentMemory", memoryStrategies=[ { 'userPreferenceMemoryStrategy': { 'name': 'UserPreferenceExtractor', 'namespaceTemplates': ['/users/{actorId}/preferences/'] } } ] )
語意
語意 (SemanticMemoryStrategy) 記憶體策略旨在識別並從對話資料中擷取事實資訊和情境知識的關鍵部分。這可讓您的客服人員針對互動期間討論的重要實體、事件和詳細資訊,建立持久的知識庫。
-
範例使用案例:客戶支援客服人員記住,訂單 #ABC-123 與特定支援票證相關,因此使用者在追蹤時不必再次提供訂單號碼。
組態範例:
import boto3 # Initialize the Boto3 client for control plane operations control_client = boto3.client('bedrock-agentcore-control', region_name='us-west-2') # Create memory resource with semantic strategy response = control_client.create_memory( name="SupportAgentFactMemory", memoryStrategies=[ { 'semanticMemoryStrategy': { 'name': 'FactExtractor', 'namespaceTemplates': ['/support_cases/{sessionId}/facts/'] } } ] )
工作階段摘要
工作階段摘要 (SummaryMemoryStrategy) 記憶體策略會在單一工作階段中發生對話時建立精簡、執行中的對話摘要。這會擷取關鍵主題和決策,讓客服人員快速召回長時間對話的內容,而不需要重新處理整個歷史記錄。
-
範例使用案例:在 30 分鐘疑難排解工作階段後,代理程式可以存取摘要,例如「使用者回報軟體 v2.1 的問題、嘗試重新啟動,並收到知識庫文章的連結。」
組態範例:
import boto3 # Initialize the Boto3 client for control plane operations control_client = boto3.client('bedrock-agentcore-control', region_name='us-west-2') # Create memory resource with summary strategy response = control_client.create_memory( name="TroubleshootingAgentSummaryMemory", memoryStrategies=[ { 'summaryMemoryStrategy': { 'name': 'SessionSummarizer', 'namespaceTemplates': ['/summaries/{actorId}/{sessionId}/'] } } ] )
事件
附加 () EpisodicStrategy 記憶體策略會將互動擷取為結構性片段,其中包含案例、意圖、想法、採取的動作、結果和成品。透過此策略,也會在各集之間進行反射,以擷取更廣泛的洞見,讓客服人員從先前的互動學習並套用成功的模式到新的互動。
-
範例使用案例:客戶支援客服人員會將互動記錄為片段。系統會擷取哪些片語和動作導致成功互動
組態範例:
import boto3 # Initialize the Boto3 client for control plane operations control_client = boto3.client('bedrock-agentcore-control', region_name='us-west-2') # Create memory resource with episodic strategy response = control_client.create_memory( name="MyMemory", memoryStrategies=[ { 'episodicMemoryStrategy': { 'name': 'EpisodicStrategy', 'namespaceTemplates': ['/strategy/{memoryStrategyId}/actors/{actorId}/sessions/{sessionId}/'], 'reflection': { 'namespaceTemplates': ['strategy/{memoryStrategyId}/actors/{actorId}/'] } } } ] )