Skip to content

feat: add Tavily as configurable search provider in search_web.py#1

Open
tavily-integrations wants to merge 1 commit into
PolarSeeker:mainfrom
Tavily-FDE:feat/tavily-migration/serper-to-tavily-search
Open

feat: add Tavily as configurable search provider in search_web.py#1
tavily-integrations wants to merge 1 commit into
PolarSeeker:mainfrom
Tavily-FDE:feat/tavily-migration/serper-to-tavily-search

Conversation

@tavily-integrations

Copy link
Copy Markdown

Summary

Adds Tavily Search as a configurable alternative to Serper in the web search tool, controlled by the SEARCH_PROVIDER environment variable.

  • Default behavior unchanged: SEARCH_PROVIDER=serper (the default) routes all queries through the existing Serper path
  • Tavily option: Setting SEARCH_PROVIDER=tavily routes queries through the new tavily_search() function using tavily-python SDK
  • Output format consistency: Tavily results are formatted in the same numbered markdown style as Serper results for downstream compatibility
  • Batched query support preserved: Both single-string and array-of-queries inputs work with either provider

Files Changed

  • tools/tool/search_web.py — Added TavilyClient import, SEARCH_PROVIDER env var, tavily_search() function, and _search_single() dispatcher
  • requirements.txt — Added tavily-python dependency
  • config/.env — Added TAVILY_API_KEY and SEARCH_PROVIDER=serper placeholders

Dependency Changes

  • Added tavily-python to requirements.txt

Environment Variable Changes

  • Added TAVILY_API_KEY — API key for Tavily search (required when SEARCH_PROVIDER=tavily)
  • Added SEARCH_PROVIDER — Controls which search backend to use (serper or tavily, defaults to serper)

Notes for Reviewers

  • All existing Serper logic is untouched; this is a purely additive change
  • The tavily_search function uses search_depth="basic" and max_results=10 to match the Serper behavior
  • Error handling in tavily_search mirrors the Serper error patterns

Automated Review

  • Passed after 1 attempt(s)
  • Final review: The migration correctly adds Tavily as a configurable search provider alongside Serper. The implementation is additive, defaults remain unchanged (serper), dependencies and env vars are documented, and the dispatcher pattern is clean. A few minor issues exist but none are blocking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant