[アップデート] Amazon Bedrock AgentCore RuntimeでStrands Boxが使えるようになりました! #AWSreInvent

[アップデート] Amazon Bedrock AgentCore RuntimeでStrands Boxが使えるようになりました! #AWSreInvent

AgentCore RuntimeがStrands Boxに対応し簡単にデプロイできるようになりました!
2026.12.02

はじめに

こんにちは、コンサル部の神野です。
絶賛re:Inventに来て、Keynoteを聴いていました!

今日のアップデートでAmazon Bedrock AgentCore Runtimeがエージェントをサンドボックスに入れて動かすStrands Boxに対応しました!

https://aws.amazon.com/jp/about-aws/whats-new/2026/12/agentcore-runtime-strands-box/

これまでは自前でビルドしてスタックを用意する必要がありましたが、今回からはAgentCore CLIだけでRuntimeと通信制御用のGatewayまで作れます!

主な変更点をまとめて、公式の手順に沿ってRuntimeへのデプロイまで試してみます!
Strands Box自体は以前試していて、仕組みは下記の記事で紹介しているので合わせてご参照ください!

https://dev.classmethod.jp/articles/strands-box-agent-sandbox-policy/

主な変更点

Box入りのエージェントをCLIでデプロイできる

Strands公式のサンプルではLinux ARM64の環境でBoxをソースからビルドし、
パッケージをS3に置いてスタックも自分で用意する手順になっています。

https://strandsagents.com/docs/user-guide/box/guides/deploy-to-agentcore-runtime/

今回からはAgentCore CLIのBox用テンプレートでプロジェクトを作り、agentcore deploy を実行するだけでRuntimeと外への通信の出口になるGatewayまで作成可能です!
イメージのビルドはAWS CodeBuildで行われるので、MacからでもLinux ARM64の環境を用意せずにデプロイできました。

Boxのビルドとスタック準備の代わりにagentcore createとagentcore deployでRuntimeとGatewayを作る流れ

なおAgentCoreのドキュメントでは、Strands Boxへの対応はプレビューとなっています。

https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-get-started-box.html

通信はBoxが判定してGateway経由で出ていく

デプロイされる構成はこんな形です。

microVMで動くStrands Box内のエージェントから許可した通信だけがAgentCore Gateway経由でBedrockとapi.github.comへ出ていく。example.comは403で拒否され判定はCloudWatch Logsに残る

Runtimeのセッションはそれぞれ専用のmicroVMで動き、その中でBoxがエージェントを閉じ込めます。
エージェントが外へ通信するとBoxがポリシーで判定し、許可したものだけがBox用のGatewayを通って出ていきます。

許可するホストはBoxのプロファイル(profile.toml)に書いて、ビルドのときにCLIがGatewayのターゲットへ変換してくれます。Bedrockへの呼び出しはGatewayのIAMロールで署名されるので、エージェント自身はAWSの認証情報を持ちません。

テンプレートには実行ロールの認証情報を返すインスタンスメタデータへの接続を禁止するポリシーも最初から入っていました。このポリシーは以前AgentCore PolicyのTemporal Policiesで使ったDogwoodで書かれています。

https://dev.classmethod.jp/articles/agentcore-gateway-dogwood-temporal-policies/

許可・拒否の判定はRuntimeのロググループにCloudWatch Logsのレコードとして1件ずつ記録されます。

インターネットへの経路がないVPCにも置ける

agentcore create に --containment private-vpc を付けると、インターネットへの経路がないVPCの中でRuntimeを動かす構成になります。作成だけ試してみると、CLIが月額の目安を表示しました。

--containment private-vpc で作成したときの出力(抜粋)
containment: private VPC with no internet path · about $58/month while deployed for CodeZip, $88 for a container, more with 3 AZs · the VPC is kept after the stack is deleted and counts toward the account's VPC quota until you delete it

コンテナ型だと月88ドルほどかかるので結構高額ですね。
今回はデフォルトの contained でデプロイします。

前提

項目 内容
AgentCore CLI 1.5.0
Strands Box 0.3.3
ローカルのPC macOS 26.6.2(Apple silicon)
リージョン us-east-1
モデル Claude Sonnet 5.5(テンプレートのデフォルト)

Box用のプロジェクトはRuntimeのplatform version V2で動くので、V2に対応したリージョンを選びます。東京リージョンも対応しています。

https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/agentcore-regions.html

CLIはビルドやデプロイのときにboxコマンドでプロファイルを読むので、Boxも入れておきます。

インストール
pnpm add -g @aws/agentcore@1.5.0
brew install --cask strands-agents/tap/box

やってみた

Boxのプロジェクトは公式ドキュメントでもAgentCore CLIで作る手順になっているので、今回もCLIで進めます。

プロジェクトを作る

Box用のテンプレートを指定してプロジェクトを作ります。

プロジェクトの作成
agentcore create --name MyBoxProject --template agent-python-strands-box-container
cd MyBoxProject

作られたBoxのプロファイルには、Bedrockへの呼び出しをAWSの認証情報で署名する設定とメタデータへの接続を禁止するポリシーファイルの指定が入っていました。

.box/agent/local/profile.toml(抜粋)
packs = ["@box/base", "@box/bedrock"]
policies = ["aws-metadata-block.dw"]

[egress.bedrock]
secret.ref = "aws://"

Dockerfileでは box run がコンテナの入口になっていて、Boxが8080番で受けたリクエストを中のエージェント(8081番)へ渡します。

app/agent/Dockerfile(抜粋)
ENTRYPOINT ["/opt/box/box", "run", "/home/bedrock_agentcore/box-profile/profile.toml", "--no-banner"]

外部サイトを取得するツールを足す

公式手順と同じく、GitHubかexample.comのどちらかを取得するツールを app/agent/main.py の tools.append(add_numbers) の後ろに追加します。

app/agent/main.py に追加したツール
app/agent/main.py(追加)
SITES = {
    "github": "https://api.github.com/zen",
    "example": "https://example.com",
}

@tool
def fetch_site(site: str) -> str:
    """Fetch the first 500 characters from a known site. The site is "github" or "example"."""
    import urllib.request
    url = SITES.get(site)
    if url is None:
        return f"UNKNOWN SITE: {site}"
    try:
        with urllib.request.urlopen(url, timeout=10) as r:
            return r.read(500).decode("utf-8", "replace")
    except Exception as e:
        return f"FETCH FAILED: {type(e).__name__}: {e}"

tools.append(fetch_site)

許可するホストを足す

プロファイルの末尾にapi.github.comを足します。

.box/agent/local/profile.toml(追加)
[egress.github]
destinations = ["api.github.com"]

ビルドすると、追加したホストがGatewayのターゲット egress-github として登録されました。

ビルド
agentcore build
実行結果(抜粋)
adding gateway target 'egress-github' to 'agent-box-egress' for api.github.com
adding target 'bedrock' to gateway 'agent-box-egress' in agentcore.json, for the boxed agent's model calls

Gatewayのターゲットを自分で書かなくても、プロファイルに書いたホストから作ってくれるのは楽ですね。
ホストを外すときもプロファイルを直してビルドし直すだけとなります。

デプロイして呼び出す

デプロイ
agentcore deploy

初回はCodeBuildでイメージをビルドするので、デプロイが終わるまで7分ほどかかりました。agentcore status を実行すると、GatewayにBedrock用とGitHub用の2つのターゲットがデプロイされています。

agentcore status の結果(Gatewayの部分を抜粋)
{
  "resourceType": "gateway",
  "name": "agent-box-egress",
  "children": [
    { "resourceType": "gateway-target", "name": "egress-github", "deploymentState": "deployed" },
    { "resourceType": "gateway-target", "name": "bedrock", "deploymentState": "deployed" }
  ],
  "deploymentState": "deployed"
}

許可したGitHubと許可していないexample.comを続けて取得するよう頼みます。

エージェントの呼び出し
agentcore invoke --runtime agent \
  --payload '{"prompt":"Use fetch_site with the site github and tell me what it returned. Then use fetch_site with the site example and tell me what happened."}'
エージェントの回答(ストリームのテキストをつなげたもの)
I made both calls.

1. **github**: The call worked. It returned the text "It's not fully shipped until it's fast."
2. **example**: The call failed. It returned `FETCH FAILED: URLError: <urlopen error Tunnel connection failed: 403 Forbidden>`. The proxy tunnel refused the connection with a 403 Forbidden error, so I got no content from that site.

GitHubからは一言が返ってきて、example.comは403で拒否されましたね!

判定のログを見る

Runtimeのログから拒否の記録を探します。

拒否の記録を検索
agentcore logs runtime --since 15m --query '"deny"'
拒否の記録(attributesを抜粋)
"strands.box.policy.action": "net:connect",
"strands.box.policy.resource": "example.com:443",
"strands.box.policy.verdict": "deny",
"strands.box.policy.cause": "no_match",
"strands.box.policy.reason": "no permit matched",
"strands.box.policy.rule": "<default-deny>"

どのルールにも当てはまらず、接続(net:connect)の段階で拒否されています。

許可の記録も含めて1行ずつに整形すると、今回の呼び出しではこう判定されていました。

判定の記録
permit  net:connect   bedrock-runtime.us-east-1.amazonaws.com:443  route_bedrock-api-key_connect
permit  http:request  bedrock-runtime.us-east-1.amazonaws.com:443/model/global.anthropic.claude-sonnet-5-5/converse-stream  route_bedrock-api-key_request
deny    net:connect   example.com:443  <default-deny>
permit  net:connect   api.github.com:443  route_github_connect
permit  http:request  api.github.com:443/zen  route_github_request

プロファイルに書いたgithubという名前がルール名(route_github_connect)に出ているので、どの設定で通ったのか追いやすいですね。

判定の記録を整形したコマンド
判定の記録の整形
agentcore logs runtime --since 20m --query '"strands.box.policy.decision"' \
  | cut -d' ' -f3- \
  | jq -r 'select(.eventName == "strands.box.policy.decision") | .attributes
      | [.["strands.box.policy.verdict"], .["strands.box.policy.action"],
         .["strands.box.policy.resource"], .["strands.box.policy.rule"]] | @tsv'

後片付け

リソースの削除
agentcore remove all --yes
agentcore deploy --yes

RuntimeとCodeBuildのロググループはスタックの外にあるので残ります。イメージのビルドを起動するLambdaのロググループも削除されずに残るので、公式ドキュメントの後片付けの手順で確認して消しておきます。

https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-get-started-box.html#runtime-get-started-box-clean-up

残るロググループの削除
aws logs delete-log-group --log-group-name /aws/bedrock-agentcore/runtimes/<RuntimeのID>-DEFAULT
aws logs delete-log-group --log-group-name /aws/codebuild/<CodeBuildのプロジェクト名>

おわりに

AgentCore RuntimeでStrands Boxを使ってみました!今後統制を意識したエージェントを作りたい時に使う可能性もあるかもしれませんね!実際に使用したり運用した際にブログを書いていきたいですね!

本記事が少しでも参考になりましたら幸いです。最後までご覧いただきありがとうございました!

この記事をシェアする

AWSのお困り事はクラスメソッドへ

関連記事