Copilot/add tavily source#255
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Tavily as a preferred web-search backend (when configured) with ddgs as a fallback, and exposes Tavily API key configuration via the Web UI + settings API.
Changes:
- Implement Tavily-first search path in
WebSearchTool, with fallback to ddgs on failure. - Add Tavily API key support to settings API/models and persist it to the agent
.env. - Add UI + frontend API typings to configure/clear the Tavily key, plus unit tests for Tavily-preferred behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/pages/Settings.tsx | Adds Tavily API key input + clear toggle and includes it in data-source settings updates. |
| frontend/src/lib/api.ts | Extends data-source settings request/response typings for Tavily key configuration. |
| agent/tests/test_web_search_tool.py | Adds tests asserting Tavily is preferred when configured and ddgs is used as fallback. |
| agent/src/tools/web_search_tool.py | Implements Tavily availability detection + Tavily search path before ddgs fallback. |
| agent/requirements.txt | Adds tavily-python dependency for Tavily client support. |
| agent/api_server.py | Adds Tavily key fields to data-source settings endpoints and runtime env syncing. |
| agent/.env.example | Documents TAVILY_API_KEY and how it affects web search behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <input | ||
| type="password" | ||
| value={tavilyApiKey} | ||
| onChange={(event) => setTavilyApiKey(event.target.value)} | ||
| className={`${fieldClass} pl-9`} | ||
| placeholder={tavilyStatus} | ||
| autoComplete="off" | ||
| disabled={clearTavilyApiKey} | ||
| </div> |
| from contextlib import contextmanager | ||
| from types import ModuleType | ||
| from unittest.mock import MagicMock | ||
| from unittest.mock import MagicMock, patch |
|
Thanks for the PR, and for the thoughtful Tavily-preferred / ddgs-fallback design — it's a clear improvement over the earlier attempt. We're closing this one for the same reason we closed #75: web_search already runs as a keyless multi-engine aggregator via ddgs (DuckDuckGo, Google, Bing, Brave, Mojeek, Yahoo), hardened in #231/#232 with an ordered backend list, retry/backoff, and the VIBE_TRADING_SEARCH_BACKENDS override. We want web search to keep working out of the box with no paid API key, so we'd prefer not to add tavily-python as a dependency or a Tavily key as a required-for-best-results setting. This isn't a quality issue with your code — it's a standing decision about not taking on a paid search dependency. If you think there's a gap the current ddgs path doesn't cover (specific queries where it consistently fails), we'd genuinely welcome an issue with those cases so we can improve the free path. Thanks again for contributing. |
Summary
Why
Changes
Test Plan
pytest --ignore=agent/tests/e2e_backtest --tb=short -q)Checklist
src/agent/,src/session/,src/providers/) without prior discussion