View a markdown version of this page

A/B テストを管理する - Amazon Bedrock AgentCore

A/B テストを管理する

A/B テストを更新して、テストを開始、一時停止、または停止します。UpdateABTest オペレーションを使用して実行ステータスを変更します。

注記

AgentCore CLI ライフサイクルコマンド (viewpauseresumestoparchive) はpromote、名前ではなく -i, --idで渡されたジョブ ID によってテストを識別します。でテストを一覧表示して、 agentcore run ab-test --json ( idフィールド) または から ID を取得しますagentcore view ab-test。ジョブ ID は 形式を使用しますname-suffix。例: customerSupportTargetTest-Ab1Cd2Ef3G。ジョブレコードは、プロジェクト内の の JSON としてローカル.cli/jobs/ab-tests/に保存されます。

コードサンプル

表示、一時停止、再開、停止

AgentCore CLI

すべての A/B テストジョブを一覧表示するか、詳細を表示します (呼び出し URL と結果も表示されます)。

agentcore view ab-test agentcore view ab-test <ab-test-id>

一時停止したテストを再開します。

agentcore resume ab-test -i <ab-test-id>

実行中のテストを一時停止します。トラフィックは分割を停止し、すべてのリクエストはコントロールバリアントにルーティングされます。再開できます。

agentcore pause ab-test -i <ab-test-id>

テストを完全に停止します。すべてのトラフィックはコントロールバリアントに戻ります。これは元に戻すことはできません。

agentcore stop ab-test -i <ab-test-id>
AWS SDK (boto3)

テストを開始します (実行ステータスを に設定しますRUNNING)。

import boto3 import uuid client = boto3.client("bedrock-agentcore", region_name="us-west-2") response = client.update_ab_test( abTestId="customerSupportPromptTest-Ab1Cd2Ef3G", executionStatus="RUNNING", clientToken=str(uuid.uuid4()), ) print(f"Execution status: {response['executionStatus']}")

実行中のテストを一時停止します。

response = client.update_ab_test( abTestId="customerSupportPromptTest-Ab1Cd2Ef3G", executionStatus="PAUSED", clientToken=str(uuid.uuid4()), ) print(f"Execution status: {response['executionStatus']}")

実行中のテストを完全に停止します。

response = client.update_ab_test( abTestId="customerSupportPromptTest-Ab1Cd2Ef3G", executionStatus="STOPPED", clientToken=str(uuid.uuid4()), ) print(f"Execution status: {response['executionStatus']}")

処理バリアントを昇格させる

結果が統計的に有意であれば、処理バリアントを昇格させます。 はテストpromoteを停止し、処理バリアントを に書き込みますagentcore.jsonagentcore deployその後、 を実行してロールアウトします。

AgentCore CLI
agentcore promote ab-test -i <ab-test-id> agentcore deploy
AWS SDK (boto3)

SDK には、単一の「昇格」オペレーションはありません。テストを停止し、勝ったバリアントを自分でリソースに適用します (たとえば、コントロール設定バンドルまたはゲートウェイターゲットを処理に合わせて更新するなど)。

A/B テストを削除する

A/B テストとそれに関連するメタデータを削除します。削除する前に、テストがSTOPPED実行ステータスになっている必要があります。テストを削除しても、テストが参照した設定バンドル、AgentCore Gateway、またはオンライン評価設定には影響しません。

AgentCore CLI
agentcore archive ab-test -i <ab-test-id>
AWS SDK (boto3)

停止してから、以下を削除します。

import boto3 import uuid client = boto3.client("bedrock-agentcore", region_name="us-west-2") # First stop the test if it's running client.update_ab_test( abTestId="customerSupportPromptTest-Ab1Cd2Ef3G", executionStatus="STOPPED", clientToken=str(uuid.uuid4()), ) # Then delete response = client.delete_ab_test( abTestId="customerSupportPromptTest-Ab1Cd2Ef3G" ) print(f"Deleted: {response['abTestId']}")

実行ステータスの遷移

から まで 説明

NOT_STARTED

RUNNING

テストを開始します。AgentCore Gateway はトラフィックの分割を開始します。

RUNNING

PAUSED

テストを一時停止します。トラフィックの分割が停止します。制御するすべてのトラフィックルート。

PAUSED

RUNNING

一時停止したテストを再開します。

RUNNING

STOPPED

テストを完全に停止します。トラフィックルーティングはすぐに終了します。

PAUSED

STOPPED

一時停止したテストを完全に停止します。