#6743: feat(web-search): add Tavily search provider support
agents
Cluster:
Web Search Provider Enhancements
## 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
#13370: Tools: rewrite Grok parser, add Tavily provider, multi-provider con...
by a-anand-91119 · 2026-02-10
79.6%
#8715: fix(web-search): safer provider resolution & Perplexity auto-detection
by abhijeet117 · 2026-02-04
79.3%
#13386: feat(web-search): add Nimble Web Search API provider
by ilchemla · 2026-02-10
79.0%
#7738: feat(web-search): add provider fallback and Serper support
by garnetlyx · 2026-02-03
79.0%
#13814: feat(web-search): add ZAI Search (zsearch) provider
by strelov1 · 2026-02-11
78.6%
#17632: feat(web-search): add per-call provider override
by cog-bernthiddema · 2026-02-16
77.9%
#19876: feat(web-search): add SerpAPI search provider support
by nksolar-tianjin · 2026-02-18
77.1%
#17729: fix(configure): update web tools hint to reflect all search providers
by raktim-mondol · 2026-02-16
77.1%
#12304: feat: add DeSearch as web_search provider
by tatjr13 · 2026-02-09
76.7%
#13366: Add baidu search as web tools provider
by ide-rea · 2026-02-10
76.6%