feat: migrate web search tool to support Tavily alongside DuckDuckGo#19
Open
tavily-integrations wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Tavily as a configurable primary web search provider alongside the existing DuckDuckGo integration in
WebSearchTool. WhenTAVILY_API_KEYis set, Tavily is used as the primary search path; DDGS serves as the automatic fallback when the key is absent or on Tavily error. This is an additive/non-breaking change.Files Changed
tools/mcp/engine.py— Refactoredexecute_impl()into_tavily_search()and_ddgs_search()methods. Tavily is tried first when API key is configured; DDGS is the fallback.core/config.py— Addedtavily_api_key: str = ''field toSettingsclass.pyproject.toml— Addedtavily-python>=0.5.0to project dependencies..env.example— DocumentedTAVILY_API_KEYunder LLM Provider API Keys section.Dependency Changes
tavily-python>=0.5.0to[project].dependenciesinpyproject.tomlEnvironment Variable Changes
TAVILY_API_KEY(optional) — when set, enables Tavily as primary web search providerNotes for Reviewers
TAVILY_API_KEYis provided.content,url) differ from DDGS (body,href); both are handled in their respective methods.execute()wrapper applies to both paths.Automated Review
tavily-pythonSDK patterns (TavilyClient.search()), wraps the synchronous client inasyncio.to_thread, maps the correct Tavily response fields (title,content,url), and keeps the DDGS path intact. All four reported files are updated consistently: dependency added topyproject.toml, config field added tocore/config.py, env var documented in.env.example, and logic added totools/mcp/engine.py. Two minor issues noted below but neither blocks approval.