Skip to content

馃攳 feat: add Tavily as Search and Scraper Provider - #12581

Merged
danny-avila merged 11 commits into
LibreChat-AI:devfrom
yashwanth-alapati:feat/tavily-web-search
May 4, 2026
Merged

danny-avila merged 11 commits into
LibreChat-AI:devfrom
yashwanth-alapati:feat/tavily-web-search

Conversation

@yashwanth-alapati

@yashwanth-alapati yashwanth-alapati commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request Template

Summary

  • Adds Tavily as a search provider and scraper provider
  • Separate tavilySearchOptions and tavilyScraperOptions config blocks for full control over Tavily Search and Extract API parameters
  • Frontend UI updated with Tavily in provider/scraper dropdowns

Change Type

Please delete any irrelevant options.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist

Please delete any irrelevant options.

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • Local unit tests pass with my changes
  • A pull request for updating the documentation has been submitted.

@yashwanth-alapati
yashwanth-alapati marked this pull request as ready for review April 9, 2026 14:56
@danny-avila

Copy link
Copy Markdown
Collaborator

/gitnexus index

@danny-avila

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90f626231e

鈩癸笍 About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -903,11 +903,13 @@ export enum SearchCategories {
export enum SearchProviders {
SERPER = 'serper',
SEARXNG = 'searxng',
TAVILY = 'tavily',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove unsupported Tavily search provider from enum

This adds tavily as a valid searchProvider, but the pinned runtime dependency (@librechat/agents 3.1.64 in package-lock.json) does not support it: createSearchAPI only accepts serper/searxng and throws for other values. In practice, a config using webSearch.searchProvider: tavily will pass auth selection here and then fail to construct the web_search tool at runtime.

Useful? React with 馃憤聽/ 馃憥.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Audited after rebasing this PR onto origin/dev and pushing a730b88e6. The runtime support for searchProvider: tavily lives in the paired agents PR (danny-avila/agents#85), so this remains a cross-repo dependency until that agents change is mergeable/published and LibreChat can bump @librechat/agents to the published version. I also updated the LibreChat Tavily option schema in a730b88e6 to match the Tavily API string modes, but I鈥檓 leaving this thread unresolved until the agents package bump is available.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Update: the original agents PR could not be updated because maintainer pushes to the contributor fork were rejected with HTTP 403, so I opened the rebased maintainer-owned replacement as danny-avila/agents#135 and closed danny-avila/agents#85. This LibreChat thread remains the same dependency issue, now tracking agents runtime support via #135.

}

export enum ScraperProviders {
FIRECRAWL = 'firecrawl',
SERPER = 'serper',
TAVILY = 'tavily',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Do not expose Tavily scraper before runtime support

Adding tavily to scraperProvider is currently broken with the pinned agents package: createSearchTool only has a serper branch and otherwise falls back to Firecrawl. So scraperProvider: tavily can authenticate via tavilyApiKey in this repo, but scraping actually runs through Firecrawl and requires FIRECRAWL_API_KEY, causing Tavily-only setups to fail when extraction is attempted.

Useful? React with 馃憤聽/ 馃憥.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Audited after rebasing this PR onto origin/dev and pushing a730b88e6. The Tavily scraper runtime support is implemented in the paired agents PR (danny-avila/agents#85), so this is still blocked on getting that agents branch pushed/merged/published and then bumping @librechat/agents here. The LibreChat branch now accepts the Tavily option modes, but this thread should stay unresolved until the runtime package dependency is available.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Update: the original agents PR could not be updated because maintainer pushes to the contributor fork were rejected with HTTP 403, so I opened the rebased maintainer-owned replacement as danny-avila/agents#135 and closed danny-avila/agents#85. This thread is still valid until #135 is merged/published and LibreChat bumps @librechat/agents.

@danny-avila
danny-avila force-pushed the feat/tavily-web-search branch from deb0dc1 to a730b88 Compare May 3, 2026 21:20
@danny-avila
danny-avila changed the base branch from main to dev May 3, 2026 21:20
@danny-avila

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a730b88e6b

鈩癸笍 About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -927,11 +927,13 @@ export enum SearchCategories {
export enum SearchProviders {
SERPER = 'serper',
SEARXNG = 'searxng',
TAVILY = 'tavily',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Align exported search provider type with Tavily support

Adding SearchProviders.TAVILY here makes 'tavily' valid in parsed config, but the exported SearchProvider union in packages/data-provider/src/types/web.ts still only allows 'serper' | 'searxng'. Any TypeScript consumer using SearchConfig now gets a type mismatch when configuring Tavily, which breaks type-safe adoption of the new provider unless callers cast away types.

Useful? React with 馃憤聽/ 馃憥.

Comment thread librechat.example.yaml Outdated
# # excludeDomains: # Exclude specific domains from results (max 150)
# # - 'spam.com'
# # timeRange: week # 'day', 'week', 'month', or 'year'
# # timeout: 15000 # HTTP request timeout in milliseconds

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use Tavily timeout examples in seconds, not milliseconds

This example documents Tavily timeout as milliseconds (15000), but Tavily's Search/Extract timeout parameters are second-based and constrained to small ranges. Users copying this value will configure an out-of-range timeout and can trigger request validation failures. The sample should show second-based values (for example 15) and correct units in the comment.

Useful? React with 馃憤聽/ 馃憥.

@danny-avila
danny-avila force-pushed the feat/tavily-web-search branch from a730b88 to 0f37f92 Compare May 3, 2026 22:57
@danny-avila

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f37f925a0

鈩癸笍 About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/api/src/web/web.ts Outdated
webSearchConfig?.scraperTimeout ?? webSearchConfig?.firecrawlOptions?.timeout ?? 7500;
webSearchConfig?.scraperTimeout ??
webSearchConfig?.firecrawlOptions?.timeout ??
webSearchConfig?.tavilyScraperOptions?.timeout ??

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Scope Tavily timeout to Tavily scraper only

tavilyScraperOptions.timeout is now part of the global scraperTimeout fallback chain, so a Tavily-specific setting can change timeout behavior even when the active scraper is firecrawl or serper. This is a behavior regression when users keep multi-provider config blocks and only switch scraperProvider: with scraperProvider: firecrawl and no explicit scraperTimeout, the Firecrawl path will inherit Tavily鈥檚 timeout unintentionally. Apply this fallback only when scraperProvider is Tavily (or require explicit scraperTimeout for cross-provider behavior).

Useful? React with 馃憤聽/ 馃憥.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 1d47e5f36. tavilyScraperOptions.timeout now feeds the shared scraper timeout only when scraperProvider is Tavily, so Firecrawl and Serper no longer inherit Tavily-specific timeout settings from multi-provider config blocks. Added API web auth regression tests for both the Firecrawl and Tavily timeout paths. Local verification: npx jest src/web/web.spec.ts --runInBand.

@danny-avila

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1d47e5f361

鈩癸笍 About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/api/src/web/web.ts Outdated
@@ -245,10 +247,23 @@ export async function loadWebSearchAuth({
authTypes.push([category, isUserProvided ? AuthType.USER_PROVIDED : AuthType.SYSTEM_DEFINED]);
}

const scraperProvider = webSearchConfig?.scraperProvider ?? 'firecrawl';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Base scraper timeout on resolved scraper provider

Use the authenticated scraper in authResult.scraperProvider when choosing provider-specific timeout options. As written, if scraperProvider is omitted in config and only Tavily credentials are available, checkAuth resolves the scraper to Tavily, but this branch still defaults to 'firecrawl' and ignores tavilyScraperOptions.timeout, falling back to 7500. That causes unexpected timeout behavior for valid Tavily-only setups and can prematurely fail extractions.

Useful? React with 馃憤聽/ 馃憥.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 580a2ae08. Timeout selection now uses the resolved authResult.scraperProvider first, then falls back to the raw config/default, so Tavily-only authenticated setups get their tavilyScraperOptions.timeout even when scraperProvider is omitted. Local verification: npx jest src/web/web.spec.ts --runInBand.

@danny-avila

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 580a2ae080

鈩癸笍 About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -927,11 +927,13 @@ export enum SearchCategories {
export enum SearchProviders {
SERPER = 'serper',
SEARXNG = 'searxng',
TAVILY = 'tavily',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep search-provider types consistent with Tavily support

Adding TAVILY to the runtime SearchProviders enum here without also widening the legacy SearchProvider literal type in packages/data-provider/src/types/web.ts ('serper' | 'searxng') leaves exported types inconsistent. TypeScript consumers that use SearchConfig/SearchProvider will still reject searchProvider: 'tavily', so adopting the new provider now requires unsafe casts or fails compilation.

Useful? React with 馃憤聽/ 馃憥.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 3b10eb907. The legacy SearchProvider type now includes tavily, and SearchConfig includes the Tavily search key/url/options fields so TypeScript consumers can use Tavily without casts. Local verification: npx jest src/config.spec.ts --runInBand and npx tsc --noEmit in packages/data-provider.

@danny-avila

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

鈩癸笍 About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila
danny-avila force-pushed the feat/tavily-web-search branch from 3b10eb9 to 9f5cdfd Compare May 4, 2026 01:14
@danny-avila

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

馃挕 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f5cdfd4c6

鈩癸笍 About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -7,6 +7,9 @@ export type TWebSearchKeys =
| 'firecrawlApiKey'
| 'firecrawlApiUrl'
| 'firecrawlVersion'
| 'tavilyApiKey'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Prevent web_search uninstall from deleting Tavily tool auth

Adding tavilyApiKey to webSearchKeys causes web_search uninstall to always target TAVILY_API_KEY, and in updateUserPluginsController that key is deleted via deleteUserPluginAuth(userId, authField) without a plugin scope; deletePluginAuth then deletes by { userId, authField } only. In practice, users who configured the separate tavily_search_results_json tool (which also uses TAVILY_API_KEY) will lose that credential when uninstalling web_search, even though they did not uninstall the Tavily tool.

Useful? React with 馃憤聽/ 馃憥.

@danny-avila

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 馃殌

鈩癸笍 About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila danny-avila changed the title feat: add Tavily integration as search provider and scraper provider feat: add Tavily as Search and Scraper Provider May 4, 2026
@danny-avila danny-avila changed the title feat: add Tavily as Search and Scraper Provider 馃攳 feat: add Tavily as Search and Scraper Provider May 4, 2026
@danny-avila
danny-avila force-pushed the feat/tavily-web-search branch from 0eaf3c5 to d90e36a Compare May 4, 2026 01:49
@danny-avila

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

鈩癸笍 About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila
danny-avila force-pushed the feat/tavily-web-search branch from d90e36a to 43f4298 Compare May 4, 2026 02:27
@danny-avila

Copy link
Copy Markdown
Collaborator

@codex review

@danny-avila
danny-avila merged commit 3da1d8c into LibreChat-AI:dev May 4, 2026
7 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

鈩癸笍 About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 馃憤.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

fuuuzzy pushed a commit to fuuuzzy/LibreChat that referenced this pull request May 6, 2026
* feat: add Tavily integration as search provider and scraper provider

* chore:update tavily web search parameters

* chore:tavily paramer update

* chore:update data-schemas test for tavily

* fix: allow Tavily string option modes

* fix: align Tavily config options

* fix: scope Tavily scraper timeout

* fix: use resolved scraper provider timeout

* fix: widen Tavily search provider types

* fix: harden Tavily web search config

* fix: cap Tavily option timeouts

---------

Co-authored-by: Danny Avila <danny@librechat.ai>
jcbartle pushed a commit to jcbartle/LibreChat that referenced this pull request May 11, 2026
* feat: add Tavily integration as search provider and scraper provider

* chore:update tavily web search parameters

* chore:tavily paramer update

* chore:update data-schemas test for tavily

* fix: allow Tavily string option modes

* fix: align Tavily config options

* fix: scope Tavily scraper timeout

* fix: use resolved scraper provider timeout

* fix: widen Tavily search provider types

* fix: harden Tavily web search config

* fix: cap Tavily option timeouts

---------

Co-authored-by: Danny Avila <danny@librechat.ai>
ThomasVuNguyen pushed a commit to ThomasVuNguyen/LibreChat that referenced this pull request Jul 15, 2026
* feat: add Tavily integration as search provider and scraper provider

* chore:update tavily web search parameters

* chore:tavily paramer update

* chore:update data-schemas test for tavily

* fix: allow Tavily string option modes

* fix: align Tavily config options

* fix: scope Tavily scraper timeout

* fix: use resolved scraper provider timeout

* fix: widen Tavily search provider types

* fix: harden Tavily web search config

* fix: cap Tavily option timeouts

---------

Co-authored-by: Danny Avila <danny@librechat.ai>
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