先決條件
使用 AgentCore 最佳化功能之前,請確定下列項目已就緒。
需求和支援的架構
建議和 A/B 測試具有與 AgentCore Evaluations 相同的代理程式需求:
-
在啟用可觀測性的 AgentCore 執行時間上部署的代理程式,或使用 AgentCore Observability 設定的支援架構建置的代理程式。支援的架構:
-
Strands 代理程式
-
使用
opentelemetry-instrumentation-langchain或 的 LangGraphopeninference-instrumentation-langchain
-
-
CloudWatch 中已啟用交易搜尋。
-
CloudWatch Logs 中具有遙測資料的代理程式工作階段。叫用您的代理程式,並等待 2-5 分鐘讓 CloudWatch 擷取遙測,然後再開始建議或 A/B 測試。
SDK 和 CLI 需求
-
AgentCore CLI:執行 安裝最新版本
agentcore update。 -
AWS SDK (boto3):Python 3.10 或更新版本。使用 安裝或升級
pip install --upgrade boto3。 -
AgentCore SDK:如果使用
bedrock-agentcore-sdk-python,則需要 1.8 版或更新版本。
IAM 許可
下列 IAM 政策授予所有三個最佳化功能的許可:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "ConfigurationBundles", "Effect": "Allow", "Action": [ "bedrock-agentcore:CreateConfigurationBundle", "bedrock-agentcore:GetConfigurationBundle", "bedrock-agentcore:GetConfigurationBundleVersion", "bedrock-agentcore:ListConfigurationBundles", "bedrock-agentcore:ListConfigurationBundleVersions", "bedrock-agentcore:UpdateConfigurationBundle", "bedrock-agentcore:DeleteConfigurationBundle" ], "Resource": "arn:aws:bedrock-agentcore:*:*:configuration-bundle/*" }, { "Sid": "Recommendations", "Effect": "Allow", "Action": [ "bedrock-agentcore:StartRecommendation", "bedrock-agentcore:GetRecommendation", "bedrock-agentcore:ListRecommendations", "bedrock-agentcore:DeleteRecommendation" ], "Resource": "arn:aws:bedrock-agentcore:*:*:recommendation/*" }, { "Sid": "ABTesting", "Effect": "Allow", "Action": [ "bedrock-agentcore:CreateABTest", "bedrock-agentcore:GetABTest", "bedrock-agentcore:ListABTests", "bedrock-agentcore:UpdateABTest", "bedrock-agentcore:DeleteABTest" ], "Resource": "arn:aws:bedrock-agentcore:*:*:ab-test/*" }, { "Sid": "CloudWatchLogs", "Effect": "Allow", "Action": [ "logs:GetLogEvents", "logs:FilterLogEvents", "logs:StartQuery", "logs:GetQueryResults" ], "Resource": "arn:aws:logs:*:*:log-group:/aws/bedrock-agentcore/runtimes/*" } ] }