View a markdown version of this page

AgentCore 安全带版本控制和端点 - 亚马逊基岩 AgentCore

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

AgentCore 安全带版本控制和端点

Amazon Bedrock 为安全带 AgentCore 实现自动版本 AgentCore 控制,并允许您使用终端节点管理不同的配置。安全带版本控制与AgentCore 运行时版本控制的工作方式相同 ——线束是运行时之上的托管抽象——但你可以通过线束控制平面 API 进行管理。

亚马逊 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 的默认更新,PROD 仍在 V2 上

将 “PROD” 更新到 V3

未创建新版本

V3

PROD 对 V3 的更新

限制或环境修改

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

V4

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

端点生命周期状态

安全带端点在其生命周期中会经历不同的状态:

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"

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