feat(tools): add AgentCore Web Search as a Strands Agents tool - #673
Open
sundargthb wants to merge 4 commits into
Open
sundargthb wants to merge 4 commits into
sundargthb wants to merge 4 commits into
Conversation
Exposes the web search tool as a single Strands tool, alongside the existing memory, payments and gateway Strands integrations, behind the same strands-agents extra. Attributed with integration_source="strands". Which transport is used stays inside WebSearchClient. Every gateway argument here is optional and only the ones supplied are forwarded, so the direct web search API will work through the same call without a signature change. Two behaviours the tests pin down: - region is defaulted only when no region and no gateway ARN were given. The client prefers an explicit region over the ARN's, so defaulting it unconditionally sends a eu-west-1 gateway's traffic to us-east-1. - a failed search raises rather than returning the message as a result. The Strands executor turns that into a status=error tool result, which a model can react to; a successful result reading "search failed" is indistinguishable to it from a search that found nothing. Unit tests cover the module to 100% branch coverage. The integration tests need a gateway with a web search target and have not been run.
Contributor
✅ No Breaking Changes DetectedNo public API breaking changes found in this PR. |
sundargthb
had a problem deploying
to
auto-approve
September 22, 2026 01:03 — with
GitHub Actions
Failure
Contributor
|
Claude Security Review: no high-confidence findings. (run) |
The AgentCoreWebSearch box's content lines were one column wider than its border, which skewed every box to its right. All five lines are now the same width with the edges in the same columns.
sundargthb
had a problem deploying
to
auto-approve
September 22, 2026 01:38 — with
GitHub Actions
Failure
Contributor
|
Claude Security Review: no high-confidence findings. (run) |
Both failed on their first live run against a gateway, and both were the test's fault rather than the tool's. max_results is honoured exactly, 1 gives 1 and 2 gives 2, but asserting "3. " is absent searches the result extracts too, and web prose contains a digit followed by a period often enough that this was never going to hold. Count the lines that open a numbered block instead. Mcp-Session-Id is optional in MCP and this connector does not send one, so the backend's session id stays None however many searches run through it. Assert what the test is named for by checking the backend and its connection pool are the same objects across two searches.
sundargthb
had a problem deploying
to
auto-approve
September 22, 2026 02:03 — with
GitHub Actions
Failure
Contributor
|
Claude Security Review: no high-confidence findings. (run) |
sundargthb
marked this pull request as ready for review
September 22, 2026 02:06
This branch was successfully 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.
Description
Adds
AgentCoreWebSearch, exposing the AgentCore Web Search tool as a Strands Agents tool. Placement followsmemory/integrations/strands,payments/integrations/strandsandgateway/integrations/strands: a subpackage behind the existingstrands-agentsextra, reached only by explicit import. Nopyproject.tomlchange, and a base install is unaffected.Notes
regionis defaulted only when no region and no gateway ARN were given.WebSearchClientdoesregion = region or arn_region, so filling a default in here unconditionally would silently send aeu-west-1gateway's traffic tous-east-1.A failed search raises rather than returning the message as a result. The Strands executor converts the exception to a
status: "error"tool result, so the agent keeps running and the model can react. Returning"Web search failed: ..."as a successful result is indistinguishable to the model from a search that found nothing.Both are pinned down by tests that drive a real
Agent, with a scripted model standing in for the model'schoice and
WebSearchClientstubbed, so the agent, the tool registry, the spec generation and the toolexecutor are the real ones. I checked those tests bite by mutating the source: dropping
include_domainsfrom the forwarded arguments, and returning the failure as text instead of raising, each turned two tests
red and nothing else.
One forward-compatibility note: which transport is used stays inside
WebSearchClient. Every gateway argument here is optional and only the ones supplied are forwarded, so the direct web search API will work through the same call without a signature change in this module.Testing
Also run against a live gateway, on an account entitled to the web search connector, with a web search connector target in
us-east-1:That covers cited results coming back,
max_resultsbeing honoured, aninclude_domainsfilter, tool-name discovery throughtools/listwhen notarget_nameis given, one backend and one connection pool being reused across searches, and the end to end path where a real Claude model on Bedrock decides to call the tool and a URL reaches the tool result in the agent's messages.Two assertions in that file were wrong on their first live run and are fixed in this branch, both the test's fault rather than the tool's.
max_resultsis honoured exactly, but asserting"3. "is absent searches the result extracts too, and web prose contains a digit followed by a period often enough that it was never going to hold, so the numbered blocks are counted instead. AndMcp-Session-Idis optional in MCP and this connector does not send one, so the backend's session id staysNonehowever many searches run through it; the reuse test asserts the backend and its connection pool are the same objects instead.Related
WebSearchClientthis wraps, and itstests_integ/tools/test_web_search_client.py