Skip to content

feat: add Tavily as optional parallel search engine alongside DuckDuckGo#15

Open
lakshyaag-tavily wants to merge 2 commits intodamionrashford:mainfrom
lakshyaag-tavily:tavily-migration/tavily-web-search-engine
Open

feat: add Tavily as optional parallel search engine alongside DuckDuckGo#15
lakshyaag-tavily wants to merge 2 commits intodamionrashford:mainfrom
lakshyaag-tavily:tavily-migration/tavily-web-search-engine

Conversation

@lakshyaag-tavily
Copy link
Copy Markdown

Summary

  • Added Tavily as a configurable, optional search engine that runs in parallel with DuckDuckGo and Wikipedia
  • When TAVILY_API_KEY is set, Tavily results are automatically merged and deduplicated with existing engines
  • When the key is absent, behavior is unchanged — fully backward compatible

Files changed

  • src/core/search/engines/tavily/__init__.py (new) — Package init exporting TavilySearchEngine
  • src/core/search/engines/tavily/tavily_engine.py (new) — TavilySearchEngine implementing BaseSearchEngine.search() using AsyncTavilyClient, mapping Tavily results to MultiSearchResult
  • src/tools/multi_search.py — Conditionally adds TavilySearchEngine to MultiSearchOrchestrator.engines when TAVILY_API_KEY env var is present
  • src/tools/search.py — Updated tool description, tags, and meta to document Tavily as an optional engine
  • pyproject.toml — Added tavily-python>=0.3.0 to project dependencies

Dependency changes

  • Added tavily-python>=0.3.0 to pyproject.toml [project].dependencies

Environment variable changes

  • TAVILY_API_KEY (optional) — enables Tavily engine when set; server works without it

Notes for reviewers

  • Existing deduplication-by-URL logic in search_all_engines() handles merging Tavily results without further changes
  • The Tavily import is deferred (inside __init__) so it only triggers when the API key is present
  • Uses search_depth="advanced" when extract_content=True for higher relevance results

🤖 Generated with Claude Code

Automated Review

  • Passed after 2 attempt(s)
  • Final review: The Tavily migration is well-implemented and correctly addresses all 5 issues from the previous review. The engine follows the existing BaseSearchEngine contract, uses AsyncTavilyClient correctly, maps Tavily response fields accurately to MultiSearchResult, and cleanly integrates as an optional parallel engine gated on TAVILY_API_KEY. The close() fix properly delegates to super().close() which calls session.aclose(). Both pyproject.toml and requirements.txt are updated, and 7 unit tests cover the key scenarios. Only minor issues remain (unused imports in test file, TAVILY_API_KEY missing from CLAUDE.md's env-var documentation section, and Linux-specific transitive deps in requirements.txt from platform-specific regeneration), none of which block approval.

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