

# 支援的代理程式架構
<a name="supported-frameworks"></a>

Amazon Bedrock AgentCore Evaluations 會評估使用熱門代理程式架構建置的代理程式。代理程式發出什麼作為遙測，以及遙測的結構方式，取決於您使用 建置的**代理程式架構**，以及您用來記錄它的**檢測程式庫**。

對於每個支援的架構，本節說明：
+ 您可以使用的檢測程式庫。
+ 如何檢測您的代理程式。
+ 產生的跨度和事件記錄的外觀。
+ 評估服務如何找到所需的值，例如使用者提示、客服人員回應和工具呼叫。

AgentCore Evaluations 支援下列架構和檢測程式庫。它僅支援這些程式庫的 Python 版本。


| 客服人員架構 | 檢測程式庫 | 範圍名稱 | 建議的版本 | 
| --- | --- | --- | --- | 
| Strands 代理程式 | 內建 (Strands Agents SDK) |  `strands.telemetry.tracer`  | 最新 | 
| LangGraph | OpenTelemetry (`opentelemetry-instrumentation-langchain`) |  `opentelemetry.instrumentation.langchain`  |  `>= 0.55.0`  | 
| LangGraph | OpenInference (`openinference-instrumentation-langchain`) |  `openinference.instrumentation.langchain`  |  `>= 0.1.62`  | 
| OpenAI 代理程式 | OpenTelemetry (`opentelemetry-instrumentation-openai-agents`) |  `opentelemetry.instrumentation.openai_agents`  |  `>= 0.61.0`  | 
| OpenAI 代理程式 | OpenInference (`openinference-instrumentation-openai-agents`) |  `openinference.instrumentation.openai_agents`  |  `>= 1.5.0`  | 
| LlamaIndex | OpenTelemetry (`opentelemetry-instrumentation-llamaindex`) |  `opentelemetry.instrumentation.llamaindex`  |  `>= 0.61.0`  | 
| LlamaIndex | OpenInference (`openinference-instrumentation-llama-index`) |  `openinference.instrumentation.llama_index`  |  `>= 4.4.1`  | 
| Google ADK | OpenInference (`openinference-instrumentation-google-adk`) |  `openinference.instrumentation.google_adk`  |  `>= 0.1.13`  | 
| Claude 代理程式開發套件 | OpenInference (`openinference-instrumentation-claude-agent-sdk`) |  `openinference.instrumentation.claude_agent_sdk`  |  `>= 0.1.3`  | 

**範圍名稱**是每個範圍和事件記錄上 `scope.name` 欄位的值。評估服務會使用它來判斷是否可以處理跨度。

## 服務如何讀取工作階段
<a name="supported-frameworks-how-read"></a>

無論架構為何，評估服務都會從兩個遙測訊號重建工作階段：**跨度**和**事件記錄**。它會依其類型分類每個跨度，然後從中擷取內容：

1.  從架構特定屬性**識別跨度類型**。範圍可以是**調用代理程式範圍 **（最上層代理程式執行）、**執行工具範圍 **（單一工具呼叫） 或**推論範圍 **（單一模型呼叫）。

1.  從每個範圍的屬性或其關聯的事件記錄中**擷取相關值**。例如，**使用者提示**來自客服人員輸入中的人工 （使用者角色） 訊息，而**客服人員回應**來自客服人員輸出中的 AI （助理角色） 訊息。

確切的屬性名稱和內容位置會因架構和檢測程式庫而有所不同。[跨度、事件記錄和遙測訊號](supported-frameworks-telemetry.md)頁面說明跨度和事件記錄的結構，以及內容所在的位置。每個架構頁面描述每個支援架構的屬性和範例資料。

## 設定可觀測性
<a name="supported-frameworks-setup"></a>

檢測您的代理程式是產生遙測的一部分，評估服務可以讀取。在評估端對端運作之前，您的代理程式也必須啟用可觀測性，並將其範圍和事件記錄匯出至 Amazon CloudWatch。請完成下列步驟：

1. 啟用 CloudWatch 交易搜尋，這是評估的先決條件。請參閱[啟用 AgentCore 可觀測性](observability-configure.md#observability-configure-builtin)。

1. 根據代理程式託管的位置，為您的代理程式啟用可觀測性：
   + 如需 Amazon Bedrock AgentCore 執行期上託管的代理程式，請參閱[在 AgentCore 託管代理程式的代理程式程式碼中啟用可觀測性](observability-configure.md#observability-configure-custom)。
   + 如需 Amazon Elastic Container Service (Amazon ECS)、Amazon Elastic Kubernetes Service (Amazon EKS)、 AWS Lambda 或其他環境中託管的代理程式，請參閱[啟用 AgentCore 外部託管代理程式的可觀測性](observability-configure.md#observability-configure-3p)。

## 客服人員範例
<a name="supported-frameworks-samples"></a>

下列範例顯示託管於 Amazon Bedrock AgentCore 執行期之外的 Strands 代理程式，將遙測匯出至具有 ADOT 的 Amazon CloudWatch。他們專注於可觀測性設定，而不是評估 API。這些範例使用 Strands，但相同的託管和遙測匯出模式適用於其他支援的架構，例如 LangGraph。
+  **Amazon EKS：**Amazon EKS [上 EKS 託管代理程式和 Strands 代理程式的可觀測性](https://github.com/awslabs/agentcore-samples/tree/main/06-workshops/06-AgentCore-observability/06-Agentcore-observability-for-eks-hosted-agent)。 [https://github.com/awslabs/agentcore-samples/tree/main/03-integrations/agents-hosted-outside-runtime/agents-on-eks](https://github.com/awslabs/agentcore-samples/tree/main/03-integrations/agents-hosted-outside-runtime/agents-on-eks)
+  **Amazon ECS：**[Amazon ECS 上的 Strands 代理程式](https://github.com/awslabs/agentcore-samples/tree/main/03-integrations/agents-hosted-outside-runtime/agents-on-ecs)。
+  ** AWS Lambda：**[AWS Lambda 中的 Strands 代理程式](https://github.com/awslabs/agentcore-samples/tree/main/03-integrations/agents-hosted-outside-runtime/agents-on-aws-lambda/02-agent-in-lambda)。

**Topics**