View a markdown version of this page

AgentCore 线束版本控制和端点 - Amazon Bedrock AgentCore

AgentCore 线束版本控制和端点

Amazon Bedrock AgentCore 实现了 AgentCore 线束的自动版本控制,并允许您使用终端节点管理不同的配置。Harness 版本控制的工作方式与 AgentCore Runtime 版本控制相同-harness 是运行时的托管抽象,但你可以通过线束控制平面 API 对其进行管理。

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

默认值会自动更新到 V2

使用 V2 创建 “PROD” 端点

未创建新版本

V2

PROD 端点指向 V2

工具或技能更新

使用更新的工具配置创建新版本

V3

V3 的默认更新,PROD 仍在 V2 上

将 “PROD” 更新到 V3

未创建新版本

V3

PROD 对 V3 的更新

限制或环境修改

使用更新的执行参数创建新版本

V4

V4 的默认更新,PROD 仍在 V3 上

端点生命周期状态

Harness 端点在其生命周期中会经历各种状态:

CREATING

创建端点时的初始状态

创建失败

表示由于权限、配置或其他问题而导致创建失败

就绪

终端节点已准备好接受请求

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"

这两个操作都支持通过maxResultsnextToken进行分页。要检索单个端点的配置,请调用GetHarnessEndpoint;要删除一个端点,请调用DeleteHarnessEndpoint