feat(agent): add web_search tool for web discovery#772
Open
Nagendhra-web wants to merge 1 commit into
Open
Conversation
The agent has web_fetch for retrieving known URLs but no way to discover information. This adds a web_search tool that enables the agent to search the web autonomously — research docs, debug errors, find best practices, and discover solutions. Features: - Dual-engine: Brave Search API (when key available) with automatic DuckDuckGo HTML fallback (no API key needed) - Domain filtering: allowedDomains/blockedDomains to scope results - Time-range filtering: day/week/month/year for recency control - Result deduplication with URL normalization - Structured output: title, url, snippet per result - 27 unit tests covering parsers, filters, and deduplication
|
Someone is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
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
web_searchtool to the agent, enabling autonomous web discovery alongside the existingweb_fetch(which retrieves known URLs)BRAVE_SEARCH_API_KEYis set) with automatic fallback to DuckDuckGo HTML (no API key needed — always works)allowedDomains/blockedDomains), time-range filtering (day/week/month/year), URL deduplication, and structured result outputMotivation
The agent currently has
web_fetchfor retrieving specific URLs but no way to discover information. Without search, the agent cannot:web_searchfills this gap — the agent can now search the web, then useweb_fetchto dive deeper into specific results.Changes
packages/agent/tools/web-search.tspackages/agent/tools/web-search.test.tspackages/agent/tools/index.tswebSearchToolpackages/agent/open-harness-agent.tsweb_searchin agent tool setpackages/agent/system-prompt.tsweb_searchusage in system promptFeatures
allowedDomainsto scope results,blockedDomainsto exclude sitesday/week/month/yearto each engine's native formatcurlinside the sandbox (same pattern asweb_fetch)Test plan