Get started with AgentCore Web Search
To search the web with AgentCore Web Search, grant a principal permission to call the InvokeWebSearch API, and then call it with the AWS SDKs or the AWS Command Line Interface (AWS CLI).
Prerequisites
Before you call the API, make sure that you have the following:
-
An AWS account and credentials that the AWS SDKs or the AWS CLI can use.
-
An AWS Region where the API is available. For the list, see Regions.
-
A current version of the AWS SDK for Python (Boto3) or the AWS CLI. Earlier versions don’t include the
InvokeWebSearchoperation. -
Permission to call the API, as described in the following section.
Grant permission to call the API
To call the API, an AWS Identity and Access Management (IAM) principal needs the bedrock-agentcore:InvokeWebSearch permission on the AWS managed web search tool. The tool’s Amazon Resource Name (ARN) has the following form:
arn:aws:bedrock-agentcore:<Region>:aws:tool/web-search.v1
The account field of the ARN is the literal value aws, because AWS owns the tool. It is not your account ID.
The following identity-based policy allows a principal to call the API in one Region. Replace <Region> with the code of a Region from Regions. To allow calls in every Region, use * in place of the Region code.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowInvokeWebSearch", "Effect": "Allow", "Action": "bedrock-agentcore:InvokeWebSearch", "Resource": "arn:aws:bedrock-agentcore:<Region>:aws:tool/web-search.v1" } ] }
Search the web
Only webSearchId and searchQuery are required. The identifier of the AWS managed web search tool is web-search.v1. For an example of the response, see Response.
The following AWS SDK for Python (Boto3) and AWS CLI examples search for recent pages about a topic. They return up to five results, limit the results to two domains, and keep only pages published in January 2026:
Example
For the request fields and their limits, see Request and response. For the full request and response syntax, see InvokeWebSearch in the Amazon Bedrock AgentCore API Reference.