← Back to PRs

#6743: feat(web-search): add Tavily search provider support

by 3927o open 2026-02-02 01:03 View on GitHub →
agents
## Summary Add Tavily as a new web search provider option. ## Changes - Add tavily to supported search providers - Support TAVILY_API_KEY env var and config - Add searchDepth option (basic/advanced) - Fallback to tools.web.search.apiKey for consistency with Brave - Add guard for unsupported locale params ## Fixes from previous review - ✅ apiKey now falls back to tools.web.search.apiKey - ✅ country/search_lang/ui_lang return error for Tavily/Perplexity ## Configuration ```yaml tools: web: search: provider: tavily tavily: apiKey: tvly-xxxxx searchDepth: basic ``` <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> Adds Tavily as a third `web_search` provider alongside Brave and Perplexity. - Extends config/types + runtime Zod schema to accept `tools.web.search.provider: tavily` and a `tools.web.search.tavily` block with `apiKey` + `searchDepth`. - Implements Tavily execution path in `src/agents/tools/web-search.ts`, including API key resolution (tavily-specific config → `TAVILY_API_KEY` env → fallback to `tools.web.search.apiKey`), request/response mapping, and caching keyed by `searchDepth`. - Adds user-facing errors for missing Tavily key and rejects Brave-only locale params for Perplexity/Tavily (similar to the existing freshness guard). <h3>Confidence Score: 3/5</h3> - This PR is reasonably safe to merge, but Tavily’s request/auth shape should be verified to avoid a broken provider at runtime. - Changes are localized to the web-search tool and config schemas, and the provider selection + caching logic is straightforward. Main uncertainty is the Tavily API contract (auth/payload fields) and a couple of forward-compatibility/error-handling edges that could surface as runtime errors if configs drift. - src/agents/tools/web-search.ts (Tavily request/auth contract and provider/error handling) <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs