Skip to content

feat: add Tavily as configurable web search provider#1302

Open
tavily-integrations wants to merge 1 commit intokhoj-ai:masterfrom
Tavily-FDE:feat/tavily-migration/tavily-web-search
Open

feat: add Tavily as configurable web search provider#1302
tavily-integrations wants to merge 1 commit intokhoj-ai:masterfrom
Tavily-FDE:feat/tavily-migration/tavily-web-search

Conversation

@tavily-integrations
Copy link
Copy Markdown

Summary

  • Added Tavily as a new web search engine option in the online search module
  • Tavily is used when TAVILY_API_KEY environment variable is set
  • Existing search providers (Serper, Exa, Firecrawl, Google, SearXNG) are unchanged
  • Tavily participates in the existing fallback chain automatically

Files changed

  • src/khoj/processor/tools/online_search.py — Added TAVILY_API_KEY env var, search_with_tavily() async function using tavily-python SDK, and registered Tavily in the search engine dispatcher
  • pyproject.toml — Added tavily-python >= 0.5.0 to project dependencies

Dependency changes

  • Added tavily-python >= 0.5.0 to pyproject.toml

Environment variable changes

  • Added TAVILY_API_KEY — set this to enable Tavily as a search provider

Notes for reviewers

  • The search_with_tavily() function normalizes results to the same {organic: [{title, link, snippet, content}]} format used by all other providers
  • Uses AsyncTavilyClient for async compatibility with the existing asyncio.gather pattern
  • The import is done inside the function to avoid import errors when tavily-python is not installed or TAVILY_API_KEY is not set

🤖 Generated with Claude Code

Automated Review

  • Passed after 1 attempt(s)
  • Final review: The Tavily web search integration is well-implemented and additive. It correctly uses AsyncTavilyClient, maps result fields to the expected {"organic": [...]} format, registers in the dispatcher only when the API key is present, and adds the dependency to pyproject.toml. No regressions to existing providers. Three minor issues noted 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