BedrockAgentCore / Client / invoke_web_search
invoke_web_search¶
- BedrockAgentCore.Client.invoke_web_search(**kwargs)¶
Searches the web and returns a ranked list of results. Each result includes a text extract from the page.
You can filter the results by domain and by publication date.
To use this operation, you must have the
bedrock-agentcore:InvokeWebSearchpermission on the resourcearn:${Partition}:bedrock-agentcore:${Region}:aws:tool/web-search.v1.See also: AWS API Documentation
Request Syntax
response = client.invoke_web_search( webSearchId='string', searchQuery='string', maxResults=123, filters={ 'domainFilter': { 'include': [ 'string', ], 'exclude': [ 'string', ] }, 'publishedDateFilter': { 'publishedAfter': datetime(2015, 1, 1), 'publishedBefore': datetime(2015, 1, 1) } } )
- Parameters:
webSearchId (string) –
[REQUIRED]
The identifier of the web search tool to invoke. The Amazon Web Services-managed web search tool is
web-search.v1.searchQuery (string) –
[REQUIRED]
The text to search for.
maxResults (integer) – The maximum number of results to return. Defaults to 25.
filters (dict) –
The filters to apply to the search results.
domainFilter (dict) –
The domains to include in or exclude from the results.
include (list) –
The domains to return results from. Results from other domains are not returned.
(string) –
A domain name, for example
example.com.
exclude (list) –
The domains to never return results from.
(string) –
A domain name, for example
example.com.
publishedDateFilter (dict) –
The publication time range of the results.
publishedAfter (datetime) –
The earliest publication time of the results, inclusive.
publishedBefore (datetime) –
The latest publication time of the results, inclusive. A date without a time, such as one passed to the AWS CLI, means midnight UTC. To include a whole day, use the last second of that day, for example
2026-01-31T23:59:59Z.
- Return type:
dict
- Returns:
Response Syntax
{ 'results': [ { 'title': 'string', 'url': 'string', 'text': 'string', 'publishedAt': datetime(2015, 1, 1) }, ] }
Response Structure
(dict) –
Response for the
InvokeWebSearchoperation.results (list) –
The search results, in ranked order.
(dict) –
A web search result.
title (string) –
The title of the page.
url (string) –
The URL of the page.
text (string) –
A text extract from the page.
publishedAt (datetime) –
The time the page was published. This field is absent when the publication time is not known.
Exceptions