Skip to content

feat: migrate web search to support Tavily alongside SearXNG#1086

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

feat: migrate web search to support Tavily alongside SearXNG#1086
tavily-integrations wants to merge 1 commit intoItzCrazyKns:masterfrom
Tavily-FDE:feat/tavily-migration/vane-web-search-tavily

Conversation

@tavily-integrations
Copy link
Copy Markdown

@tavily-integrations tavily-integrations commented Mar 31, 2026

Summary

  • Added Tavily as an optional, configurable web search backend alongside the existing SearXNG provider
  • Users can switch between SearXNG and Tavily via the settings UI (searchProvider field) or SEARCH_PROVIDER env var
  • Only the core webSearch action is affected; academic, social, image, and discover searches remain on SearXNG

Files changed

  • package.json — Added @tavily/core dependency
  • src/lib/config/index.ts — Added searchProvider (select), tavilyAPIKey (password) config fields with env var bindings
  • src/lib/config/serverRegistry.ts — Exported getTavilyAPIKey() and getSearchProvider() helpers
  • src/lib/tavily.ts — New Tavily client wrapper that normalizes results to the same shape as SearXNG
  • src/lib/agents/search/researcher/actions/webSearch.ts — Dispatches to Tavily or SearXNG based on configured provider

Dependency changes

  • Added @tavily/core (^0.6.4) to package.json

Environment variable changes

  • TAVILY_API_KEY — Tavily API key (required only when search provider is set to tavily)
  • SEARCH_PROVIDER — Set to searxng (default) or tavily to select the web search backend

Notes for reviewers

  • SearXNG remains the default provider; no breaking changes for existing users
  • Tavily API key is stored as a password field in the config UI for security
  • The Tavily wrapper uses searchDepth: "basic" and maxResults: 10 to match SearXNG's default behavior

🤖 Generated with Claude Code

Automated Review

  • Passed after 1 attempt(s)
  • Final review: The Tavily migration is correctly implemented. The SDK usage follows the official @tavily/core API (import { tavily } from '@tavily/core', client.search()). The return shape from searchTavily ({ results: [{title, url, content}], suggestions: [] }) is structurally compatible with what webSearch.ts consumes. Config integration follows existing patterns exactly (select/password field types, env variable mapping, [key: string]: any typed search object requires no type changes). SearXNG remains the default provider so existing functionality is fully preserved. Only two minor issues noted, neither blocks approval.

Summary by cubic

Adds Tavily as a configurable web search backend alongside SearXNG. SearXNG stays the default and only the webSearch action is updated.

  • New Features

    • Switch provider via searchProvider in settings or SEARCH_PROVIDER.
    • Added tavilyAPIKey and helpers (getTavilyAPIKey, getSearchProvider); new tavily.ts normalizes results.
    • webSearch dispatches by provider; added @tavily/core.
  • Migration

    • No action needed if you keep SearXNG (default).
    • To use Tavily, set SEARCH_PROVIDER=tavily and provide TAVILY_API_KEY.

Written for commit e71962e. Summary will update on new commits.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 8 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/lib/config/index.ts">

<violation number="1" location="src/lib/config/index.ts:22">
P1: `SEARCH_PROVIDER` is effectively ignored because `searchProvider` is initialized with a truthy default, preventing env-based initialization.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread src/lib/config/index.ts
search: {
searxngURL: '',
tavilyAPIKey: '',
searchProvider: 'searxng',
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: SEARCH_PROVIDER is effectively ignored because searchProvider is initialized with a truthy default, preventing env-based initialization.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/lib/config/index.ts, line 22:

<comment>`SEARCH_PROVIDER` is effectively ignored because `searchProvider` is initialized with a truthy default, preventing env-based initialization.</comment>

<file context>
@@ -18,6 +18,8 @@ class ConfigManager {
     search: {
       searxngURL: '',
+      tavilyAPIKey: '',
+      searchProvider: 'searxng',
     },
   };
</file context>
Suggested change
searchProvider: 'searxng',
searchProvider: '',
Fix with Cubic

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