良くし続ける | Kiro と学ぶ Amazon Bedrock AgentCore 09

Riku INADA PRO
November 11, 2026

良くし続ける | Kiro と学ぶ Amazon Bedrock AgentCore 09

Level 300。架空のネットのお店の問い合わせ窓口のエージェントを Amazon Bedrock AgentCore Runtime に載せ、その本物の記録から Amazon Bedrock AgentCore の optimization の改善の案で指示の直し方を作ります。案が目当てにした評価器 (お客さんの目的が果たせたかを見る GoalSuccessRate) に合わせてお店の決まりと逆の行を足したので、人がその 1 行を直して configuration bundle の版にし、同じ 12 件で 3 つの版を batch の評価で比べてから、Amazon Bedrock AgentCore Gateway で流れを分ける A/B テストで今の版と比べます。48 件の A/B テストでは有意差が出ずに pause したことまでを、本物の出力と流れの図で追います。01、07、08 の続きで、シリーズ「Kiro と学ぶ Amazon Bedrock AgentCore」の 09 (柱「見て直す」) です。

Riku INADA PRO

November 11, 2026

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

40 slides
  1. Kiro と学ぶ Amazon Bedrock AgentCore 09 ⾒て直す Level 300 良くし続ける

    改善の案と A/B テスト 2026-11 時点 2026 年 11 ⽉ 稲⽥ ⼤陸 アマゾン ウェブ サービス ジャパン © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 09 Kiro + AgentCore 1
  2. はじめに ⾃⼰紹介 稲⽥ ⼤陸 いなだ りく (いなりく) アマゾン ウェブ サービス

    ジャパン合同会社 ソリューションアーキテクト 製造業のお客様を中⼼に⽀援 最近の取り組み AI 駆動開発ライフサイクルの推進 Kiro と AWS Amplify の情報発信 © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. X @inada_riku Speaker Deck speakerdeck.com/inariku Zenn zenn.dev/inariku GitHub github.com/inariku 2
  3. はじめに シリーズの中の位置 いまは 09 良くし続ける、次は 10 ⼊⼝と出⼝に鍵をかける はじめる 01–02 作り込む

    03–06 ⾒て直す 07–09 守って広げる 10–12 次に読む 01 AgentCore のしくみ 03 覚えさせる 07 動きを⾒る 10 ⼊⼝と出⼝に鍵をかける 前に読む 02 Runtime を使いこなす 04 道具をつなぐ 計算させ、 05 Web を⾒させる 08 評価する 11 決まりで⽌める 09 良くし続ける 12 会社で探して使う 06 設定で組む © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 3
  4. はじめに この資料で分かることと、始める前に要るもの 点から直し⽅を作り、確かめてから出す 1 改善の案: いまの指⽰、記録、⽬当ての評価器 1 つから、指⽰の直し⽅を作る 2 configuration

    bundle: 指⽰を版で持ち、Gateway から版を届ける 3 A/B テスト: 本番を 2 つに分けて採点し、有意差を⾒て勝った版を出す 始める前に: Runtime の窓⼝と記録 (01、07)、online の評価 (08)、Transaction Search bundle を読むコードは bedrock-agentcore 1.8 以上。東京のリージョンで使える 改善の案 configuration bundle A/B テスト 記録と評価器から 指⽰を版で持ち、 本番を 2 つに分け、 直し⽅を作る Gateway から届ける 有意差を⾒て出す © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 4
  5. 1 改善の輪 直し⽅を勘で決めない 版 1 の窓⼝は、返⾦してよい 6 件のうち 4 件で聞き返した

    返⾦してよい 6 件 返⾦ 2 件、聞き返し 4 件 ほかの 6 件 © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 6
  6. 1 改善の輪 良くし続ける輪 観る、採点する、案を作る、確かめる、出す。勝った版の記録が次の元 観る 採点する 案を作る 確かめる 出す Observability

    の Evaluations の 改善の案 batch で決まった Gateway の決まり 記録 (CloudWatch) 評価器 (08) Recommendations ケース、A/B で本番 で勝った版を全部に 勝った版の本番の記録が、次の案の元になる © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 7
  7. 1 改善の輪 この資料で作ったもの 窓⼝の前に Gateway を置き、記録から案を作って版を届ける AWS (東京のリージョン) 1 呼ぶスクリプト

    (お客さん役) 2 AgentCore Gateway ⼊⼝は IAM A/B の版 版ごとの点 3 AgentCore Runtime 問い合わせ窓⼝ 評価器 3 つ © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. Claude Sonnet 5 4 5 online の評価 Amazon Bedrock 6 Amazon CloudWatch トレースとログ 改善の案 → bundle の版 8
  8. 2 改善の案を作る 改善の案に⼊れるもの 3 つ、返るもの 評価器は 1 つだけ選ぶ。案はその評価器の点が上がる向きに押される 1 いまの指⽰

    案の指⽰ ⽂で渡すか、 recommendedSystemPrompt bundle の版と JSON のパス 2 記録の元 (どれか 1 つ) CloudWatch Logs、span の⼀覧、 batch の仕事、online の評価 3 ⽬当ての評価器 1 つ GoalSuccessRate、Helpfulness、 カスタム (数で返すもの) © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 改善の案 記録の成功と 説明 explanation (何をなぜ) 失敗を⽐べて、 指⽰を書き直す bundle の新しい版 bundle を渡したとき 10
  9. 2 改善の案を作る 版 1 の 12 件の記録から、⽬的の点を⽬当てに案を作った 版 1 で

    12 件を流した 改善の案を始めた COMPLETED Gateway から 11:48〜11:51 記録: CloudWatch Logs 始めて約 3 分 返⾦してよい 6 件中 2 件を返⾦ ⽬当て: GoalSuccessRate get で案と説明を読む 1 2 出⼒: 改善の案の状態を読んだもの (始めた命令と読んだ命令は付録 A3) acdecks-09-desk-prompt-1 SYSTEM_PROMPT_RECOMMENDATION COMPLETED 2026-11-10T02:57:47.766Z -> 2026-11-10T03:01:00.297Z © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 1 2 名前と種類 約 3 分で終わった 11
  10. 2 改善の案を作る 案は聞き返しをやめさせ、配送中の返⾦も許した 版 1 の 4 ⾏は、そのまま残った … 何かをする前に

    lookup_customer でお客さんを確かめる / 道具で分かることは聞き返さない + 「…と get_order_history は同時に呼んでよい」 1 道具を並べて呼ぶ + 「確認し直さずすぐ process_refund を実⾏する」 2 聞き返しをやめる + 「配送中や遅延中の注⽂も返⾦できる」 3 お店の決まりと逆 + 「…注⽂履歴にある注⽂だけ対象にする」 4 本⼈の注⽂だけ 出⼒: 案の指⽰の、⾜された⾏ (命令は付録 A3) - lookup_customer と get_order_history は同時に呼んでよい - お客さんが返⾦を明⽰的に頼んだ場合は、確認し直さずすぐ process_refund を実⾏する - 配送中や遅延中の注⽂も返⾦できる - 返⾦はそのお客さんの注⽂履歴にある注⽂だけ対象にする © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 1 2 3 4 12
  11. 3 bundle で版を分ける configuration bundle の形 部品は Runtime の ARN

    で引き、版は変えられず親の版につながる configuration bundle acdecks09_desk_prompt components (部品) 版 (version) は変えられない。親の版につながる 0f967c53… 08 の版 1 と同じ指⽰ (いまの本番) key: 窓⼝の Runtime の ARN ec78eedb… configuration: 好きな key と value 改善の案のまま system_prompt: 「あなたは…」 (モデルの ID、道具の説明も⼊れられる) 名前は英数字と下線 (ハイフン不可) © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 版1 b811c7d9… 版2 版3 案の配送中の⾏を、お店の決まりに直した 枝 mainline。parentVersionIds が前の版を指す 15
  12. 3 bundle で版を分ける 窓⼝は、モデルを呼ぶたびに bundle の指⽰を当てる app/agent/main.py の抜き書き (5〜6、23、30〜34、41、52〜53 ⾏)

    from strands.hooks.events import BeforeModelCallEvent from bedrock_agentcore.runtime import BedrockAgentCoreApp, BedrockAgentCoreContext def apply_config_bundle(event: BeforeModelCallEvent): try: config = BedrockAgentCoreContext.get_config_bundle() or {} except Exception: config = {} event.agent.system_prompt = config.get("system_prompt", DEFAULT_SYSTEM_PROMPT) def _get_agent(session_id: str, actor_id: str) -> Agent: agent.hooks.add_callback(BeforeModelCallEvent, apply_config_bundle) return agent bundle が無い呼び出しは {} が返り、DEFAULT_SYSTEM_PROMPT (版 1 と同じ⽂) で答える agent は _get_agent() が session ごとに作る Strands の Agent (45〜51 ⾏)。hook はその直後に登録する © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 16
  13. 3 bundle で版を分ける 版は Gateway から baggage で届く Gateway が

    session ごとに版を決め、W3C baggage で渡す 呼ぶ側 1 Gateway POST /desk/invocations と session ID Runtime の SDK 窓⼝の hook モデル 2 版を決め、baggage に bundle の ARN と版 3 get_config_bundle() で設定を読む 4 system_prompt を当ててモデルへ baggage が無いと {} が返り、窓⼝は既定の指⽰ (版 1 と同じ⽂) で答える © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 17
  14. 3 bundle で版を分ける 案を⼈が 1 ⾏直し、bundle の版 3 にした 版1

    0f967c53… 1 版2 ec78eedb… 版3 2 b811c7d9… いまの指⽰ 改善の案のまま ⼈が 1 ⾏直した (既定の指⽰と同じ⽂) (4 ⾏が⾜された) (配送中は返⾦しない) 3 出⼒: bundle の版の⼀覧を、版の ID と commit の⽂だけにしたもの (作る命令は付録 A2) 0f967c53 ec78eedb b811c7d9 版 1: 08 の版 1 と同じ指⽰ (いまの本番) 版 2: 改善の案 acdecks-09-desk-prompt-1 のまま 版 3: 案の配送中の⾏を、お店の決まりに直した © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 1 2 3 版 1: いまの指⽰ 版 2: 改善の案のまま 版 3: 配送中の⾏を直した 18
  15. 3 bundle で版を分ける 出す前に、同じ 12 件で版 1、2、3 を並べた 12 件の平均

    ⽬的の点 (GoalSuccessRate) お店の決まり (ShopRules) 版 1 (いまの指⽰) 0.33 1.00 1 版 2 (案のまま) 0.92 0.75 2 版 3 (⼈が直した) 0.58 1.00 3 版 2 (案のまま) は⽬的が上がり、決まりが下がった。版 3 は決まりを保って⽬的が上がった 出⼒: 3 つの batch の仕事の、評価器ごとの平均 (命令は付録 A5) acdecks09_v1 acdecks09_v2 acdecks09_v3b n=12 n=12 n=12 goal 0.33 goal 0.92 goal 0.58 © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. rules 1.00 rules 0.75 rules 1.00 1 2 3 版 1: ⽬的の点が低い 版 2: 決まりの点が下がった 版 3: 決まりを保って上がった 19
  16. 4 A/B テストで確かめる A/B テストの形は 2 つ。設定だけなら bundle の版を分ける bundle

    の版を分ける (この資料) Gateway の対象を分ける 変えるもの 指⽰、モデルの ID、道具の説明 コード、フレームワーク、別の窓⼝ Runtime 1 つ (同じ Runtime) 2 つの endpoint か 2 つの Runtime Gateway の対象 1つ 版ごとに 1 つ (2 つ) online の評価 1 つを共有 版ごとに 1 つ (2 つ) CLI ab-test config-based run ab-test target-based run どちらも Gateway が session ID で流れを分け、版ごとに有意差を出す。評価器は数で返すものだけ AgentCore の外 (AWS Lambda、Amazon EKS、Amazon ECS) のエージェントも、対象を分ける形で⽐べられる そのときは Gateway の tracing と、エージェント側の OpenTelemetry が要る (AWS Lambda なら AWS Distro for OpenTelemetry の layer を⾜す) © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 21
  17. 4 A/B テストで確かめる 版 1 と版 3 を半分ずつにして、A/B テストを始めた Gateway

    shop 1 C 50% 版 1 (いまの指⽰) 対象のパス: /desk/* 呼ぶ側 2 session ID で版を決める 期限は始めて 14 ⽇後 同じ Runtime。採点は online の評価 1 つ 版 3 (⼈が直した案) T1 50% 出⼒: 動いている A/B テストの状態 (作った命令は付録 A7、読んだ命令は付録 A6) acdecks09_desk_ab_1 ACTIVE RUNNING C 50 T1 50 maxDurationExpiresAt 2026-11-24T03:05:34.992Z © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 1 2 3 RUNNING: 作ると始まる 重みは 50 と 50 期限は始めて 14 ⽇後 22
  18. 4 A/B テストで確かめる session ごとに版を決め、終わった会話を採点して集める session ID 呼び出し session の終わり

    online の評価 A/B の集計 同じ ID はいつも baggage で 5 分呼ばれない 評価器ごとに 版ごとの平均、 同じ版へ (sticky) 版を渡す (online の区切り) 点を付ける p 値、信頼区間 最後の呼び出し +5 分 +17 分 (48 件が集計に) session が終わってから、ふつう 15 分ほどで結果が出る この資料では 48 件を流し、最後の呼び出しから約 17 分で全部が集計に⼊った 集計は約 5 分ごとに更新された。結果は何度読んでもよく、読んでも有意差の確かさは変わらない © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 23
  19. 4 A/B テストで確かめる 48 件では、⽬的の点の差は有意にならなかった 評価器 (かっこは件数) C (版 1)

    p値 T1 (版 3) ⽬的 (GoalSuccessRate) 0.38 (21) 0.63 (27) 0.237 1 役に⽴ったか (Helpfulness) 0.84 (21) 0.86 (27) 0.905 2 お店の決まり (ShopRules) 0.95 (21) 1.00 (27) 0.578 3 出⼒: A/B テストの結果を、評価器ごとに 1 ⾏にしたもの (命令は付録 A6) Builtin.GoalSuccessRate Builtin.Helpfulness ShopRules C 0.38 (21) C 0.84 (21) C 0.95 (21) T1 0.63 (27) T1 0.86 (27) T1 1.00 (27) p 0.237 p 0.905 p 0.578 false false false 1 2 3 印 1: 差は 0.25、95% の信頼区間は −0.03〜0.52 で 0 をまたぐ (p 0.237) 印 3: 版 1 が 1 回、2 万円を返⾦した (注⽂の額は 15,800 円) © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 24
  20. 4 A/B テストで確かめる この差を⾒るには、約 256 件が要る ⾒たい差が半分なら、要る数は 4 倍。ばらつきの⼩さい数を選ぶ 結果の読み⽅

    (評価器ごと) p < 0.05、変化が正 treatment を出す p < 0.05、変化が負 control を残す p ≥ 0.05 数が⾜りないか差が無い 1 つが上がり別のが下がることもある。全部を⾒る © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 要る数は、⾒たい差の 2 乗に反⽐例 n = (4rσ / Δ)² r: 版の数、σ: 点のばらつき、 Δ: ⾒たい差 (信頼 95%、検出⼒ 90%) 差を半分にすると、要る数は 4 倍 この資料: Δ ≈ 0.25、σ ≈ 0.5 (合否の点) → 2 つの版で約 256 件 (流したのは 48 件) treatment は⼩さく始めて上げる 25
  21. 4 A/B テストで確かめる 有意差が出るまで全部には出さない。この資料は pause した 有意差あり (p < 0.05、正)

    stop Gateway の決まり treatment が勝った STOPPED は戻せない /desk/* に勝った版を当てる 有意差なし (この資料) pause 差か数が⾜りない 全部の流れが control へ 1 数を⾜して続ける resume で再開する 出⼒: pause したあとの A/B テストの状態 (命令は付録 A8) acdecks09_desk_ab_1 ACTIVE PAUSED results 2026-11-10T03:36:06.786Z © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 1 PAUSED: 全部の流れが control へ 26
  22. まとめ 次の輪へ 勝った版の記録が次の元。通るようになったケースは回帰のケースへ 新しい基準 回帰のケース 失敗の型 版 3 の本番の記録が、 通るようになったケースは

    batch の評価の 次の改善の案の元 回帰のケースに移して毎回流す Builtin.FailureAnalysis が 根の原因と直し⽅を返す insights (プレビュー) は 2026-10-16 から新しい仕事を作れない。いまは batch の評価で失敗を分ける 記録は週に何本か⼈が読む (点だけでは、評価器の誤りに気づけない) © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 27
  23. まとめ ⽚付けの順 決まりを先に消し、A/B は⽌めてから消す。A/B の役割は残る 1 Gateway の決まり 作ったときだけ。delete-gateway-rule (AWS

    CLI) 2 A/B テスト agentcore eval ab-test stop、delete (STOPPED のあと) 3 A/B の役割 AgentCoreABTest-… は残る。IAM で消す 4 改善の案 agentcore eval recommendation delete 5 configuration bundle agentcore eval config-bundle delete (決まりのあと) 6 プロジェクトの資源 online の評価、評価器、Gateway、Runtime、Memory © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 28
  24. まとめ まとめ 直し⽅を勘で決めず、案を読み、版にし、確かめてから出す ① 改善の案 ② configuration bundle ③ A/B

    テストと勝った版の出し⽅ 記録と評価器 1 つ 改善の案を読む bundle の版 batch と A/B 本番の記録と 評価器が⾒ない コードを載せ直さず 有意差を⾒て、 ⽬当ての評価器 決まりは⼈が直す 版で振る舞いを替える 勝った版を全部に 勝った版の記録で、また輪を回す © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 29
  25. まとめ 次に読む資料 守る柱へ: 誰が呼んだかを確かめるなら 10 10 08 04 ⼊⼝と出⼝に鍵をかける 評価する

    道具をつなぐ AgentCore Identity で、 ⽬当てにする評価器と、 Gateway の作りと 呼んだ⼈を確かめる online の評価の作り⽅ 対象の種類 © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 30
  26. 付録 A1 料⾦と上限 項⽬ 値 改善の案 作ること⾃体は無料。流れの中で新しく⾛る評価の分だけ Evaluations の料⾦ batch

    の採点 Evaluations の単価の 25% 引き A/B テスト その間に使った Gateway、Runtime、Evaluations の料⾦ Gateway 呼び出し 1,000 回 0.005 ドル Gateway の決まり 1 つの Gateway に 20 個まで。条件 3 つ、動作 2 つまで A/B テスト 1 つの Gateway で同時に動くのは 1 つ trafficSplit Gateway の決まりで分ける先は 2 つ。重みは 1〜99 改善の案 名前 48 ⽂字、指⽰ 20,000 ⽂字まで。評価器は 1 つ bundle の名前 英字で始め、英数字と下線だけ (100 ⽂字まで) この資料で流した呼び出しと採点の料⾦は、推定で約 9 ドル (トークンは測っていない。記録に内訳) © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 31
  27. 付録 A2 作る: configuration bundle (15、18 ⾯) AgentCore CLI 1.0.2

    (--json の引数は省いた) # components の形: {"<Runtime の ARN>": {"configuration": {...}}} # configuration の中は {"system_prompt": "<指⽰>"} N=acdecks09_desk_prompt C1="file://$PWD/bundle/components-v1.json" agentcore eval config-bundle create --name $N --components "$C1" BUN=acdecks09_desk_prompt-nK8CKi5iBF C3="file://$PWD/bundle/components-v3.json" M="版 3: 案の配送中の⾏を、お店の決まりに直した" U=(--id $BUN --components "$C3" --commit-message "$M") agentcore eval config-bundle update "${U[@]}" © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 32
  28. 付録 A3 作る: 改善の案、と読む (11、12 ⾯) AgentCore CLI 1.0.2 と

    jq # 11 ⾯: 始めた # 設定の形: systemPrompt.text (いまの指⽰) # agentTraces.cloudwatchLogs: logGroupArns、serviceNames、 # startTime、endTime (service 名は <Runtime 名>.DEFAULT) # evaluationConfig.evaluators: GoalSuccessRate の ARN 1 つ R="file://$PWD/rec/recommendation-config-text.json" A=(--name acdecks-09-desk-prompt-1 --type SYSTEM_PROMPT_RECOMMENDATION) agentcore eval recommendation start "${A[@]}" --recommendation-config "$R" # 11、12 ⾯: 読んだ REC=acdecks-09-desk-prompt-1-6443DDF5CE agentcore eval recommendation get --id $REC --json > out/rec.json jq -r '"\(.name) \(.type)"' out/rec.json jq -r '"\(.status) \(.createdAt) -> \(.updatedAt)"' out/rec.json jq -r '.recommendationResult[].recommendedSystemPrompt' out/rec.json | tail -4 © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 33
  29. 付録 A4 作る: Gateway と online の評価 (8 ⾯) AgentCore

    CLI 1.0.2 (窓⼝のプロジェクトのフォルダーで) agentcore add gateway --name shop --authorizer-type AWS_IAM agentcore add gateway-target --name desk --gateway shop --runtime agent # agentcore.json の onlineEvalConfigs に⾜した online の評価 (区切りは既定の 5 分): # {"name": "DeskAB", "agent": "agent", "samplingRate": 100, # "evaluators": ["Builtin.GoalSuccessRate", # "Builtin.Helpfulness", "ShopRules"]} agentcore deploy # Gateway から呼ぶ (CLI が SigV4 で署名し、session ID を⾒出しで渡す) I=(--gateway shop --path /desk/invocations) agentcore invoke "${I[@]}" --session-id "$SID" --payload "$P" © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 34
  30. 付録 A5 出す前に確かめる (19 ⾯) AgentCore CLI 1.0.2 と python3

    (batch の仕事は session ID と評価器 2 つで始めた) # 出す前に、版を baggage で⼿で渡して Runtime を直に呼ぶ (Gateway を通さない) K1=aws.agentcore.configbundle_arn K2=aws.agentcore.configbundle_version B="$K1=$BUN_ARN,$K2=$V3" I=(--runtime agent --session-id "$SID") agentcore invoke "${I[@]}" --baggage "$B" --payload "$P" # 19 ⾯: 3 つの batch の仕事の平均 B1=acdecks09_v1-68e5211501 B2=acdecks09_v2-a35bbdeac8 B3=acdecks09_v3b-629f1cbf77 python3 batch_avg.py $B1 $B2 $B3 © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 35
  31. 付録 A6 読む (18、22、24 ⾯) AgentCore CLI 1.0.2、jq、python3 # 18

    ⾯: bundle の版を古い順に BUN=acdecks09_desk_prompt-nK8CKi5iBF agentcore eval config-bundle version list --id $BUN --json > out/ver.json jq -c '.versions | sort_by(.versionCreatedAt)[]' out/ver.json > out/ver.jsonl jq -r '"\(.versionId[0:8]) \(.lineageMetadata.commitMessage)"' out/ver.jsonl # 22 ⾯: 動いている A/B (12:15 に保存した JSON) jq -r '"\(.name) \(.status) \(.executionStatus)"' ab/get-1.json jq -r '[.variants[] | "\(.name) \(.weight)"] | join(" ")' ab/get-1.json jq -r '"maxDurationExpiresAt \(.maxDurationExpiresAt)"' ab/get-1.json # 24 ⾯: A/B の結果 AB=acdecks09_desk_ab_1-c7eadadea0 agentcore eval ab-test get --id $AB --json > out/ab.json python3 ab_rows.py out/ab.json © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 36
  32. 付録 A7 作る: A/B テスト (22 ⾯) AgentCore CLI 1.0.2

    (流した引数を配列で書いた) V1=0f967c53-0953-4638-bdd7-93e91f08c468 V3=b811c7d9-1201-4229-a1fa-029d7e14b186 GW=acdecks09supportdesk-default-shop-xq03jmtpmo OE=acdecks09SupportDesk_default_DeskAB-d2czpeHFeP C="{\"config-bundle\":\"$BUN\",\"bundle-version\":\"$V1\"}" T="{\"config-bundle\":\"$BUN\",\"bundle-version\":\"$V3\"}" A=(--name acdecks09_desk_ab_1 --gateway $GW --online-eval $OE) A+=(--control "$C" --treatment "$T" --treatment-weight 50) A+=(--gateway-filter '{"targetPaths":["/desk/*"]}') agentcore eval ab-test config-based run "${A[@]}" © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 37
  33. 付録 A8 ⽌める、出す (26 ⾯) AgentCore CLI 1.0.2、AWS CLI、jq #

    26 ⾯: pause してから状態を読んだ AB=acdecks09_desk_ab_1-c7eadadea0 agentcore eval ab-test pause --id $AB agentcore eval ab-test get --id $AB --json > out/ab.json jq -r '"\(.name) \(.status) \(.executionStatus)"' out/ab.json jq -r '"results \(.results.analysisTimestamp)"' out/ab.json # 勝った版を全部に出すとき (この資料では有意差が出なかったので流していない) agentcore eval ab-test stop --id $AB O="{\"bundleArn\":\"$BUN_ARN\",\"bundleVersion\":\"$V3\"}" W="[{\"configurationBundle\":{\"staticOverride\":$O}}]" K='[{"matchPaths":{"anyOf":["/desk/*"]}}]' G=(--gateway-identifier $GW --priority 100 --conditions "$K" --actions "$W") aws bedrock-agentcore-control create-gateway-rule "${G[@]}" © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 38
  34. 付録 A9 ⽤語 ⽤語 意味 ⽤語 意味 改善の案 記録から作る直し⽅ control

    (C) いまの版 ⽬当ての評価器 案が上げる点 treatment (T1) 試す版 bundle 版付きの設定 重み 版に流す割合 版 (version) 変えられない写し p値 差が無いとき、この 差以上が出る率 baggage 版を渡す⾒出し 有意 p < 0.05 Gateway の決まり 流れと版の割り当て session 1 つの問い合わせ batch 記録をまとめて採点 回帰のケース 毎回流すケース ARN Amazon Resource Name LLM ⼤規模⾔語モデル © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 39
  35. 付録 A10 出典 AWS、AgentCore Developer Guide の optimization の章ほか 4、7〜8、10〜13、15〜19、27、29、31

    枚⽬ docs.aws.amazon.com/bedrock-agentcore/latest/devguide/optimization.html AWS、AgentCore Developer Guide の A/B testing と Gateway rules 8、17、21〜26、28、31 枚⽬ docs.aws.amazon.com/bedrock-agentcore/latest/devguide/ab-testing.html AWS、Amazon Bedrock AgentCore の料⾦ aws.amazon.com/bedrock/agentcore/pricing/ 31 枚⽬ AWS、2026 年 5 ⽉、agent quality optimization のプレビューの告知 (AWS Machine Learning Blog) 題: Introducing agent quality optimization in AgentCore, now in preview 6〜7、19、26、29 枚⽬ AWS、2026 年 9 ⽉、指⽰の改善の案の作り⽅ (AWS Machine Learning Blog) 題: Optimizing agent system prompts with Amazon Bedrock AgentCore 13 枚⽬ AWS、2026 年 4 ⽉、改善の案、batch、A/B のプレビュー (What's New) aws.amazon.com/about-aws/whats-new/2026/05/bedrock-agentcore-optimization-preview/ 13 枚⽬ Anthropic、2026 年 1 ⽉、エージェントの評価の作り⽅ www.anthropic.com/engineering/demystifying-evals-for-ai-agents 6、27 枚⽬ Kohavi、Henne、Sommerfield、2007 年、Web の対照実験の⼿引き (ACM KDD 2007) www.exp-platform.com/Documents/GuideControlledExperiments.pdf 25 枚⽬ 問い合わせ窓⼝のコードの元 (MIT-0、Module 1) github.com/aws-samples/sample-strands-agents-hands-on-workshop 16 枚⽬ © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 40

More Decks by Riku INADA

Other Decks in Technology