Skip to content

feat: migrate google_news action to support Tavily as parallel source - #2

Open
manisrinivasan2k1 wants to merge 2 commits into
alexvilelabah:mainfrom
Tavily-FDE:feat/tavily-migration/google-news-action
Open

feat: migrate google_news action to support Tavily as parallel source#2
manisrinivasan2k1 wants to merge 2 commits into
alexvilelabah:mainfrom
Tavily-FDE:feat/tavily-migration/google-news-action

Conversation

@manisrinivasan2k1

Copy link
Copy Markdown

Summary

Adds Tavily as a configurable parallel news search source for the google_news action, running alongside the existing Google News DOM scrape. When TAVILY_API_KEY is set, structured news results from Tavily are fetched in parallel and merged with Google scrape results for richer coverage. The existing Google News path remains fully intact as the fallback.

Changes

New IPC handler (src/main/main.ts)

  • Added tavily:search IPC handler that calls the Tavily search API with topic: 'news' using TAVILY_API_KEY from environment variables
  • Returns structured results (title, url, content, score, publishedDate)

Preload bridge (src/preload/preload.ts)

  • Exposed tavilySearch() method to the renderer via contextBridge

Renderer (src/renderer/App.tsx)

  • Added tavilySearch type to the electronAPI interface
  • Updated google_news handler to fire Tavily search in parallel with Google scrape
  • Merges deduplicated results: Google results first, then unique Tavily results
  • Falls back to Google-only when Tavily is unconfigured or fails
  • Source label in the panel indicates the actual source(s) used

AI prompt (src/main/ai-engine.ts)

  • Updated google_news action description to mention Tavily as an optional parallel source

Files changed

  • package.json
  • src/main/main.ts
  • src/preload/preload.ts
  • src/renderer/App.tsx
  • src/main/ai-engine.ts

Dependency changes

  • Added @tavily/core ^0.0.7 to dependencies

Environment variable changes

  • Added TAVILY_API_KEY — read by the tavily:search IPC handler in main.ts. Optional; when not set, the existing Google News scrape path is used exclusively.

Notes for reviewers

  • This is an additive change: the existing Google News scrape is fully preserved and always runs
  • Tavily results are only used when TAVILY_API_KEY is present and the API call succeeds
  • Deduplication is by URL to avoid showing the same article from both sources
  • The @tavily/core package is lazy-loaded via require() inside the handler to avoid startup cost when unused

Automated Review

  • Passed after 2 attempt(s)
  • Final review: The google-news-action Tavily migration is correct and complete. All 5 previously-flagged issues have been properly addressed: top-level import replaces dynamic require, package-lock.json is regenerated and includes @tavily/core@0.7.6 with a matching npm registry integrity hash, URL parsing is guarded with try-catch, the version is updated to ^0.7.6, and env documentation (.env.example, README.md, .gitignore exception) is in place. The additive strategy is well-implemented — Tavily runs in parallel with the existing Google News scrape and results are merged with deduplication, with graceful fallback when the key is absent. No regressions identified.

@alexvilelabah

Copy link
Copy Markdown
Owner

Thanks for the PRs, and for the detail in the write-ups.

I'm going to pass on these, and I want to be straight about why. Bah's main constraint is that it has to work for someone who just downloads the installer and opens it — no signup, no API key. These PRs read TAVILY_API_KEY from an environment variable, which none of my users will ever set, so in practice the Tavily path would never run for them: it would fall back to Google every time, while still adding a dependency and extra code to the agent's hot path.

As they stand, the three PRs also each register the same tavily:search IPC handler, so they can't all be merged as-is.

If Tavily ever has a keyless tier that works with no signup, I'd genuinely be interested — that's the bar for anything that ships in the default experience here.

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.

2 participants