Skip to content

feat: add Tavily search engine alongside DuckDuckGo and SearXNG - #1

Open
tavily-integrations wants to merge 1 commit into
koda-claw:mainfrom
Tavily-FDE:feat/tavily-migration/web-tools-tavily-engine
Open

feat: add Tavily search engine alongside DuckDuckGo and SearXNG#1
tavily-integrations wants to merge 1 commit into
koda-claw:mainfrom
Tavily-FDE:feat/tavily-migration/web-tools-tavily-engine

Conversation

@tavily-integrations

Copy link
Copy Markdown

Summary

  • Added Tavily as a third search engine option (additive, parallel to existing providers)
  • When TAVILY_API_KEY is set, Tavily is tried first in auto-mode before SearXNG and DuckDuckGo
  • Existing DuckDuckGo Lite and SearXNG paths are completely unchanged
  • No new Go module dependencies — uses standard net/http + encoding/json

Files changed

  • internal/search/tavily.go (new) — TavilyEngine implementing the Engine interface via Tavily REST API
  • internal/config/config.go — Added TavilyAPIKey field to SearchConfig
  • internal/config/loader.go — Added TAVILY_API_KEY env var override and TavilyAPIKey merge support
  • internal/search/search.go — Register Tavily engine at position 0 when key is present; updated engine comments and error message
  • cmd/web-search/main.go — Updated --engine flag usage to include tavily; switched to config.Load() for env var support

Environment variable changes

  • Added TAVILY_API_KEY — when set, enables the Tavily search engine

Dependency changes

  • None — Tavily REST API is called via standard library net/http

Notes for reviewers

  • Tavily is inserted at position 0 in the auto-mode engine slice so it is tried first as a higher-quality paid option
  • If TAVILY_API_KEY is not set, behavior is identical to before (SearXNG → DuckDuckGo)
  • HealthCheck() validates the API key is non-empty; actual API reachability is checked at query time
  • The run() function in cmd/web-search/main.go was changed from config.DefaultConfig() to config.Load() so that environment variables are actually applied

🤖 Generated with Claude Code

Automated Review

  • Passed after 1 attempt(s)
  • Final review: The Tavily migration is correct and well-implemented. The new TavilyEngine properly implements the Engine interface, uses the correct Tavily REST API (POST to https://api.tavily.com/search with Bearer auth), follows existing patterns from searxng.go, and integrates cleanly into the config/loader/search wiring. All five files listed in the plan were modified appropriately. No regressions to existing engines — SearXNG and DDG remain functional with the same relative priority. Two minor issues noted but neither blocks 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