Share
Embed
AgentCore のしくみ | Kiro と学ぶ Amazon Bedrock AgentCore 01
Level 300。手元で動くエージェントを大勢に出すと、会話ごとの分離、前の話の記憶、外のサービスの認証、何をしたかの記録が一度に要ります。この資料では、それを受け持つ Amazon Bedrock AgentCore の 13 の部品の地図と、ループをコードで書くか設定で書くかの 2 つの載せ方を、公式のアイコンを使った図で説明します。架空のネットの家電のお店の問い合わせ窓口を AgentCore CLI で作り (create)、手元の Agent Inspector で動かし (dev)、東京の Runtime に載せて (deploy) 呼び (invoke)、記録と状態を読む (logs、status) ところまでを、何が起きたかの図と、この資料で流した画面の大事な行で見せます。載せた窓口が AWS の中にどう置かれたかの構成図、deploy で作られるもの、片付けても残るもの、費用の数え方、片付けの命令も扱います。シリーズ「Kiro と学ぶ Amazon Bedrock AgentCore」の 01 (はじめる) です。
Riku INADA PRO
November 10, 2026
Annual Pro sale · Save $30
Have presentations of your own?
Share with private links, password protection, and more control over your work.
Transcript
32 slides
-
Kiro と学ぶ Amazon Bedrock AgentCore 01 はじめる Level 300 AgentCore
のしくみ 部品の地図と、最初の 1 つを載せる 2026-11 時点 (AgentCore CLI 1.0.2) 2026 年 11 ⽉ 稲⽥ ⼤陸 アマゾン ウェブ サービス ジャパン © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 01 Kiro + AgentCore 1 -
はじめに ⾃⼰紹介 稲⽥ ⼤陸 いなだ りく (いなりく) アマゾン ウェブ サービス
ジャパン合同会社 ソリューションアーキテクト 製造業のお客様を中⼼に⽀援 最近の取り組み 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 -
はじめに シリーズの中の位置 いまは 01 AgentCore のしくみ、次は 02 Runtime を使いこなす はじめる
01–02 作り込む 01 AgentCore のしくみ 03–06 ⾒て直す 07–09 守って広げる 10–12 03 覚えさせる 07 動きを⾒る 10 ⼊⼝と出⼝に鍵をかける 04 道具をつなぐ 08 評価する 11 決まりで⽌める 09 良くし続ける 12 会社で探して使う 次に読む 02 Runtime を使いこなす 計算させ、 05 Web を⾒させる 06 設定で組む © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 3 -
はじめに この資料で分かること 部品の地図を⾒てから、問い合わせ窓⼝を 1 つ AWS に載せる 1 部品の地図: 本番に要る部品の集まりで、どれか
1 つから使える 2 載せ⽅は 2 つ: ループをコードで書くか、設定で書くか 3 載せて呼ぶ: CLI で作り、⼿元で動かし、載せて呼ぶ ⾒て学ぶ資料。⼿を動かすなら、AgentCore CLI の雛形のエージェントで同じ命令を流せる (公開の⼊⾨の⼿順) 部品の地図 2 つの載せ⽅ 載せて呼ぶ 本番に要る部品 コードか、設定か 窓⼝を AWS で動かす © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 4 -
1 AgentCore とは © 2026, Amazon Web Services, Inc. or
its affiliates. All rights reserved. 5 -
1 AgentCore とは ⼿元で動くのに、本番に出せない 1 ⼈で使う窓⼝を⼤勢に出すと、隔離、記憶、認証、観測が⼀度に要る ⼤勢に出すと⾜りないもの 返⾦してほしい 会話ごとの分離 Runtime
まだ届きません 前の話の記憶 agent.py ⼿元のパソコンで お客さんが⼤勢、同時に © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 動く窓⼝ 1 つ Memory 外の API の認証 Identity したことの記録 Observability これを部品で受け持つのが AgentCore 6 -
1 AgentCore とは エージェントとは モデル、道具、指⽰の 3 つ。モデルが道具を選び、結果を⾒てまた考える モデル 考える 考えて、次にすることを決める
答える 道具 台帳を読む関数、返⾦を受け付ける関数 モデル 指⽰ 決まりの⽂ (system_prompt) 結果を⾒て、 また考える lookup_customer など 道具を使う 道具が要らなくなるまで回る (ループ) © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 7 -
1 AgentCore とは 問い合わせ窓⼝ このシリーズで育てる、架空のネットの家電のお店の問い合わせ窓⼝ 「C-1001 です。注⽂した 品がまだ届きません」 道具 (Python
の関数 3 つ) lookup_customer 問い合わせ窓⼝ (エージェント) モデルは お客さん Amazon Bedrock の Claude Sonnet 5 お客さんの台帳を読む get_order_history 注⽂の台帳を読む process_refund 返⾦を受け付ける 台帳は架空のデータ。コードは Strands Agents (エージェントの SDK) © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 8 -
1 AgentCore とは 窓⼝のコード 道具とモデルを渡したエージェント。今は⼿元のパソコンでしか動かない agent.py (抜き書き。import と SYSTEM_PROMPT の⾏は省いた)
model = BedrockModel( model_id="global.anthropic.claude-sonnet-5", region_name="ap-northeast-1", # 呼ぶ先は東京 ) agent = Agent( model=model, tools=[lookup_customer, get_order_history, process_refund], system_prompt=SYSTEM_PROMPT, ) agent("C-1001 です。注⽂した品がまだ届きません") © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. agent.py ⼿元のパソコン ほかの⼈は呼べない 閉じると⽌まる global. は東京の外でも 推論する指定 9 -
1 AgentCore とは モデルを呼ぶ 1 回に、指⽰も道具の説明も会話も⼊る 道具を使うたびに、結果を⾜して全部をもう 1 回渡す 1
回の呼び出しで渡すもの 指⽰ (system_prompt) 毎回 道具の説明 使わない道具の分も これまでの会話 ⻑いほど増える 取り出した記憶 (Memory) 使うとき (03) Skill の指⽰ 使うとき (06) 答える (ここで終わる) モデル (1 回) Amazon Bedrock 道具を呼ぶ 道具の結果を会話に⾜して、全部をもう 1 回渡す 渡した量 (⼊⼒のトークン) と答えの量 (出⼒のトークン) が、モデルの料⾦になる © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 10 -
1 AgentCore とは AgentCore の部品の地図 本番に要る部品の集まり。単独でも組み合わせても使える はじめる 01〜02 Runtime エージェントを動かす
Amazon Bedrock AgentCore 作り込む 03〜06 ⾒て直す 07〜09 守って広げる 10〜12 Memory 会話と覚えたこと Observability トレースとログ Identity ⼊⼝と出⼝の認証 Gateway API を道具にする Evaluations 会話を採点する Policy Gateway で道具を⽌める Code Interpreter コードを動かす Optimization 改善の案、A/B AWS Agent Registry エージェントの⽬録 Browser Web を⾒る harness 設定で組む このシリーズで扱わない部品: Payments (エージェントの⽀払い。東京のリージョンには無い) © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 11 -
2 載せ⽅と⽤意 © 2026, Amazon Web Services, Inc. or its
affiliates. All rights reserved. 12 -
2 載せ⽅と⽤意 さまざまなフレームワークとモデルで使える Strands 以外のフレームワークでも、フレームワークなしでも載せられる 選べるもの 例 フレームワーク Strands Agents、LangGraph、CrewAI、LlamaIndex、
Google ADK、OpenAI Agents SDK、⾃分で書いたコード モデル Amazon Bedrock のモデル (Claude、Amazon Nova など) と、 Bedrock の外のモデル CLI の雛形 Strands (Python、TypeScript)、LangChain、Vercel AI SDK、 フレームワークなし 部品だけ Runtime に載せずに、Memory や Gateway だけを使うこともできる © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 13 -
2 載せ⽅と⽤意 2 つの載せ⽅ ループをコードで書いて載せるか、設定だけを書くか コードで書く (この資料) Runtime に載せる main.py
ループは⾃分のコード AgentCore フレームワークを選べる 設定で書く (harness) harness として動く 設定ファイル © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. ループは AWS が持つ (中は Strands Agents) AgentCore 多くは設定を変えるだけ 14 -
2 載せ⽅と⽤意 AgentCore CLI 1 つで、作るから⽚付けるまで⾏う この資料で使う 6 つの命令。⑥ の⽚付けは説明だけ
① create ② 作る ⼿元で動かす dev ③ deploy 載せる ④ invoke 呼ぶ ⑤ logs 記録を⾒る ⑥ remove ⽚付ける ② ③ ④ ② ⼿元で動かす ③ 載せる ④ 呼ぶ ⑥ ⑥ ⽚付ける 画⾯は引数なしの agentcore が開く命令の⼀覧。create はプロジェクトの外、logs は --help に出る © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 15 -
2 載せ⽅と⽤意 ⽤意するもの Node.js、Python と uv、資格情報、モデル、載せる先の 5 つ Node.js Python
3.10 AWS の Bedrock の 載せる先 20.12 以上 以上と uv 資格情報 モデル この資料は CLI は npm で uv は Python の AgentCore と 基盤モデルは 東京のリージョン ⼊れる 依存を⼊れる AWS CDK の権限 既定で使える CLI は npm install -g @aws/agentcore で⼊れる (この資料は 1.0.2) 試すときの権限は AgentCore と、CDK の bootstrap (CDK が最初に作る準備) のロールを使えること。本番は 最⼩の権限にする © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 16 -
3 問い合わせ窓⼝を載せる © 2026, Amazon Web Services, Inc. or its
affiliates. All rights reserved. 17 -
3 問い合わせ窓⼝を載せる create で、⼿元にコードで書く形の雛形ができた create は⼿元に作るだけ。AWS の資源は deploy で作る ①
② ③ Runtime と 資源を作る 窓⼝の Memory の設定 agentcore.json CDK のアプリ agentcore/cdk Python の依存 uv で⼊れた ④ git の倉庫 git init 済み ① 設定とコードの⽊を作った ② CDK のアプリの依存を⼊れた ③ 窓⼝の Python の依存を⼊れた ④ git の倉庫を作った ① ② ③ ④ --template agent-python-strands で Strands で書く形。名前だけだと harness の形。Memory は雛形に ⼊る (中⾝は 03) © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 18 -
3 問い合わせ窓⼝を載せる できたファイル 設定、載せる先、CDK、窓⼝のコードが分かれて置かれる acdecks01SupportDesk/ agentcore/ agentcore.json プロジェクトの仕様 (Runtime、Memory など)
aws-targets.json 載せる先のアカウントとリージョン .env.local ⼿元だけの秘密 (git に⼊れない) cdk/ 資源を作る CDK のアプリ app/agent/ main.py Runtime が呼ぶ⼊⼝と、窓⼝のエージェント tools.py 窓⼝の道具 3 つ (この資料で⾜した) model/load.py 使うモデル (Claude Sonnet 5 に替えた) © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 19 -
3 問い合わせ窓⼝を載せる 窓⼝を⼊れる 窓⼝の道具と指⽰を、Runtime が呼ぶ⼊⼝の中で動かす app/agent/main.py (抜き書き。... は省いた⾏) tools =
[lookup_customer, get_order_history, process_refund] def create_app(): app = BedrockAgentCoreApp() @app.entrypoint async def invoke(payload, context): ... prompt, actor_id = parse_payload(payload) agent = _get_agent(session_id, actor_id) async for event in agent.stream_async(prompt): ... yield event © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. @app.entrypoint → Runtime が呼ぶ⼊⼝ tools → 窓⼝の道具 3 つ load_model() → Claude Sonnet 5 yield event → 答えを流して返す 20 -
3 問い合わせ窓⼝を載せる dev で、Runtime と同じ形の窓⼝が⼿元で動いた 窓⼝は⼿元で動くが、モデルは AWS の Bedrock を呼ぶ
「C-1001 です。注⽂した 品がまだ届きません」 ① ⼿元の窓⼝ (dev) Amazon Bedrock のモデル Runtime と同じ形で動く 呼ぶ先は AWS (東京) Agent Inspector (⼿元のブラウザ) 窓⼝の答え 「お客様情報を確認いたします。⼭⽥花⼦様、お問い合わせありがとう ございます。」 (このあと注⽂の状況と、届く予定⽇) ① 窓⼝は⼿元だけ © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. この会話の ID 21 -
3 問い合わせ窓⼝を載せる deploy で作られるもの、残るもの、費⽤ deploy は CDK でプロジェクトのスタックを作る。費⽤は使った分だけ ⼿元 CDK
AWS CloudFormation のスタックを 作る コードを zip に AWS (東京) にできるもの Runtime、endpoint Memory 実⾏のロールなど CloudWatch のログ ⽚付けてもアカウントに残るもの 費⽤ (使った分だけ) CDK の bootstrap のスタック (CDKToolkit) Runtime は CPU とメモリを秒で数える Transaction Search の設定 (トレースを探す) モデル、Memory、ログは別に掛かる ロググループ (スタックの外。残っていれば消す) 予算のアラートを付けておく © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 22 -
3 問い合わせ窓⼝を載せる deploy で窓⼝が AWS に載った。スタックは約 80 秒でできた bootstrap 済みのアカウントで、この資料で測った値
① テンプレートを作る ② トレースを探す設定 スタックを作る ③ 載せ終わった CDK が書き出す Transaction Search 約 80 秒 (測った値) 次は invoke 載せる先のアカウントとリージョンは aws-targets.json に書かれる。bootstrap からだと数分かかる ① ② ① テンプレートを作る ② トレースを探す設定 ③ ③ 載せ終わった © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 23 -
3 問い合わせ窓⼝を載せる invoke で、載せた窓⼝が道具を 2 つ使って答えた 流した命令 agentcore invoke --runtime
agent --payload '{"prompt":"C-1001 です。注⽂した品がまだ届きません"}' 「C-1001 です。注⽂した 品がまだ届きません」 invoke (AWS の署名を付けて呼ぶ) ③ 答える AgentCore Runtime (東京) ① lookup_customer お客さんを引く ② get_order_history 注⽂の履歴を引く 「⼭⽥様、お問い合わせありがとうございます。… ・ORD-5488 USB-Cハブ(4,500 円):現在配送中で、お届け予定⽇は 2026 年 11 ⽉ 11 ⽇です。…」 既定の⼊⼝ (IAM) では、呼べるのは AWS の署名で確かめた⼈だけ。お客さんの画⾯から呼ぶ形は 10 で扱う 同じ会話を続けるには同じ session ID を渡す。⼈と session ID の対応は呼ぶ側が持つ (02) © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 24 -
3 問い合わせ窓⼝を載せる 載せた窓⼝は、AWS の中にこう置かれた Runtime、Memory、ロールはスタック 1 つに。ログと zip はその外 13
の部品のうち、この窓⼝が使うのは Runtime、Memory、Observability の 3 つ (地図は 11 枚⽬) モデルを呼ぶ先は東京。global. の指定なので、推論は東京の外で動くこともある (9 枚⽬) © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 25 -
3 問い合わせ窓⼝を載せる logs で、呼び出しの記録が⼿元から読めた 「Invoking with」の⾏に絞ると、1 回の呼び出しが 1 ⾏になる いつ
どこで どの処理 どの会話 誰 14:57:29 main.py:47 6af1df54… 882e4de8… default UTC (⽇本 23:57) 窓⼝のコードの⾏ trace_id (07) session_id (02) actor_id (既定) 呼ぶたびに 1 ⾏ずつ、「Invoking with」の⾏が残る。この資料では 2 回呼んだので 2 ⾏ (23:57 と 0:00) agentcore traces runtime list で、呼び出しごとのトレース (1 回の処理の記録) の⼀覧も出る。読み⽅は 07 © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 26 -
3 問い合わせ窓⼝を載せる ⽚付けは 2 つの命令。今はまだ流さない remove all で設定から外し、deploy で AWS
から消す ① agentcore remove all --yes ② agentcore deploy --yes 設定から、すべての資源を外す (⼿元だけ) 空になった設定で、載せたスタックを消す この資料では流していない。02 以降もこの窓⼝を使うので、シリーズを読み終えるまで残す 下の画⾯は、⽚付ける前の agentcore status の出⼒ ③ Runtime が載っている ④ Memory も載っている ③ ④ © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 27 -
まとめ まとめ AgentCore は本番に要る部品の集まり。CLI で窓⼝を載せて呼べる 1 部品の地図: 本番に要る部品の集まりで、どれか 1 つから使える
2 載せ⽅は 2 つ: ループをコードで書くか、設定で書くか 3 載せて呼ぶ: CLI で作り、⼿元で動かし、載せて呼ぶ 部品の地図 2 つの載せ⽅ 載せて呼ぶ 本番に要る部品 コードか、設定か 窓⼝を AWS で動かす © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 28 -
まとめ 次に読む資料 Runtime を深くなら 02。部品を⾜すなら 03〜05 02 03〜05 別のシリーズ Runtime
を使いこなす 部品を⾜す Kiro と学ぶ Strands Agents 08 セッション、版と endpoint、 Memory、Gateway、 窓⼝を Strands で作り、 ⻑い仕事 Code Interpreter と Browser クラウドに載せる © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 29 -
付録 A1 ⽤語 ⽤語 意味 ⽤語 意味 エージェント モデル、道具、指⽰とループ CDK
AWS の資源をコードで書く道具 Runtime エージェントを動かす所 bootstrap CDK が最初に作る準備 セッション 1 つの問い合わせの続き uv Python の依存を⼊れる道具 microVM セッションごとの⼩さな VM endpoint 呼ぶ先 (DEFAULT は最新) harness AWS が持つループ Agent Inspector dev が開く⼿元の画⾯ Transaction Search トレースを探す設定 SigV4 AWS の署名の確かめ © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 30 -
付録 A2 命令の全⽂ 窓⼝のプロジェクトのフォルダで流した (create を除く。# の⾏は、使った⾯と何をした命令か) agentcore # 15:
引数なしで、命令の⼀覧を開く # 18: create だけは、プロジェクトを作る 1 つ上のフォルダで流す agentcore create --name acdecks01SupportDesk --template agent-python-strands agentcore dev --mode browser # 21: ⼿元で動かし、Agent Inspector を開く agentcore deploy # 23: 載せる # 24: 載せた窓⼝を呼ぶ (この資料では 2 回流した) agentcore invoke --runtime agent --payload '{"prompt":"C-1001 です。注⽂した品がまだ届きません"}' # 26: 記録のうち「Invoking with」の⾏を 2 つ読む agentcore logs runtime --since 30m --limit 2 --query '"Invoking with" -telemetry -timestamp' agentcore status # 27: 載せた資源を⾒る agentcore remove all --yes # 27: ⽚付け (この資料では流していない) agentcore deploy --yes # 27: 空の設定でスタックを消す (流していない) © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 31 -
付録 A3 出典と参考 AWS「Amazon Bedrock AgentCore Developer Guide」: Get started
with AgentCore (⼊⾨の⼿順) ほか 5 ⾴ (4、10、11、13、14、15、16、18、19、20、21、22、23、24、25、26、27 枚⽬) https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-get-started-cli.html AWS、2026 年 6 ⽉、AgentCore harness の⼀般提供 (AWS Machine Learning Blog) (6 枚⽬) https://aws.amazon.com/blogs/machine-learning/ (題: Amazon Bedrock AgentCore harness is now generally available) AWS、2025 年 10 ⽉、東京を含むリージョンでの⼀般提供 (AWS ⽇本語ブログ) (6、13 枚⽬) https://aws.amazon.com/jp/blogs/news/amazon-bedrock-agentcore-is-now-generally-available/ AWS、Amazon Bedrock AgentCore の料⾦ (22 枚⽬) https://aws.amazon.com/bedrock/agentcore/pricing/ OpenAI、2025 年 4 ⽉、エージェントの作り⽅の⼿引き (7、10 枚⽬) https://cdn.openai.com/business-guides-and-resources/a-practical-guide-to-building-agents.pdf Anthropic、2025 年 11 ⽉、⻑い仕事をするエージェントの周りの仕組み (7 枚⽬) https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents Anthropic、2025 年 9 ⽉、エージェントのための道具の書き⽅ (8 枚⽬) https://www.anthropic.com/engineering/writing-tools-for-agents 問い合わせ窓⼝のコードの元 (MIT-0、Module 1) (8、9 枚⽬) https://github.com/aws-samples/sample-strands-agents-hands-on-workshop © 2026, Amazon Web Services, Inc. or its affiliates. All rights reserved. 32