feat: add Tavily as a web_search provider#44343
Conversation
This comment was marked as spam.
This comment was marked as spam.
Greptile SummaryThis PR adds Tavily as a sixth What's added:
Issues found:
Confidence Score: 4/5
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 249a9bc059
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4e47e9122
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…-specific test for mixed allowlist and denylist
…ort mixed allowlist and denylist in domain filters
…d target registry
77edba4 to
68e305d
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 68e305d81c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Summary
web_searchtool supports Brave, Gemini, Grok, Kimi, and Perplexity but not Tavily Search API.web_searchprovider with full integration: API key resolution (TAVILY_API_KEY/ config), auto-detection, tool schema with Tavily-specific parameters (search_depth,include_answer,domain_filter), freshness/date filtering, config validation (Zod schema + types), onboarding wizard entry, docs (EN + zh-CN), and comprehensive tests.web_fetch. No changes to the UI dashboard or gateway server logic.Change Type (select all)
Scope (select all touched areas)
User-visible / Behavior Changes
web_searchprovider option:"tavily".tools.web.search.tavilywithapiKeyandbaseUrlfields.TAVILY_API_KEY.TAVILY_API_KEYis set and no higher-priority provider key is found, Tavily is auto-selected.search_depth(basic/advanced),include_answer(boolean),domain_filter(supports mixed allowlist + denylist).Security Impact (required)
NoYes- newTAVILY_API_KEYenv var andtools.web.search.tavily.apiKeyconfig field, following the sameSecretInput/SecretRefpattern as all other providers.Yes- new outbound POST tohttps://api.tavily.com/search(or user-configuredbaseUrl), using the existingwithTrustedWebSearchEndpointdispatcher (proxy-aware, sandboxed).Yes-web_searchtool gains Tavily as a provider option with three new schema parameters.Nountrusted: truemarkers.Repro + Verification
Environment
{ tools: { web: { search: { provider: "tavily", tavily: { apiKey: "tvly-..." } } } } }Steps
TAVILY_API_KEY=tvly-...in environment (or configure viaopenclaw configure --section web).web_searchwithquery: "test query".title,url,snippetfields are returned.Expected
answerfield wheninclude_answer: true.Actual
Evidence
Tests added/updated:
src/agents/tools/web-search.test.ts— Tavily config resolution, provider auto-detection, freshness normalizationsrc/agents/tools/web-tools.enabled-defaults.test.ts— Full provider integration tests (basic search, count up to 20, AI answer, search depth, freshness, domain filters including mixed allowlist+denylist, schema validation, proxy dispatch)src/config/config-misc.test.ts— Zod schema validation for Tavily config (accepts valid, rejects unknown fields)Screenshots
Human Verification (required)
pnpm test). Config validation accepts valid Tavily config and rejects unknown fields. Provider auto-detection selects Tavily when onlyTAVILY_API_KEYis present and falls back to Brave when no keys exist.baseUrlfalls back to default. Invalidsearch_depthvalues are rejected. Mixed allowlist+denylist domain filters work for Tavily (blocked for other providers). Freshness normalization handles Brave shortcuts (pd/pw/pm/py) and standard values.Review Conversations
Compatibility / Migration
Yes- purely additive; no existing behavior changed.Yes- new optionaltools.web.search.tavilyconfig section andTAVILY_API_KEYenv var.NoFailure Recovery (if this breaks)
tools.web.search.providerto any other provider, or removeTAVILY_API_KEYfrom environment.missing_tavily_api_keyerrors if provider is set to"tavily"without a key configured.Risks and Mitigations
provider: "tavily"is opt-in.