View a markdown version of this page

AgentCore 繫帶版本控制和端點 - Amazon Bedrock AgentCore

AgentCore 繫帶版本控制和端點

Amazon Bedrock AgentCore 為 AgentCore 繫帶實作自動版本控制,並可讓您使用端點管理不同的組態。Harness 版本控制的運作方式與 AgentCore 執行期版本控制相同 - 繫帶是一種在執行期的受管抽象 - 但您可以透過繫帶控制平面 APIs 進行管理。

Amazon Bedrock AgentCore 中的每個繫帶都會自動版本化:

  • 當您建立繫帶時,AgentCore 會自動建立版本 1 (V1)

  • 每次更新繫帶都會建立具有完整、獨立組態的新版本

  • 版本在建立後是不可變的

  • 每個版本都包含執行所需的所有組態:模型、系統提示、工具、記憶體、限制和環境

端點如何參考版本

端點提供參考特定版本繫帶的方法:

  • DEFAULT 端點會自動指向最新版本的繫帶

  • 端點可以指向特定版本,讓您維護不同的環境 (例如開發、預備、生產)

  • 當您更新繫帶時,DEFAULT端點會自動更新以指向新版本

  • 必須明確更新端點以指向新版本

將端點更新為新版本的範例

範例
AWS CLI/boto3
import boto3 control_client = boto3.client('bedrock-agentcore-control', region_name='us-west-2') response = control_client.update_harness_endpoint( harnessId='MyHarness-UuFdkQoXSL', endpointName='production-endpoint', targetVersion='2', description='Updated production endpoint' ) print(response)

或使用 AWS CLI:

aws bedrock-agentcore-control update-harness-endpoint \ --harness-id "MyHarness-UuFdkQoXSL" \ --endpoint-name "production-endpoint" \ --target-version "2" \ --description "Updated production endpoint"

版本控制案例

下表說明版本控制和端點在集合生命週期內如何互動:

變更類型 版本建立行為 最新版本 端點行為

初始建立

自動建立第 1 版 (V1)

V1

預設指向 V1

模型變更

建立具有更新模型選擇的新版本

V2

DEFAULT 會自動更新至 V2

使用 V2 建立 "PROD" 端點

未建立新版本

V2

PROD 端點指向 V2

工具或技能更新

使用更新的工具組態建立新的版本

V3

對 V3 的 DEFAULT 更新,PROD 保留在 V2 上

將「PROD」更新至 V3

未建立新版本

V3

V3 的 PROD 更新

限制或環境修改

使用更新後的執行參數建立新的版本

V4

對 V4 的 DEFAULT 更新,PROD 保留在 V3

端點生命週期狀態

繫結端點在其生命週期內會經歷各種狀態:

CREATING

建立端點時的初始狀態

CREATE_FAILED

表示建立失敗,因為許可、組態或其他問題

就緒

端點已準備好接受請求

UPDATING

端點正在更新至新版本

UPDATE_FAILED

表示更新操作失敗

建立端點

建立具名端點,將環境釘選至特定繫帶版本。如果您省略 targetVersion,端點會在建立時指向最新版本。

範例
AWS CLI/boto3
import boto3 control_client = boto3.client('bedrock-agentcore-control', region_name='us-west-2') response = control_client.create_harness_endpoint( harnessId='MyHarness-UuFdkQoXSL', endpointName='production-endpoint', targetVersion='2', description='Production endpoint pinned to V2' ) print(response)

或使用 AWS CLI:

aws bedrock-agentcore-control create-harness-endpoint \ --harness-id "MyHarness-UuFdkQoXSL" \ --endpoint-name "production-endpoint" \ --target-version "2" \ --description "Production endpoint pinned to V2"

列出繫帶版本和端點

您可以透過呼叫 ListHarnessVersions操作列出所有版本的繫帶。若要列出繫帶的端點,請呼叫 ListHarnessEndpoints

範例
AWS CLI/boto3
import boto3 control_client = boto3.client('bedrock-agentcore-control', region_name='us-west-2') # List all versions of a harness versions = control_client.list_harness_versions( harnessId='MyHarness-UuFdkQoXSL' ) for version in versions['harnessVersions']: print(version) # List all endpoints for a harness endpoints = control_client.list_harness_endpoints( harnessId='MyHarness-UuFdkQoXSL' ) for endpoint in endpoints['endpoints']: print(endpoint)

或使用 AWS CLI:

aws bedrock-agentcore-control list-harness-versions \ --harness-id "MyHarness-UuFdkQoXSL" aws bedrock-agentcore-control list-harness-endpoints \ --harness-id "MyHarness-UuFdkQoXSL"

這兩個操作都支援透過 maxResults和 進行分頁nextToken。若要擷取單一端點的組態,請呼叫 GetHarnessEndpoint;若要移除端點,請呼叫 DeleteHarnessEndpoint