feat(web-search): add Tavily provider - #237
Open
savvadesogle wants to merge 1 commit into
Open
Conversation
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
Adds Tavily as a first-class
os.web.searchprovider alongside the existingduckduckgo,searxng,exaandbraveproviders.Motivation
os.web.searchwas unreliable on proxied / cloud-egress setups:EXA_API_KEYis unset, Exa falls back to its keyless MCP tier (https://mcp.exa.ai/mcp), which returns 502 / 403 / 429 under load. The project already tracks this degradation mode in Keyless Exa search returns HTTP 429 continuously and degrades to a weaker provider silently #179 (a GAIA campaign logged 1341Exa returned HTTP 429failures).html.duckduckgo.com) intermittently serves an anti-bot challenge (HTTP 202 +challenge-form/anomaly-modal). This happens consistently from datacenter / VPN / proxy egress IPs, so the fallback is not a reliable backstop in proxied environments (verified 5/5 attempts, both direct and through a proxy).results[].Changes
src/tools/os/web-search/providers/tavily-provider.tscreateTavilyProvider()POSTs tohttps://api.tavily.com/searchwith{ api_key, query, max_results }, throws on HTTP >= 400, and maps theresults[]payload (title,url,content,publishedDate) toWebSearchResult[].parseTavilyJsonis exported for tests.src/tools/os/web-search/web-search-provider.ts"tavily"to theWebSearchProviderNameunion.src/tools/os/web-search/providers/provider-registry.tscreateTavilyProviderunder the"tavily"case inresolveProviderByName.src/tools/os/web-search/providers/search-orchestrator.tsisProviderUsable("tavily")requiresTAVILY_API_KEYto be present in the environment (mirrors thebravegate), so a keyless Tavily is skipped rather than failing every search.src/config/config-schema.tsweb.search.tavily.apiKeyEnvtoWebSearchConfig, its default"TAVILY_API_KEY"inUSER_CONFIG_DEFAULTS, parsing of the provider name union, and thewebSearchTavilyextraction inparseUserConfigFile.src/tools/os/web-search/tool/warn-missing-search-key.tsKEYED_PROVIDERSand resolve itsapiKeyEnv), so a missing key produces the same one-line startup warning as Exa/Brave.Usage
# <stateDir>/.env TAVILY_API_KEY=tvly-...Verification
npm run lint— clean.npm test— full suite: 20 failed / 5939 passed. This is identical to the pre-existing baseline onmain(all 20 failures are environment-specific Windows tests:clear-stale-chrome-locks,fs-approval-scope,open-terminal-window,send-message-concurrency,logo-art.generated,bootstrap,stream-cli-completion,skill-script-runner,skill-tools). No new failures are introduced.os.web.searchreturns Tavily results through a proxy.Notes
searchHttp, which shells out tocurl.curlreadsHTTP_PROXY/HTTPS_PROXY/NO_PROXYfrom the environment itself, so Tavily works behind a proxy without any extra wiring.brave/searxngproviders, so the orchestrator, cache, retry policy, and error surface behave the same.