Skip to content

feat: migrate search handler to support Tavily alongside Serper#146

Open
tavily-integrations wants to merge 2 commits intoMiroMindAI:mainfrom
tavily-integrations:feat/tavily-migration/miroflow-serper-tavily-parallel
Open

feat: migrate search handler to support Tavily alongside Serper#146
tavily-integrations wants to merge 2 commits intoMiroMindAI:mainfrom
tavily-integrations:feat/tavily-migration/miroflow-serper-tavily-parallel

Conversation

@tavily-integrations
Copy link
Copy Markdown

Summary

  • Added Tavily as a configurable alternative search provider alongside the existing Serper (Google Search) integration
  • Both providers remain active; callers choose via Hydra agent YAML config
  • Tavily results are normalized to match the existing Serper organic result structure (title, link, snippet)

Files changed

New files

  • libs/miroflow-tools/src/miroflow_tools/mcp_servers/tavily_mcp_server.py — FastMCP server exposing tavily_search tool via the tavily-python SDK, mirrors serper_mcp_server.py interface
  • libs/miroflow-tools/src/miroflow_tools/mcp_servers/searching_tavily_mcp_server.py — Orchestrator wrapper with retry logic, mirrors searching_google_mcp_server.py
  • apps/miroflow-agent/conf/agent/tavily_search.yaml — Agent config variant using tool-tavily-search instead of tool-google-search in the browsing sub-agent

Modified files

  • libs/miroflow-tools/pyproject.toml — Added tavily-python dependency
  • apps/miroflow-agent/src/config/settings.py — Added TAVILY_API_KEY env var, tool-tavily-search MCP server config block, and has_tavily_api_key to env info
  • apps/miroflow-agent/.env.example — Added TAVILY_API_KEY entry
  • apps/gradio-demo/.env.example — Added TAVILY_API_KEY entry

Dependency changes

  • Added tavily-python to libs/miroflow-tools/pyproject.toml

Environment variable changes

  • Added TAVILY_API_KEY to apps/miroflow-agent/.env.example and apps/gradio-demo/.env.example

Notes for reviewers

  • Existing Serper files are completely untouched
  • The Tavily MCP server normalizes results to match Serper's organic result format (title/link/snippet) for downstream compatibility
  • HuggingFace dataset/space URL filtering is preserved in the Tavily server
  • To use Tavily, set TAVILY_API_KEY and select the tavily_search agent config via Hydra (e.g., agent=tavily_search)

🤖 Generated with Claude Code

Automated Review

  • Passed after 2 attempt(s)
  • Final review: The Tavily parallel search migration is well-implemented and correct. All four previously-flagged issues have been addressed: scrape_website is properly ported to searching_tavily_mcp_server.py using JINA (feature parity with Google variant), JINA env vars are now actually consumed, the double-retry logic has been eliminated from tavily_mcp_server.py, and tenacity/tavily-python are now explicit dependencies in pyproject.toml. The additive strategy is intact — multi_agent.yaml still uses tool-google-search, while the new tavily_search.yaml provides a Tavily-only alternative. SDK patterns, imports, env var propagation, and MCP server architecture all mirror the existing Serper implementation consistently. One unused import (json) in searching_tavily_mcp_server.py is the only finding.

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