0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Amazon Bedrock AgentCore Web Searchを東京リージョンで試してみた

0
Last updated at Posted at 2026-08-24

こんにちは!

最近、Amazon Bedrock AgentCoreのWeb Search Toolが東京リージョンでも利用できるようになったという話を見かけました。

AgentCore Web Searchでは、AgentCore GatewayにWeb Search Toolを追加することで、MCP(Model Context Protocol)経由でエージェントから検索できるようです。

今回は、Strands AgentからAgentCore GatewayのWeb Searchを呼び出して、ターミナル上で検索結果を確認してみました。

8月14日に東京リージョン対応、実際に使ってみた

2026年8月14日、AWSのリリースノートに、Web Search Toolが東京リージョンとアイルランドリージョンで利用できるようになったという記載が追加されました。

リリースノートには、次のように記載されています。

Gateway: Web Search Tool now available in Europe (Ireland) and Asia Pacific (Tokyo)

この更新により、東京リージョンとアイルランドリージョンのAgentCore GatewayからWebSearchを呼び出せるようになりました。検索基盤にはAmazonが運用するWeb indexとknowledge graphが使われており、検索クエリは第三者の検索エンジンへ送信されず、AWS内で処理されます。また、Connector version 1.1.01.2.0が利用でき、1.2.0ではドメインや公開日のフィルタも使えます。

この記事の前提(環境・対象)

今回の環境は以下です。

項目 内容
Gatewayリージョン 東京(ap-northeast-1
実行環境 macOS / Python 3.13
エージェント Strands Agents
推論モデル jp.anthropic.claude-sonnet-4-6
boto3 1.43.71
mcp-proxy-for-aws 1.6.4
strands-agents 1.52.0

Amazon Bedrock AgentCore Web Searchとは

AgentCore Web Searchは、AgentCore Gatewayに追加できるマネージドのWeb検索ツールです。

AWS公式ドキュメントでは、次のような特徴が説明されています。

  • MCPに対応したツールとして利用できる
  • 検索結果としてタイトル、URL、スニペット、公開日などを返す
  • 外部の検索APIや検索用インフラを自分で用意しなくてよい
  • Strands Agents、LangChain、LangGraph、CrewAIなど、MCPに対応したクライアントから利用できる
  • ドメインの含める/除外する設定や、公開日のフィルタを追加できる(Connector version 1.2.0以降)

エージェントから見た処理の流れは、次のようになります。

Strands Agent
    |
    | MCP tools/list
    v
AgentCore Gateway
    |
    | MCP tools/call
    v
Web Search Tool
    |
    v
検索結果(タイトル・URL・スニペット・公開日)
    |
    v
Strands Agentが回答を生成

検索APIを直接呼び出すのではなく、GatewayがMCPの入り口になるところがポイントです。

AgentCore Gatewayを作る

まず、AWSコンソールでAgentCoreのGateway画面から「ゲートウェイを作成」を選択します。

スクリーンショット 2026-08-17 9.58.59.png

Step 1: Gateway details

Gateway名はstrands-web-search-gatewayにしました。説明は任意のため、今回は入力していません。

今回はIAMロールに「デフォルトロールを作成」を選択しました。

スクリーンショット 2026-08-17 11.17.10.png

Step 2: Inbound Identity

Inbound Auth typeではIAM 許可を使用を選択します。

今回はローカルのAWS profileからSigV4署名付きリクエストを送るため、IAM認証を使用します。

JWTを選び、Amazon Cognitoなどを認可サーバーとして利用する場合は、トークン発行などの準備が別途必要になります。ローカルのAWS profileを使って試すだけであれば、IAMを選ぶのが分かりやすいと思います。

スクリーンショット 2026-08-17 10.00.54.png

Step 3: Add targets

Target nameには自動生成された名前が入力されています。この名前は環境ごとに異なり、任意の名前へ変更することもできます。今回はtarget-quick-start-0510edのまま使用しました。

ターゲット名は、Gatewayから取得するMCPツール名のプレフィックスにも使われます。別の名前を指定した場合は、実行時に表示されるツール名も変わります。

Target protocolではMCP targetを選択します。

スクリーンショット 2026-08-17 10.15.44.png

Target typeでConnectors、Pre-configured targetsでWeb Search toolを選択します。Versionはv1.2を選び、Outbound authorizationはIAM ロールのままにします。

スクリーンショット 2026-08-17 10.16.20.png

設定した内容は次のとおりです。

項目 設定
Target name 自動生成された名前を使用(今回はtarget-quick-start-0510ed
Target description 未入力(任意)
Target protocol MCP target
Target type Connectors
Connector Web Search tool
Connector version v1.2
Passthrough Do not use passthrough - default aggregated
Outbound authorization IAMロール

Step 4: Review and create

設定を確認してGatewayを作成します。

作成後、GatewayとTargetの詳細画面で以下を確認します。

  • ゲートウェイ ステータスがReady
  • ゲートウェイリソース URLが発行されている
  • ターゲット ステータスがReady
  • Protocol typeがMCP
  • ターゲットタイプがWeb Search tool
  • Pass-throughがNot passthrough
  • Outbound Auth configurationsがIAM roles

作成したGatewayの詳細画面です。
スクリーンショット 2026-08-17 11.26.51.png

作成したTargetの詳細画面です。作成画面で選択したDo not use passthrough - default aggregatedは、詳細画面ではNot passthroughと表示されます。

スクリーンショット 2026-08-17 19.12.32.png

Pythonプロジェクトを準備する

今回の検証では、Python 3.13の仮想環境に、以下のバージョンのパッケージをインストールしました。

mkdir agentcore-web-search-demo
cd agentcore-web-search-demo

python3 -m venv .venv
source .venv/bin/activate
python -m pip install \
  'boto3==1.43.71' \
  'mcp-proxy-for-aws==1.6.4' \
  'strands-agents==1.52.0'

実行に使うAWS profileには、少なくともGatewayを呼び出すbedrock-agentcore:InvokeGatewayと、Bedrockモデルを呼び出すbedrock:InvokeModelbedrock:InvokeModelWithResponseStreamが必要です。また、前の手順で作成したGatewayがReadyで、Web Search Tool targetが追加されていることを確認してください。

AWS profileを確認する

あらかじめ、AWS CLIから利用できるprofileを用意しておきます。認証方式は環境によって異なるため、以下ではprofile名の指定と認証確認だけを行います。

export AWS_PROFILE=your-aws-profile
aws sts get-caller-identity --profile "$AWS_PROFILE"

SSO(IAM Identity Center)を使っている場合は、事前にaws sso login --profile "$AWS_PROFILE"を実行してください。get-caller-identityの結果で、想定しているAWSアカウントとロールになっていることを確認します。

Strands AgentからGatewayに接続する

今回のサンプルでは、AgentCore GatewayとのMCP接続にmcp-proxy-for-awsを使いました。以下のコード全体をagentcore_web_search.pyという名前で保存します。Gateway URL、リージョン、モデルIDは後述の環境変数から読み込み、質問はコマンドライン引数で受け取ります。

import os
import sys

import boto3
from mcp_proxy_for_aws.client import aws_iam_streamablehttp_client
from strands import Agent
from strands.models import BedrockModel
from strands.tools.mcp import MCPClient


profile = os.environ["AWS_PROFILE"]
gateway_region = os.environ["AGENTCORE_GATEWAY_REGION"]
gateway_url = os.environ["AGENTCORE_GATEWAY_URL"]
model_region = os.environ["BEDROCK_MODEL_REGION"]
model_id = os.environ["BEDROCK_MODEL_ID"]
query = sys.argv[1] if len(sys.argv) > 1 else (
    "Amazon Bedrock AgentCore の最新情報について教えてください"
)

session = boto3.Session(
    profile_name=profile,
    region_name=model_region,
)

model = BedrockModel(
    model_id=model_id,
    boto_session=session,
    max_tokens=4096,
    temperature=0.2,
)

mcp_client = MCPClient(
    lambda: aws_iam_streamablehttp_client(
        endpoint=gateway_url,
        aws_service="bedrock-agentcore",
        aws_region=gateway_region,
        aws_profile=profile,
    )
)

system_prompt = """
あなたは日本語のリサーチアシスタントです。AgentCore Gateway の WebSearch ツールを使えます。

回答ルール:
1. 最新情報、日付、価格、リリース、ニュース、現行仕様に関する質問は、必ず WebSearch を先に呼び出す。
2. 検索結果にない内容を推測で補わない。分からない場合は分からないと明記する。
3. 検索結果を使った回答では、末尾に「参考情報」を置き、利用した各ソースのタイトル、URL、公開日を列挙する。
4. URLは検索結果に返されたものをそのまま使う。URLを創作しない。
5. 簡潔な日本語で答え、必要なら箇条書きにする。
""".strip()

print(f"[query] {query}")
print("[info] Strands Agent を実行中です...", file=sys.stderr)

with mcp_client:
    tools = mcp_client.list_tools_sync()
    tool_names = [
        getattr(tool, "tool_name", getattr(tool, "name", "unknown"))
        for tool in tools
    ]
    print(f"[info] Gateway tools: {', '.join(tool_names)}", file=sys.stderr)

    agent = Agent(
        model=model,
        tools=tools,
        system_prompt=system_prompt,
    )

    agent(query)

Gatewayは東京リージョンに作成し、モデルには日本国内の東京・大阪リージョンへルーティングされるGeo Cross-Region Inference Profileを使用します。

ターミナルから実行する

Gateway URLなどを環境変数に設定します。your-aws-profile<gateway-id>は、自分のAWS profile名と作成したGatewayの値に置き換えてください。

export AWS_PROFILE=your-aws-profile
export AGENTCORE_GATEWAY_REGION=ap-northeast-1
export AGENTCORE_GATEWAY_URL='https://<gateway-id>.gateway.bedrock-agentcore.ap-northeast-1.amazonaws.com/mcp'
export BEDROCK_MODEL_REGION=ap-northeast-1
export BEDROCK_MODEL_ID='jp.anthropic.claude-sonnet-4-6'

そのうえで、質問を渡して実行します。

python agentcore_web_search.py \
  'Amazon Bedrock AgentCore の最新情報について教えてください'

実際に実行した結果です。Web Search Toolの使用感を確認するためのもので、生成された回答内容は参考としてご覧ください。

[query] Amazon Bedrock AgentCore の最新情報について教えてください
[info] Strands Agent を実行中です...
[info] Gateway tools: target-quick-start-0510ed___WebSearch
最新情報を検索します。
Tool #1: target-quick-start-0510ed___WebSearch

Tool #2: target-quick-start-0510ed___WebSearch
検索結果をもとに、Amazon Bedrock AgentCore の最新情報をまとめます。

---

## 🚀 Amazon Bedrock AgentCore 最新情報まとめ

### 📌 概要
Amazon Bedrock AgentCore は、**あらゆるフレームワーク・モデル・プロトコルを使って、AIエージェントを安全かつ大規模に構築・デプロイ・運用できるエンタープライズ向けプラットフォーム**です。インフラ管理不要で利用できます。

---

### 📅 主なリリース履歴

| 時期 | 内容 |
|------|------|
| 2025年7月 | **プレビュー開始**(4リージョン) |
| 2025年10月 | **一般提供(GA)開始**(9リージョン)。VPC・PrivateLink・CloudFormation・リソースタグ対応 |
| 2025年11月 | **ダイレクトコードデプロイ**追加(ZIPファイルでPythonエージェントをデプロイ可能) |
| 2025年12月 | **Policy(プレビュー)・Evaluations(プレビュー)** 追加。エピソード記憶機能の強化 |
| 2026年2月 | **AgentCore Gateway × Responses API 連携**(サーバーサイドツール実行)GA |
| 2026年4月 | **マネージドハーネス(プレビュー)・AgentCore CLI・コーディングアシスタント向けスキル** 追加 |
| 2026年4月〜5月 | **エージェントパフォーマンス最適化機能(プレビュー)**:バッチ評価・A/Bテスト・レコメンデーション |
| 2026年8月 | **AgentCore Payments(プレビュー)**:AIエージェントが自律的にAPI・MCPサーバー等の支払いを実行(Coinbase・Stripe連携) |

---

### 🛠️ 主なサービスコンポーネント

- **AgentCore Runtime** — セッション分離・低レイテンシー・最大8時間の長時間実行
- **AgentCore Memory** — 短期・長期メモリをインフラ管理なしで提供
- **AgentCore Gateway** — 既存APIをMCP互換ツールに変換。サーバーサイドツール実行にも対応
- **AgentCore Browser Tool** — クラウドベースのセキュアなブラウザ操作
- **AgentCore Code Interpreter** — 複数言語対応のサンドボックスコード実行
- **AgentCore Observability** — CloudWatch連携・OpenTelemetry対応のリアルタイム監視
- **AgentCore Identity** — Amazon Cognito・Microsoft Entra ID・Okta等との統合
- **AgentCore Policy** — 自然言語でエージェントの行動境界を定義・強制
- **AgentCore Evaluations** — エージェントのパフォーマンス評価・A/Bテスト
- **AgentCore Payments** ⭐新機能 — エージェントによる自律的な支払い処理(プレビュー)

---

### 🌏 対応リージョン(GA時点)
米国東部(バージニア北部・オハイオ)、米国西部(オレゴン)、アジアパシフィック(東京・シンガポール・シドニー・ムンバイ)、欧州(フランクフルト・アイルランド)の **9リージョン**(その後14リージョンに拡大)

---

### 💡 対応フレームワーク
LangGraph、LlamaIndex、CrewAI、Strands Agents など主要なオープンソースフレームワークに対応。

---

## 参考情報

| タイトル | URL | 公開日 |
|---|---|---|
| Amazon Bedrock AgentCore の一般提供を開始 | https://aws.amazon.com/jp/about-aws/whats-new/2025/10/amazon-bedrock-agentcore-available/ | 2025年10月13日 |
| Amazon Bedrock AgentCore now available in preview | https://aws.amazon.com/about-aws/whats-new/2025/07/amazon-bedrock-agentcore-preview/ | 2025年7月16日 |
| AgentCore now includes Policy & Evaluations (preview) | https://aws.amazon.com/about-aws/whats-new/2025/12/amazon-bedrock-agentcore-policy-evaluations-preview/ | 2025年12月2日 |
| AgentCore adds new features to build agents faster | https://aws.amazon.com/about-aws/whats-new/2026/04/agentcore-new-features-to-build-agents-faster/ | 2026年4月22日 |
| AgentCore Release Notes | https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/release-notes.html | 随時更新 |
| Server-side tool execution with AgentCore Gateway | https://aws.amazon.com/about-aws/whats-new/2026/02/amazon-bedrock-server-side-tool-execution-agentcore-gateway/ | 2026年2月24日 |
| AgentCore エージェントパフォーマンス最適化機能(プレビュー) | https://aws.amazon.com/jp/about-aws/whats-new/2026/05/bedrock-agentcore-optimization-preview/ | 2026年4月30日 |

まとめ・所感

よかった点

  • 外部検索APIの契約やAPIキー管理なしで試せる
  • tools/listWebSearchを検出し、tools/callで検索を実行できた
  • 検索処理をAgent側に直接実装せず、GatewayのMCPツールとして利用できた

今回の検証では、東京リージョンのGatewayからWebSearchを検出し、ツール呼び出しが実行されるところまで確認できました。

Gateway側にツールを追加する構成なので、Agent側は取得したMCPツールを渡すだけで、検索処理そのものを持たずに済みます。

注意点

  • GatewayのサービスロールにWeb Search Tool利用権限が必要
  • 検索結果をエンドユーザー向けの回答に利用する場合は、提供された引用元とリンクを保持して表示する必要がある
  • 2026年8月17日時点で、Web Searchは1,000クエリあたり7ドルです。加えてGateway APIや推論モデルの利用料もかかるため、呼び出し回数に注意が必要です

こんな方におすすめ

  • AIエージェントにWeb検索機能を実装したい方
  • 外部の検索APIやAPIキーを自前で管理せずにWeb検索を組み込みたい方
  • MCP対応のエージェントから、検索を標準的なツールとして呼び出したい方

今回の検証では、Gatewayをコンソールで作成してから、Pythonのプログラムで東京リージョンのWebSearchを呼び出せました。

AgentCore Web Searchが気になった方は、よかったら使ってみてください。

参考リンク

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?