Repository navigation
feat(tools): call the Web Search API (InvokeWebSearch) from WebSearchClient - #738
Open
sundargthb wants to merge 5 commits into
Open
sundargthb wants to merge 5 commits into
sundargthb wants to merge 5 commits into
Conversation
…Client WebSearchClient defaults to the new WebSearchApiBackend when no gateway argument is given. Adds fixed client-level filters that calls can narrow but not widen, parsed published_at/acquired_at datetimes, and reads the search field name (searchQuery) from the installed botocore model.
Contributor
✅ No Breaking Changes DetectedNo public API breaking changes found in this PR. |
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 20:52 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 20:52 — with
GitHub Actions
Inactive
sundargthb
had a problem deploying
to
auto-approve
November 9, 2026 20:52 — with
GitHub Actions
Failure
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 20:52 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 20:52 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 20:52 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 20:52 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 20:52 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 20:52 — with
GitHub Actions
Inactive
Contributor
|
Claude Security Review: no high-confidence findings. (run) |
sundargthb
marked this pull request as ready for review
November 9, 2026 21:17
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:17 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:17 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:17 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:17 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:17 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:17 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:17 — with
GitHub Actions
Inactive
sundargthb
had a problem deploying
to
auto-approve
November 9, 2026 21:17 — with
GitHub Actions
Failure
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:41 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:41 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:41 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:41 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:41 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:41 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:41 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:41 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 21:41 — with
GitHub Actions
Inactive
Contributor
|
Claude Security Review: no high-confidence findings. (run) |
The published docs and a live check show both InvokeWebSearch date bounds are inclusive, so a date-only upper bound becomes 23:59:59.999999Z on that day rather than the next midnight. Date-only upper bounds also compare at the end of the day when narrowing. Document the API's default of 25 results.
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 23:25 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 23:25 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 23:25 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 23:25 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 23:25 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 23:25 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 23:25 — with
GitHub Actions
Inactive
sundargthb
temporarily deployed
to
auto-approve
November 9, 2026 23:25 — with
GitHub Actions
Inactive
Contributor
|
Claude Security Review: no high-confidence findings. (run) |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WebSearchClientcan now call the new Web Search API (InvokeWebSearchon the bedrock-agentcore data plane) directly. With no gateway argument, the client uses the API; withgateway_id,gateway_arn, orgateway_endpoint, it behaves exactly as before.Changes
WebSearchApiBackend(new, exported): callsinvoke_web_searchthrough boto3. It builds the data plane client the same wayBrowserClientandCodeInterpreterdo (BEDROCK_AGENTCORE_DP_ENDPOINToverride,validate_region, SDK User-Agent). It holds no lock, since boto3 clients are thread-safe, so one client can serve concurrent searches.WebSearchClient(region=...)with no gateway argument now uses the API. Previously this raisedValueError, so no existing call changes behavior. A newweb_search_idargument defaults toweb-search.v1.include_domains,exclude_domains,published_after, andpublished_beforeset on the constructor apply to every search. A call tosearch()can narrow them but not widen them: excludes are combined (the 100-domain limit counts both), a call's include is kept only if it equals or is a subdomain of a client include, compared case-insensitively (no match returns an empty response without a call, after the call's arguments are validated), and a date bound applies only when it is stricter. Client-level date bounds are validated in the constructor. This lets applications keep rules out of a model's control.WebSearchResultgainspublished_atandacquired_at, timezone-aware UTC datetimes parsed from either the API's ISO 8601 timestamps or the gateway connector's"05:00PM, Wednesday, October 28 2026, PDT"form.published_datekeeps the raw value.ClientError(for exampleThrottlingException,AccessDeniedException) is raised as is, matchingBrowserClientandCodeInterpreter.timeoutsets the boto3 client's connect and read timeouts.published_beforecovers that whole day on the API, as on the gateway; fractional seconds are kept; the gateway's date form is parsed without the process locale.KNOWN_API_REGIONS(warning only, likeKNOWN_REGIONS).Testing
tests/bedrock_agentcore/toolspasses (378 passed). New tests cover the backend's request translation, UTC conversion,ClientErrorpass-through, timeouts, date-only and fractional bounds, fixed-filter narrowing (subdomains, case, combined limit, validation order), and locale-independent date parsing for both transports.tests_integ/tools/test_web_search_api_client.py, which skips when botocore has noinvoke_web_search.tests_integ/tools/test_web_search_api_client.pypasses (6 passed) against the API in us-east-1 with public botocore 1.43.127. Also verified earlier with a preview botocore build, including the LangChain toolkit on top of this client and a Deep Agents subagent.Dependencies
boto3/botocorefloor raised to 1.43.127, the first public release withInvokeWebSearch(uv.lockupdated; only boto3, botocore, and awscrt moved).This change was developed with the help of an AI coding assistant (Claude Code). All code was reviewed and tested by the author.