Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(search): add Tavily BYOK provider\n

ligjn519253cc37ba
diff --git a/.env.example b/.env.example
index e9527cd996..e014eb559e 100644
--- a/.env.example
+++ b/.env.example
@@ -192,6 +192,18 @@ OPENHUMAN_WEB_SEARCH_TIMEOUT_SECS=10
# EXA_API_KEY=
# OPENHUMAN_EXA_API_KEY=
+# ---------------------------------------------------------------------------
+# Tavily search (direct API, BYOK — https://tavily.com)
+# ---------------------------------------------------------------------------
+# [optional] API key from https://tavily.com. Select "Tavily" in
+# Settings > Search engine, or set OPENHUMAN_SEARCH_ENGINE=tavily. Calls go
+# straight to https://api.tavily.com with this key (never through the managed
+# backend) and power web_search_tool plus tavily_search / tavily_extract.
+# Engine falls back to "managed" if no key is present. Managed search is not
+# available to local users, who must configure a Tavily key before searching.
+# TAVILY_API_KEY=
+# OPENHUMAN_TAVILY_API_KEY=
+
# ---------------------------------------------------------------------------
# Brave search (direct API — https://brave.com/search/api/)
# ---------------------------------------------------------------------------
diff --git a/app/src/components/settings/panels/SearchPanel.test.tsx b/app/src/components/settings/panels/SearchPanel.test.tsx
index 3082031a3c..dcc5fbddde 100644
--- a/app/src/components/settings/panels/SearchPanel.test.tsx
+++ b/app/src/components/settings/panels/SearchPanel.test.tsx
@@ -44,6 +44,7 @@ function settings(overrides: Record<string, unknown> = {}) {
brave_configured: false,
querit_configured: false,
exa_configured: false,
+ tavily_configured: false,
allowed_domains: ['reuters.com'],
allow_all: false,
...overrides,
@@ -357,4 +358,71 @@ describe('SearchPanel — unified web-access modes', () => {
expect(link).toHaveAttribute('href', 'https://exa.ai');
});
+
+ test('Tavily is selectable and shows the needs-key badge until a key is stored', async () => {
+ renderWithProviders(<SearchPanel embedded />);
+ const tavily = await screen.findByTestId('search-engine-tavily');
+
+ expect(within(tavily).getByText('settings.search.statusNeedsKey')).toBeTruthy();
+ expect(tavily).toHaveAttribute('aria-checked', 'false');
+
+ fireEvent.click(tavily);
+
+ await waitFor(() =>
+ expect(hoisted.updateSearchSettings).toHaveBeenCalledWith({ engine: 'tavily' })
+ );
+ });
+
+ test('a stored Tavily key flips the badge to configured', async () => {
+ hoisted.getSearchSettings.mockResolvedValue({
+ result: settings({ engine: 'tavily', effective_engine: 'tavily', tavily_configured: true }),
+ });
+ renderWithProviders(<SearchPanel embedded />);
+
+ const tavily = await screen.findByTestId('search-engine-tavily');
+
+ expect(tavily).toHaveAttribute('aria-checked', 'true');
+ expect(within(tavily).getByText('settings.search.statusConfigured')).toBeTruthy();
+ expect(within(tavily).queryByText('settings.search.fallbackToManaged')).toBeNull();
+ });
+
+ test('Tavily key editor can reveal, save, and clear the stored API key', async () => {
+ hoisted.getSearchSettings.mockResolvedValue({ result: settings({ tavily_configured: true }) });
+ renderWithProviders(<SearchPanel embedded />);
+ await screen.findByPlaceholderText('settings.search.placeholderStored');
+
+ const tavily = keyEditor('settings.search.tavilyKeyLabel');
+ const input = tavily.getByPlaceholderText(
+ 'settings.search.placeholderStored'
+ ) as HTMLInputElement;
+ expect(input.type).toBe('password');
+
+ fireEvent.click(tavily.getByText('settings.search.show'));
+ expect(input.type).toBe('text');
+
+ fireEvent.change(input, { target: { value: 'tvly-tavily-test-key' } });
+ fireEvent.click(tavily.getByText('settings.search.save'));
+
+ await waitFor(() =>
+ expect(hoisted.updateSearchSettings).toHaveBeenCalledWith({
+ tavily_api_key: 'tvly-tavily-test-key',
+ })
+ );
+ expect(input.value).toBe('');
+
+ fireEvent.click(tavily.getByText('settings.search.clear'));
+
+ await waitFor(() =>
+ expect(hoisted.updateSearchSettings).toHaveBeenCalledWith({ tavily_api_key: '' })
+ );
+ });
+
+ test('the Tavily key editor links out to tavily.com for a key', async () => {
+ renderWithProviders(<SearchPanel embedded />);
+ await screen.findByPlaceholderText('settings.search.placeholderTavily');
+
+ const link = keyEditor('settings.search.tavilyKeyLabel').getByRole('link');
+
+ expect(link).toHaveAttribute('href', 'https://tavily.com');
+ });
});
diff --git a/app/src/components/settings/panels/SearchPanel.tsx b/app/src/components/settings/panels/SearchPanel.tsx
index 285a48b754..6b278e8a48 100644
--- a/app/src/components/settings/panels/SearchPanel.tsx
+++ b/app/src/components/settings/panels/SearchPanel.tsx
@@ -42,7 +42,7 @@ type Status =
type AccessMode = 'all' | 'custom' | 'block';
/** Search engines that route directly from this machine with the user's own key. */
-type ByokEngine = 'parallel' | 'brave' | 'querit' | 'exa';
+type ByokEngine = 'parallel' | 'brave' | 'querit' | 'exa' | 'tavily';
/** Patch field that carries each BYOK engine's key. Empty string clears it. */
const BYOK_KEY_FIELD: Record<ByokEngine, keyof SearchSettingsUpdate> = {
@@ -50,6 +50,7 @@ const BYOK_KEY_FIELD: Record<ByokEngine, keyof SearchSettingsUpdate> = {
brave: 'brave_api_key',
querit: 'querit_api_key',
exa: 'exa_api_key',
+ tavily: 'tavily_api_key',
};
/**
@@ -77,10 +78,12 @@ const SearchPanel = ({ embedded = false }: { embedded?: boolean }) => {
const [braveKey, setBraveKey] = useState<string>('');
const [queritKey, setQueritKey] = useState<string>('');
const [exaKey, setExaKey] = useState<string>('');
+ const [tavilyKey, setTavilyKey] = useState<string>('');
const [showParallel, setShowParallel] = useState(false);
const [showBrave, setShowBrave] = useState(false);
const [showQuerit, setShowQuerit] = useState(false);
const [showExa, setShowExa] = useState(false);
+ const [showTavily, setShowTavily] = useState(false);
// Editor text for the allowed-websites host list (one host per line). The
// "*" wildcard is represented by the access mode, not shown here.
const [allowedText, setAllowedText] = useState<string>('');
@@ -128,6 +131,12 @@ const SearchPanel = ({ embedded = false }: { embedded?: boolean }) => {
description: t('settings.search.engineExaDesc'),
requiresKey: true,
},
+ {
+ id: 'tavily',
+ label: t('settings.search.engineTavilyLabel'),
+ description: t('settings.search.engineTavilyDesc'),
+ requiresKey: true,
+ },
];
const visibleEngines = isLocalSession
? ENGINES.filter(engine => engine.id !== 'managed')
@@ -183,6 +192,7 @@ const SearchPanel = ({ embedded = false }: { embedded?: boolean }) => {
brave: () => setBraveKey(''),
querit: () => setQueritKey(''),
exa: () => setExaKey(''),
+ tavily: () => setTavilyKey(''),
};
const persistKey = async (engine: ByokEngine, rawKey: string) => {
@@ -239,6 +249,7 @@ const SearchPanel = ({ embedded = false }: { embedded?: boolean }) => {
if (engine === 'brave') return settings.brave_configured;
if (engine === 'querit') return settings.querit_configured;
if (engine === 'exa') return settings.exa_configured;
+ if (engine === 'tavily') return settings.tavily_configured;
return false;
};
@@ -343,6 +354,23 @@ const SearchPanel = ({ embedded = false }: { embedded?: boolean }) => {
docUrl="https://exa.ai"
t={t}
/>
+ <KeyEditor
+ label={t('settings.search.tavilyKeyLabel')}
+ placeholder={
+ settings.tavily_configured
+ ? t('settings.search.placeholderStored')
+ : t('settings.search.placeholderTavily')
+ }
+ show={showTavily}
+ onToggleShow={() => setShowTavily(s => !s)}
+ value={tavilyKey}
+ onChange={setTavilyKey}
+ onSave={() => void persistKey('tavily', tavilyKey)}
+ onClear={() => void persistKey('tavily', '')}
+ configured={settings.tavily_configured}
+ docUrl="https://tavily.com"
+ t={t}
+ />
</div>
{/* Allowed websites — unified host allowlist shared by web_fetch /
diff --git a/app/src/lib/i18n/ar.ts b/app/src/lib/i18n/ar.ts
index 0d6a788229..9a15ae976f 100644
--- a/app/src/lib/i18n/ar.ts
+++ b/app/src/lib/i18n/ar.ts
@@ -1346,7 +1346,7 @@ const messages: TranslationMap = {
'settings.search.title': 'محرك البحث',
'settings.search.menuDesc': 'تخلف عن البحث أو التنصت على مزودك الخاص بمفتاح اكسوكس',
'settings.search.description':
- 'اختر محرك البحث الذي يستخدمه الوكيل، أو عطّل أدوات البحث بالكامل. يستخدم الوضع المُدار واجهة خلفية OpenHuman (بدون إعداد). تعمل محركات Parallel وBrave وQuerit وExa مباشرةً من جهازك باستخدام مفتاح API الخاص بك.',
+ 'اختر محرك البحث الذي يستخدمه الوكيل، أو عطّل أدوات البحث بالكامل. يستخدم الوضع المُدار واجهة خلفية OpenHuman (بدون إعداد). تعمل محركات Parallel وBrave وQuerit وExa وTavily مباشرةً من جهازك باستخدام مفتاح API الخاص بك.',
'settings.search.engineAria': 'محرك البحث',
'settings.search.engineDisabledLabel': 'Disabled',
'settings.search.engineDisabledDesc': 'أزل أدوات البحث من سياق الوكيل وقائمة الأدوات المتاحة.',
@@ -1354,7 +1354,7 @@ const messages: TranslationMap = {
'settings.search.engineManagedDesc':
'الإعداد الافتراضي. يتم توجيهه عبر خادم OpenHuman الخلفي، المدعوم حاليًا بواسطة Exa: لا حاجة إلى مفتاح API.',
'settings.search.localManagedUnavailable':
- 'بحث OpenHuman المُدار غير متاح للمستخدمين المحليين. أضف مفتاح Parallel أو Brave أو Querit أو Exa الخاص بك لتفعيل البحث على الويب.',
+ 'بحث OpenHuman المُدار غير متاح للمستخدمين المحليين. أضف مفتاح Parallel أو Brave أو Querit أو Exa أو Tavily الخاص بك لتفعيل البحث على الويب.',
'settings.search.engineParallelLabel': 'Parallel',
'settings.search.engineParallelDesc':
'واجهة برمجية متوازية مباشرة: أدوات البحث والاستخراج والمحادثة والبحث المتعمق والإثراء ومجموعات البيانات.',
@@ -1366,6 +1366,9 @@ const messages: TranslationMap = {
'settings.search.engineExaLabel': 'Exa',
'settings.search.engineExaDesc':
'بحث عصبي مدعوم من Exa. يتطلب مفتاح API الخاص بك من Exa. يضيف أدوات البحث والعثور على صفحات مشابهة واسترجاع محتوى الصفحات.',
+ 'settings.search.engineTavilyLabel': 'Tavily',
+ 'settings.search.engineTavilyDesc':
+ 'بحث الويب والأخبار والمالية مدعوم من Tavily. يتطلب مفتاح API الخاص بك من Tavily. يضيف أدوات البحث واستخراج محتوى الصفحات.',
'settings.search.statusConfigured': 'تم تكوينه',
'settings.search.statusNeedsKey': 'يحتاج إلى مفتاح API',
'settings.search.fallbackToManaged':
@@ -1387,6 +1390,8 @@ const messages: TranslationMap = {
'settings.search.placeholderBrave': 'BSA...',
'settings.search.placeholderQuerit': 'مفتاح API الخاص بـ Querit',
'settings.search.placeholderExa': 'الصق مفتاح API الخاص بـ Exa…',
+ 'settings.search.tavilyKeyLabel': 'مفتاح API الخاص بـ Tavily',
+ 'settings.search.placeholderTavily': 'tvly-...',
'settings.search.allowedSitesLabel': 'المواقع الشبكية المسموح بها',
'settings.search.allowedSitesHint':
'المضيفون الذين يُسمح للمساعد بفتحهم وقراءتهم (عبر جلب الويب وأداة المتصفح) مضيف واحد في كل سطر، مثل reuters.com. يشمل المضيف نطاقاته الفرعية أيضًا. البحث على الويب نفسه لا يتقيّد بهذه القائمة.',
diff --git a/app/src/lib/i18n/bn.ts b/app/src/lib/i18n/bn.ts
index bff107b66b..6bf0337501 100644
--- a/app/src/lib/i18n/bn.ts
+++ b/app/src/lib/i18n/bn.ts
@@ -1375,7 +1375,7 @@ const messages: TranslationMap = {
'settings.search.menuDesc':
'Xqx1q1x - নিজ হাতে অনুসন্ধান অথবা তার নিজের উপলব্ধকারীর সাথে যোগাযোগ স্থাপন করুন। Xqxqxkey কী- র সাথে একযোগে কাজ করার জন্য',
'settings.search.description':
- 'এজেন্ট যে সার্চ ইঞ্জিন ব্যবহার করে তা বেছে নিন, অথবা সার্চ টুলগুলো সম্পূর্ণভাবে নিষ্ক্রিয় করুন। Managed OpenHuman-এর ব্যাকএন্ড ব্যবহার করে (কোনো সেটআপ নেই)। Parallel, Brave, Querit, এবং Exa আপনার API কী ব্যবহার করে সরাসরি আপনার মেশিন থেকে চলে।',
+ 'এজেন্ট যে সার্চ ইঞ্জিন ব্যবহার করে তা বেছে নিন, অথবা সার্চ টুলগুলো সম্পূর্ণভাবে নিষ্ক্রিয় করুন। Managed OpenHuman-এর ব্যাকএন্ড ব্যবহার করে (কোনো সেটআপ নেই)। Parallel, Brave, Querit, Exa, এবং Tavily আপনার API কী ব্যবহার করে সরাসরি আপনার মেশিন থেকে চলে।',
'settings.search.engineAria': 'সার্চ ইঞ্জিন',
'settings.search.engineDisabledLabel': 'Disabled',
'settings.search.engineDisabledDesc':
@@ -1384,7 +1384,7 @@ const messages: TranslationMap = {
'settings.search.engineManagedDesc':
'ডিফল্ট। OpenHuman ব্যাক-এন্ডের মাধ্যমে রুট করা হয়, বর্তমানে Exa দ্বারা চালিত: কোনো API key প্রয়োজন নেই।',
'settings.search.localManagedUnavailable':
- 'লোকাল ব্যবহারকারীদের জন্য OpenHuman Managed সার্চ উপলভ্য নয়। ওয়েব সার্চ চালু করতে আপনার নিজের Parallel, Brave, Querit বা Exa API key যোগ করুন।',
+ 'লোকাল ব্যবহারকারীদের জন্য OpenHuman Managed সার্চ উপলভ্য নয়। ওয়েব সার্চ চালু করতে আপনার নিজের Parallel, Brave, Querit, Exa বা Tavily API key যোগ করুন।',
'settings.search.engineParallelLabel': 'Parallel',
'settings.search.engineParallelDesc':
'সরাসরি xqxxxxxxxxxxxxqx; অনুসন্ধান, চ্যাট, গবেষণা, সমৃদ্ধ টুল।',
@@ -1397,6 +1397,9 @@ const messages: TranslationMap = {
'settings.search.engineExaLabel': 'Exa',
'settings.search.engineExaDesc':
'Exa দ্বারা চালিত নিউরাল সার্চ। আপনার নিজের Exa API key প্রয়োজন। সার্চ, সদৃশ পৃষ্ঠা খোঁজা এবং পৃষ্ঠার বিষয়বস্তু আনার টুল যোগ করে।',
+ 'settings.search.engineTavilyLabel': 'Tavily',
+ 'settings.search.engineTavilyDesc':
+ 'Tavily দ্বারা চালিত ওয়েব, সংবাদ এবং আর্থিক সার্চ। আপনার নিজের Tavily API key প্রয়োজন। সার্চ ও পেজ কনটেন্ট আনার টুল যোগ করে।',
'settings.search.statusConfigured': 'কনফিগার করা',
'settings.search.statusNeedsKey': 'API কী প্রয়োজন',
'settings.search.fallbackToManaged':
@@ -1418,6 +1421,8 @@ const messages: TranslationMap = {
'settings.search.placeholderBrave': 'BSA...',
'settings.search.placeholderQuerit': 'কিউ- টি xxqx কি',
'settings.search.placeholderExa': 'আপনার Exa API কী পেস্ট করুন…',
+ 'settings.search.tavilyKeyLabel': 'Tavily API কী',
+ 'settings.search.placeholderTavily': 'tvly-...',
'settings.search.allowedSitesLabel': 'ওয়েবসাইটের অনুমতি দেওয়া হয়েছে',
'settings.search.allowedSitesHint':
'যেসব হোস্ট অ্যাসিস্ট্যান্ট খুলতে ও পড়তে পারবে (ওয়েব ফেচ এবং ব্রাউজার টুলের মাধ্যমে) প্রতি লাইনে একটি করে, যেমন reuters.com। একটি হোস্ট তার সাবডোমেইনগুলোও অন্তর্ভুক্ত করে। ওয়েব সার্চ নিজে এই তালিকা দ্বারা সীমাবদ্ধ নয়।',
diff --git a/app/src/lib/i18n/de.ts b/app/src/lib/i18n/de.ts
index 4bf6104ec3..885eb4d347 100644
--- a/app/src/lib/i18n/de.ts
+++ b/app/src/lib/i18n/de.ts
@@ -1423,7 +1423,7 @@ const messages: TranslationMap = {
'settings.search.menuDesc':
'Verwenden Sie standardmäßig die von OpenHuman verwaltete Suche oder verbinden Sie Ihren eigenen Anbieter mit einem API-Schlüssel.',
'settings.search.description':
- 'Wählen Sie die Suchmaschine, die der Agent verwendet, oder deaktivieren Sie Suchwerkzeuge vollständig. „Verwaltet“ nutzt das Backend von OpenHuman (keine Einrichtung erforderlich). Parallel, Brave, Querit und Exa laufen direkt von Ihrem Gerät aus und verwenden Ihren API-Schlüssel.',
+ 'Wählen Sie die Suchmaschine, die der Agent verwendet, oder deaktivieren Sie Suchwerkzeuge vollständig. „Verwaltet“ nutzt das Backend von OpenHuman (keine Einrichtung erforderlich). Parallel, Brave, Querit, Exa und Tavily laufen direkt von Ihrem Gerät aus und verwenden Ihren API-Schlüssel.',
'settings.search.engineAria': 'Suchmaschine',
'settings.search.engineDisabledLabel': 'Disabled',
'settings.search.engineDisabledDesc':
@@ -1432,7 +1432,7 @@ const messages: TranslationMap = {
'settings.search.engineManagedDesc':
'Standard. Wird über das OpenHuman-Backend geleitet, aktuell betrieben von Exa: kein API-Schlüssel erforderlich.',
'settings.search.localManagedUnavailable':
- 'Die von OpenHuman verwaltete Suche ist für lokale Benutzer nicht verfügbar. Füge deinen eigenen Parallel-, Brave-, Querit- oder Exa-API-Schlüssel hinzu, um die Websuche zu aktivieren.',
+ 'Die von OpenHuman verwaltete Suche ist für lokale Benutzer nicht verfügbar. Füge deinen eigenen Parallel-, Brave-, Querit-, Exa- oder Tavily-API-Schlüssel hinzu, um die Websuche zu aktivieren.',
'settings.search.engineParallelLabel': 'Parallel',
'settings.search.engineParallelDesc':
'Direct Parallel API: Such-, Extrahierungs-, Chat-, Recherche-, Anreicherungs- und Datensatz-Tools.',
@@ -1445,6 +1445,9 @@ const messages: TranslationMap = {
'settings.search.engineExaLabel': 'Exa',
'settings.search.engineExaDesc':
'Neuronale Suche von Exa. Erfordert deinen eigenen Exa-API-Schlüssel. Fügt Werkzeuge für Suche, ähnliche Seiten und Seiteninhalte hinzu.',
+ 'settings.search.engineTavilyLabel': 'Tavily',
+ 'settings.search.engineTavilyDesc':
+ 'Web-, Nachrichten- und Finanzsuche von Tavily. Erfordert deinen eigenen Tavily-API-Schlüssel. Fügt Werkzeuge für Suche und Seitenextraktion hinzu.',
'settings.search.statusConfigured': 'Konfiguriert',
'settings.search.statusNeedsKey': 'Benötigt API-Schlüssel',
'settings.search.fallbackToManaged':
@@ -1466,6 +1469,8 @@ const messages: TranslationMap = {
'settings.search.placeholderBrave': 'BSA...',
'settings.search.placeholderQuerit': 'Fragen Sie den API-Schlüssel ab',
'settings.search.placeholderExa': 'Füge deinen Exa-API-Schlüssel ein…',
+ 'settings.search.tavilyKeyLabel': 'Tavily-API-Schlüssel',
+ 'settings.search.placeholderTavily': 'tvly-...',
'settings.search.allowedSitesLabel': 'Erlaubte Websites',
'settings.search.allowedSitesHint':
'Hosts, die der Assistent öffnen und lesen darf – per Web-Abruf und Browser-Tool – einer pro Zeile, z. B. reuters.com. Ein Host schließt auch seine Subdomains ein. Die Websuche selbst wird durch diese Liste nicht eingeschränkt.',
diff --git a/app/src/lib/i18n/en.ts b/app/src/lib/i18n/en.ts
index 6b85d3c898..4ba3726050 100644
--- a/app/src/lib/i18n/en.ts
+++ b/app/src/lib/i18n/en.ts
@@ -1576,7 +1576,7 @@ const en: TranslationMap = {
'settings.search.menuDesc':
'Default to OpenHuman-managed search or wire up your own provider with an API key.',
'settings.search.description':
- "Pick the search engine the agent uses, or disable search tools entirely. Managed uses OpenHuman's backend (no setup). Parallel, Brave, Querit, and Exa run direct from your machine using your API key.",
+ "Pick the search engine the agent uses, or disable search tools entirely. Managed uses OpenHuman's backend (no setup). Parallel, Brave, Querit, Exa, and Tavily run direct from your machine using your API key.",
'settings.search.engineAria': 'Search engine',
'settings.search.engineDisabledLabel': 'Disabled',
'settings.search.engineDisabledDesc':
@@ -1585,7 +1585,7 @@ const en: TranslationMap = {
'settings.search.engineManagedDesc':
'Default. Routed through the OpenHuman backend, currently powered by Exa: no API key required.',
'settings.search.localManagedUnavailable':
- 'OpenHuman Managed search is not available for local users. Add your own Parallel, Brave, Querit, or Exa API key to enable web search.',
+ 'OpenHuman Managed search is not available for local users. Add your own Parallel, Brave, Querit, Exa, or Tavily API key to enable web search.',
'settings.search.engineParallelLabel': 'Parallel',
'settings.search.engineParallelDesc':
'Direct Parallel API: search, extract, chat, research, enrich, dataset tools.',
@@ -1597,6 +1597,9 @@ const en: TranslationMap = {
'settings.search.engineExaLabel': 'Exa',
'settings.search.engineExaDesc':
'Neural search powered by Exa. Requires your own Exa API key. Adds search, find similar, and page contents tools.',
+ 'settings.search.engineTavilyLabel': 'Tavily',
+ 'settings.search.engineTavilyDesc':
+ 'Web, news, and finance search powered by Tavily. Requires your own Tavily API key. Adds search and page extract tools.',
'settings.search.statusConfigured': 'Configured',
'settings.search.statusNeedsKey': 'Needs API key',
'settings.search.fallbackToManaged':
@@ -1613,11 +1616,13 @@ const en: TranslationMap = {
'settings.search.braveKeyLabel': 'Brave Search API key',
'settings.search.queritKeyLabel': 'Querit API key',
'settings.search.exaKeyLabel': 'Exa API key',
+ 'settings.search.tavilyKeyLabel': 'Tavily API key',
'settings.search.placeholderStored': '•••••••• (stored)',
'settings.search.placeholderParallel': 'pk_...',
'settings.search.placeholderBrave': 'BSA...',
'settings.search.placeholderQuerit': 'Querit API key',
'settings.search.placeholderExa': 'Paste your Exa API key…',
+ 'settings.search.placeholderTavily': 'tvly-...',
'settings.search.allowedSitesLabel': 'Allowed websites',
'settings.search.allowedSitesHint':
'Enter one host per line, such as reuters.com. The assistant may open and read these hosts through web fetch and the browser tool. Each host also covers its subdomains. This list does not restrict web search.',
diff --git a/app/src/lib/i18n/es.ts b/app/src/lib/i18n/es.ts
index ded3c17452..03fe94a202 100644
--- a/app/src/lib/i18n/es.ts
+++ b/app/src/lib/i18n/es.ts
@@ -1409,7 +1409,7 @@ const messages: TranslationMap = {
'settings.search.menuDesc':
'Por defecto, usa la búsqueda gestionada por OpenHuman o conecta tu propio proveedor con una clave API.',
'settings.search.description':
- 'Elige el motor de búsqueda que usa el agente, o deshabilita las herramientas de búsqueda por completo. Gestionado usa el backend de OpenHuman (sin configuración). Parallel, Brave, Querit y Exa se ejecutan directamente desde tu máquina usando tu clave de API.',
+ 'Elige el motor de búsqueda que usa el agente, o deshabilita las herramientas de búsqueda por completo. Gestionado usa el backend de OpenHuman (sin configuración). Parallel, Brave, Querit, Exa y Tavily se ejecutan directamente desde tu máquina usando tu clave de API.',
'settings.search.engineAria': 'motor de búsqueda',
'settings.search.engineDisabledLabel': 'Disabled',
'settings.search.engineDisabledDesc':
@@ -1418,7 +1418,7 @@ const messages: TranslationMap = {
'settings.search.engineManagedDesc':
'Predeterminado. Enrutado a través del backend de OpenHuman, actualmente con tecnología de Exa: no se requiere clave API.',
'settings.search.localManagedUnavailable':
- 'La búsqueda gestionada por OpenHuman no está disponible para usuarios locales. Añade tu propia API key de Parallel, Brave, Querit o Exa para habilitar la búsqueda web.',
+ 'La búsqueda gestionada por OpenHuman no está disponible para usuarios locales. Añade tu propia API key de Parallel, Brave, Querit, Exa o Tavily para habilitar la búsqueda web.',
'settings.search.engineParallelLabel': 'paralelo',
'settings.search.engineParallelDesc':
'Direct Parallel API: buscar, extraer, chatear, investigar, enriquecer, herramientas de conjuntos de datos.',
@@ -1431,6 +1431,9 @@ const messages: TranslationMap = {
'settings.search.engineExaLabel': 'Exa',
'settings.search.engineExaDesc':
'Búsqueda neuronal con tecnología de Exa. Requiere tu propia API key de Exa. Añade herramientas de búsqueda, páginas similares y contenido de páginas.',
+ 'settings.search.engineTavilyLabel': 'Tavily',
+ 'settings.search.engineTavilyDesc':
+ 'Búsqueda web, noticias y finanzas con tecnología de Tavily. Requiere tu propia API key de Tavily. Añade herramientas de búsqueda y extracción de páginas.',
'settings.search.statusConfigured': 'Configurado',
'settings.search.statusNeedsKey': 'Necesita la clave API',
'settings.search.fallbackToManaged':
@@ -1452,6 +1455,8 @@ const messages: TranslationMap = {
'settings.search.placeholderBrave': 'BSA...',
'settings.search.placeholderQuerit': 'Querit clave API',
'settings.search.placeholderExa': 'Pega tu clave API de Exa…',
+ 'settings.search.tavilyKeyLabel': 'Clave API de Tavily',
+ 'settings.search.placeholderTavily': 'tvly-...',
'settings.search.allowedSitesLabel': 'Sitios web permitidos',
'settings.search.allowedSitesHint':
'Hosts que el asistente puede abrir y leer (mediante recuperación web y la herramienta de navegador) uno por línea, p. ej. reuters.com. Un host también incluye sus subdominios. La búsqueda web en sí no está restringida por esta lista.',
diff --git a/app/src/lib/i18n/fr.ts b/app/src/lib/i18n/fr.ts
index dc7626821a..8be314a105 100644
--- a/app/src/lib/i18n/fr.ts
+++ b/app/src/lib/i18n/fr.ts
@@ -1422,7 +1422,7 @@ const messages: TranslationMap = {
'settings.search.menuDesc':
'Par défaut, utilisez la recherche gérée par OpenHuman ou connectez votre propre fournisseur avec une clé API.',
'settings.search.description':
- "Choisissez le moteur de recherche utilisé par l'agent, ou désactivez entièrement les outils de recherche. Géré utilise le backend d'OpenHuman (sans configuration). Parallel, Brave, Querit et Exa s'exécutent directement depuis votre machine avec votre clé API.",
+ "Choisissez le moteur de recherche utilisé par l'agent, ou désactivez entièrement les outils de recherche. Géré utilise le backend d'OpenHuman (sans configuration). Parallel, Brave, Querit, Exa et Tavily s'exécutent directement depuis votre machine avec votre clé API.",
'settings.search.engineAria': 'Moteur de recherche',
'settings.search.engineDisabledLabel': 'Disabled',
'settings.search.engineDisabledDesc':
@@ -1431,7 +1431,7 @@ const messages: TranslationMap = {
'settings.search.engineManagedDesc':
'Par défaut. Acheminé via le backend OpenHuman, actuellement propulsé par Exa: aucune clé API requise.',
'settings.search.localManagedUnavailable':
- 'La recherche gérée par OpenHuman n’est pas disponible pour les utilisateurs locaux. Ajoutez votre propre clé API Parallel, Brave, Querit ou Exa pour activer la recherche web.',
+ 'La recherche gérée par OpenHuman n’est pas disponible pour les utilisateurs locaux. Ajoutez votre propre clé API Parallel, Brave, Querit, Exa ou Tavily pour activer la recherche web.',
'settings.search.engineParallelLabel': 'Parallèle',
'settings.search.engineParallelDesc':
'Direct Parallel API: rechercher, extraire, discuter, rechercher, enrichir, outils de jeu de données.',
@@ -1444,6 +1444,9 @@ const messages: TranslationMap = {
'settings.search.engineExaLabel': 'Exa',
'settings.search.engineExaDesc':
'Recherche neuronale propulsée par Exa. Nécessite votre propre clé API Exa. Ajoute des outils de recherche, de pages similaires et de contenu de pages.',
+ 'settings.search.engineTavilyLabel': 'Tavily',
+ 'settings.search.engineTavilyDesc':
+ 'Recherche web, actualités et finance propulsée par Tavily. Nécessite votre propre clé API Tavily. Ajoute des outils de recherche et d’extraction de pages.',
'settings.search.statusConfigured': 'Configuré',
'settings.search.statusNeedsKey': 'Nécessite la clé API',
'settings.search.fallbackToManaged':
@@ -1465,6 +1468,8 @@ const messages: TranslationMap = {
'settings.search.placeholderBrave': 'BSA...',
'settings.search.placeholderQuerit': 'Cherche la clé API',
'settings.search.placeholderExa': 'Collez votre clé API Exa…',
+ 'settings.search.tavilyKeyLabel': 'Clé API Tavily',
+ 'settings.search.placeholderTavily': 'tvly-...',
'settings.search.allowedSitesLabel': 'Sites web autorisés',
'settings.search.allowedSitesHint':
"Saisissez les hôtes que l'assistant peut ouvrir et lire (via la récupération web et l'outil navigateur), un hôte par ligne, p. ex. reuters.com. Un hôte couvre également ses sous-domaines. La recherche web elle-même n'est pas limitée par cette liste.",
diff --git a/app/src/lib/i18n/hi.ts b/app/src/lib/i18n/hi.ts
index 013e2991e1..8cb458ab2b 100644
--- a/app/src/lib/i18n/hi.ts
+++ b/app/src/lib/i18n/hi.ts
@@ -1376,7 +1376,7 @@ const messages: TranslationMap = {
'settings.search.menuDesc':
'डिफ़ॉल्ट to OpenHuman -एक API कुंजी के साथ अपने स्वयं के प्रदाता को प्रबंधित खोज या तार करना।',
'settings.search.description':
- 'एजेंट द्वारा उपयोग किए जाने वाले सर्च इंजन को चुनें, या सर्च टूल्स को पूरी तरह बंद करें। Managed, OpenHuman के बैकएंड का उपयोग करता है (कोई सेटअप नहीं)। Parallel, Brave, Querit, और Exa आपकी API key का उपयोग करके सीधे आपकी मशीन से चलते हैं।',
+ 'एजेंट द्वारा उपयोग किए जाने वाले सर्च इंजन को चुनें, या सर्च टूल्स को पूरी तरह बंद करें। Managed, OpenHuman के बैकएंड का उपयोग करता है (कोई सेटअप नहीं)। Parallel, Brave, Querit, Exa, और Tavily आपकी API key का उपयोग करके सीधे आपकी मशीन से चलते हैं।',
'settings.search.engineAria': 'खोज इंजन',
'settings.search.engineDisabledLabel': 'Disabled',
'settings.search.engineDisabledDesc': 'एजेंट संदर्भ और उपलब्ध टूल सूची से खोज टूल हटाएं।',
@@ -1384,7 +1384,7 @@ const messages: TranslationMap = {
'settings.search.engineManagedDesc':
'डिफ़ॉल्ट। OpenHuman बैक-एंड के माध्यम से रूट किया जाता है, वर्तमान में Exa द्वारा संचालित: किसी API key की आवश्यकता नहीं।',
'settings.search.localManagedUnavailable':
- 'लोकल उपयोगकर्ताओं के लिए OpenHuman Managed search उपलब्ध नहीं है। वेब सर्च चालू करने के लिए अपनी Parallel, Brave, Querit या Exa API key जोड़ें।',
+ 'लोकल उपयोगकर्ताओं के लिए OpenHuman Managed search उपलब्ध नहीं है। वेब सर्च चालू करने के लिए अपनी Parallel, Brave, Querit, Exa या Tavily API key जोड़ें।',
'settings.search.engineParallelLabel': 'Parallel',
'settings.search.engineParallelDesc':
'डायरेक्ट Parallel API: खोज, निकालने, चैट, अनुसंधान, समृद्ध, डेटासेट उपकरण।',
@@ -1396,6 +1396,9 @@ const messages: TranslationMap = {
'settings.search.engineExaLabel': 'Exa',
'settings.search.engineExaDesc':
'Exa द्वारा संचालित न्यूरल सर्च। इसके लिए आपकी अपनी Exa API key आवश्यक है। सर्च, मिलते-जुलते पेज खोजने और पेज सामग्री लाने के टूल जोड़ता है।',
+ 'settings.search.engineTavilyLabel': 'Tavily',
+ 'settings.search.engineTavilyDesc':
+ 'Tavily द्वारा संचालित वेब, समाचार और वित्त खोज। इसके लिए आपकी अपनी Tavily API key आवश्यक है। सर्च और पेज सामग्री निकालने के टूल जोड़ता है।',
'settings.search.statusConfigured': 'विन्यस्त',
'settings.search.statusNeedsKey': 'API कुंजी की आवश्यकता है',
'settings.search.fallbackToManaged':
@@ -1417,6 +1420,8 @@ const messages: TranslationMap = {
'settings.search.placeholderBrave': 'BSA...',
'settings.search.placeholderQuerit': 'क्वेरिट API कुंजी',
'settings.search.placeholderExa': 'अपनी Exa API कुंजी पेस्ट करें…',
+ 'settings.search.tavilyKeyLabel': 'Tavily API कुंजी',
+ 'settings.search.placeholderTavily': 'tvly-...',
'settings.search.allowedSitesLabel': 'अनुमत वेबसाइटों',
'settings.search.allowedSitesHint':
'उन होस्ट को सूचीबद्ध करें जिन्हें असिस्टेंट खोल और पढ़ सकता है (वेब फ़ेच और ब्राउज़र टूल के माध्यम से), प्रति पंक्ति एक, जैसे reuters.com। एक होस्ट में उसके सभी सबडोमेन भी शामिल होते हैं। वेब सर्च स्वयं इस सूची से प्रतिबंधित नहीं है।',
diff --git a/app/src/lib/i18n/id.ts b/app/src/lib/i18n/id.ts
index 602a2e3877..9660c6dbb5 100644
--- a/app/src/lib/i18n/id.ts
+++ b/app/src/lib/i18n/id.ts
@@ -1388,7 +1388,7 @@ const messages: TranslationMap = {
'settings.search.menuDesc':
'Baku bagi OpenHuman- mengatur pencarian atau menghubungkan penyedia anda sendiri dengan kunci API.',
'settings.search.description':
- 'Pilih mesin pencari yang digunakan agen, atau nonaktifkan alat pencarian sepenuhnya. Managed menggunakan backend OpenHuman (tanpa pengaturan). Parallel, Brave, Querit, dan Exa berjalan langsung dari mesin Anda menggunakan kunci API Anda.',
+ 'Pilih mesin pencari yang digunakan agen, atau nonaktifkan alat pencarian sepenuhnya. Managed menggunakan backend OpenHuman (tanpa pengaturan). Parallel, Brave, Querit, Exa, dan Tavily berjalan langsung dari mesin Anda menggunakan kunci API Anda.',
'settings.search.engineAria': 'Mesin pencari',
'settings.search.engineDisabledLabel': 'Disabled',
'settings.search.engineDisabledDesc':
@@ -1397,7 +1397,7 @@ const messages: TranslationMap = {
'settings.search.engineManagedDesc':
'Baku. Diarahkan melalui backend OpenHuman, saat ini didukung oleh Exa: tidak diperlukan kunci API.',
'settings.search.localManagedUnavailable':
- 'Pencarian OpenHuman Managed tidak tersedia untuk pengguna lokal. Tambahkan API key Parallel, Brave, Querit, atau Exa Anda sendiri untuk mengaktifkan pencarian web.',
+ 'Pencarian OpenHuman Managed tidak tersedia untuk pengguna lokal. Tambahkan API key Parallel, Brave, Querit, Exa, atau Tavily Anda sendiri untuk mengaktifkan pencarian web.',
'settings.search.engineParallelLabel': 'Parallel',
'settings.search.engineParallelDesc':
'Parallel Langsung API: pencarian, ekstrak, percakapan, penelitian, perkaya, alat dataset.',
@@ -1410,6 +1410,9 @@ const messages: TranslationMap = {
'settings.search.engineExaLabel': 'Exa',
'settings.search.engineExaDesc':
'Pencarian neural yang didukung Exa. Memerlukan API key Exa Anda sendiri. Menambahkan alat pencarian, halaman serupa, dan konten halaman.',
+ 'settings.search.engineTavilyLabel': 'Tavily',
+ 'settings.search.engineTavilyDesc':
+ 'Pencarian web, berita, dan keuangan yang didukung Tavily. Memerlukan API key Tavily Anda sendiri. Menambahkan alat pencarian dan ekstraksi konten halaman.',
'settings.search.statusConfigured': 'Dikonfigurasi',
'settings.search.statusNeedsKey': 'Memerlukan kunci API',
'settings.search.fallbackToManaged':
@@ -1431,6 +1434,8 @@ const messages: TranslationMap = {
'settings.search.placeholderBrave': 'BSA...',
'settings.search.placeholderQuerit': 'kunci Querit API',
'settings.search.placeholderExa': 'Tempelkan kunci API Exa Anda…',
+ 'settings.search.tavilyKeyLabel': 'Kunci API Tavily',
+ 'settings.search.placeholderTavily': 'tvly-...',
'settings.search.allowedSitesLabel': 'Situs yang diijinkan',
'settings.search.allowedSitesHint':
'Host yang boleh dibuka dan dibaca oleh asisten (melalui pengambilan web dan alat browser) satu per baris, mis. reuters.com. Sebuah host juga mencakup subdomain-nya. Penelusuran web itu sendiri tidak dibatasi oleh daftar ini.',
diff --git a/app/src/lib/i18n/it.ts b/app/src/lib/i18n/it.ts
index 77da861238..d006ac6e94 100644
--- a/app/src/lib/i18n/it.ts
+++ b/app/src/lib/i18n/it.ts
@@ -1407,7 +1407,7 @@ const messages: TranslationMap = {
'settings.search.menuDesc':
'Imposta come predefinito la ricerca gestita da OpenHuman oppure collega il tuo provider con una chiave API.',
'settings.search.description':
- "Scegli il motore di ricerca utilizzato dall'agente oppure disabilita completamente gli strumenti di ricerca. Gestito utilizza il backend di OpenHuman (nessuna configurazione). Parallelo, Brave, Querit ed Exa vengono eseguiti direttamente dalla tua macchina usando la tua chiave API.",
+ "Scegli il motore di ricerca utilizzato dall'agente oppure disabilita completamente gli strumenti di ricerca. Gestito utilizza il backend di OpenHuman (nessuna configurazione). Parallelo, Brave, Querit, Exa e Tavily vengono eseguiti direttamente dalla tua macchina usando la tua chiave API.",
'settings.search.engineAria': 'Motore di ricerca',
'settings.search.engineDisabledLabel': 'Disabled',
'settings.search.engineDisabledDesc':
@@ -1416,7 +1416,7 @@ const messages: TranslationMap = {
'settings.search.engineManagedDesc':
'Predefinito. Instradato tramite il backend di OpenHuman, attualmente basato su Exa: nessuna chiave API necessaria.',
'settings.search.localManagedUnavailable':
- 'La ricerca gestita da OpenHuman non è disponibile per gli utenti locali. Aggiungi la tua chiave API Parallel, Brave, Querit o Exa per abilitare la ricerca web.',
+ 'La ricerca gestita da OpenHuman non è disponibile per gli utenti locali. Aggiungi la tua chiave API Parallel, Brave, Querit, Exa o Tavily per abilitare la ricerca web.',
'settings.search.engineParallelLabel': 'parallelo',
'settings.search.engineParallelDesc':
'Direct Parallel API: ricerca, estrai, chatta, ricerca, arricchisci, strumenti per set di dati.',
@@ -1429,6 +1429,9 @@ const messages: TranslationMap = {
'settings.search.engineExaLabel': 'Exa',
'settings.search.engineExaDesc':
'Ricerca neurale basata su Exa. Richiede la tua chiave API Exa. Aggiunge strumenti di ricerca, pagine simili e contenuti delle pagine.',
+ 'settings.search.engineTavilyLabel': 'Tavily',
+ 'settings.search.engineTavilyDesc':
+ 'Ricerca web, notizie e finanza basata su Tavily. Richiede la tua chiave API Tavily. Aggiunge strumenti di ricerca ed estrazione di pagine.',
'settings.search.statusConfigured': 'Configurato',
'settings.search.statusNeedsKey': 'Richiede la chiave API',
'settings.search.fallbackToManaged':
@@ -1450,6 +1453,8 @@ const messages: TranslationMap = {
'settings.search.placeholderBrave': 'BSA...',
'settings.search.placeholderQuerit': 'Chiave Querit API',
'settings.search.placeholderExa': 'Incolla la tua chiave API Exa…',
+ 'settings.search.tavilyKeyLabel': 'Chiave API Tavily',
+ 'settings.search.placeholderTavily': 'tvly-...',
'settings.search.allowedSitesLabel': 'Siti web consentiti',
'settings.search.allowedSitesHint':
"Inserisci, uno per riga, gli host che l'assistente può aprire e leggere tramite il recupero web e lo strumento browser, ad es. reuters.com. Un host include anche i suoi sottodomini. La ricerca web stessa non è limitata da questo elenco.",
diff --git a/app/src/lib/i18n/ko.ts b/app/src/lib/i18n/ko.ts
index ae4c7f1256..9cfc29eba6 100644
--- a/app/src/lib/i18n/ko.ts
+++ b/app/src/lib/i18n/ko.ts
@@ -1366,7 +1366,7 @@ const messages: TranslationMap = {
'settings.search.menuDesc':
'OpenHuman 관리 검색을 기본값으로 사용하거나 API 키로 자체 제공업체를 연결하세요.',
'settings.search.description':
- '에이전트가 사용할 검색 엔진을 선택하거나 검색 도구를 완전히 비활성화합니다. 관리형은 OpenHuman의 백엔드를 사용합니다(설정 불필요). 병렬, Brave, Querit, Exa는 API 키를 사용하여 내 컴퓨터에서 직접 실행됩니다.',
+ '에이전트가 사용할 검색 엔진을 선택하거나 검색 도구를 완전히 비활성화합니다. 관리형은 OpenHuman의 백엔드를 사용합니다(설정 불필요). 병렬, Brave, Querit, Exa, Tavily는 API 키를 사용하여 내 컴퓨터에서 직접 실행됩니다.',
'settings.search.engineAria': '검색 엔진',
'settings.search.engineDisabledLabel': 'Disabled',
'settings.search.engineDisabledDesc':
@@ -1375,7 +1375,7 @@ const messages: TranslationMap = {
'settings.search.engineManagedDesc':
'기본값입니다. OpenHuman 백엔드를 통해 라우팅되며 현재 Exa로 구동됩니다. API 키가 필요하지 않습니다.',
'settings.search.localManagedUnavailable':
- '로컬 사용자는 OpenHuman 관리 검색을 사용할 수 없습니다. 웹 검색을 활성화하려면 자체 Parallel, Brave, Querit 또는 Exa API 키를 추가하세요.',
+ '로컬 사용자는 OpenHuman 관리 검색을 사용할 수 없습니다. 웹 검색을 활성화하려면 자체 Parallel, Brave, Querit, Exa 또는 Tavily API 키를 추가하세요.',
'settings.search.engineParallelLabel': 'Parallel',
'settings.search.engineParallelDesc':
'직접 Parallel API: 검색, 추출, 채팅, 리서치, 보강, 데이터셋 도구.',
@@ -1387,6 +1387,9 @@ const messages: TranslationMap = {
'settings.search.engineExaLabel': 'Exa',
'settings.search.engineExaDesc':
'Exa 기반 신경망 검색. 본인의 Exa API 키가 필요합니다. 검색, 유사 페이지 찾기, 페이지 콘텐츠 도구를 추가합니다.',
+ 'settings.search.engineTavilyLabel': 'Tavily',
+ 'settings.search.engineTavilyDesc':
+ 'Tavily 기반 웹, 뉴스, 금융 검색. 본인의 Tavily API 키가 필요합니다. 검색 및 페이지 콘텐츠 추출 도구를 추가합니다.',
'settings.search.statusConfigured': '구성됨',
'settings.search.statusNeedsKey': 'API 키 필요',
'settings.search.fallbackToManaged':
@@ -1408,6 +1411,8 @@ const messages: TranslationMap = {
'settings.search.placeholderBrave': 'BSA...',
'settings.search.placeholderQuerit': 'Querit API 키',
'settings.search.placeholderExa': 'Exa API 키를 붙여넣으세요…',
+ 'settings.search.tavilyKeyLabel': 'Tavily API 키',
+ 'settings.search.placeholderTavily': 'tvly-...',
'settings.search.allowedSitesLabel': '허용된 웹사이트',
'settings.search.allowedSitesHint':
'리서치 중 어시스턴트가 열고 읽을 수 있는 웹사이트입니다(한 줄에 호스트 하나, 예: reuters.com). 호스트에는 하위 도메인도 포함됩니다. 모든 웹 접근을 차단하려면 비워 두세요.',
diff --git a/app/src/lib/i18n/pl.ts b/app/src/lib/i18n/pl.ts
index d388af4526..8ff85752bd 100644
--- a/app/src/lib/i18n/pl.ts
+++ b/app/src/lib/i18n/pl.ts
@@ -1402,7 +1402,7 @@ const messages: TranslationMap = {
'settings.search.menuDesc':
'Użyj domyślnie wyszukiwarki zarządzanej przez OpenHuman lub podłącz własnego dostawcę z kluczem API.',
'settings.search.description':
- 'Wybierz wyszukiwarkę używaną przez agenta. Zarządzana korzysta z backendu OpenHuman (bez konfiguracji). Parallel, Brave, Querit i Exa działają bezpośrednio z Twojego urządzenia, używając Twojego klucza API.',
+ 'Wybierz wyszukiwarkę używaną przez agenta. Zarządzana korzysta z backendu OpenHuman (bez konfiguracji). Parallel, Brave, Querit, Exa i Tavily działają bezpośrednio z Twojego urządzenia, używając Twojego klucza API.',
'settings.search.engineAria': 'Wyszukiwarka',
'settings.search.engineDisabledLabel': 'Disabled',
'settings.search.engineDisabledDesc':
@@ -1411,7 +1411,7 @@ const messages: TranslationMap = {
'settings.search.engineManagedDesc':
'Domyślnie. Kierowane przez backend OpenHuman, obecnie oparte na Exa: bez klucza API.',
'settings.search.localManagedUnavailable':
- 'Wyszukiwarka zarządzana przez OpenHuman jest niedostępna dla użytkowników lokalnych. Dodaj własny klucz API Parallel, Brave, Querit lub Exa, aby włączyć wyszukiwanie w sieci.',
+ 'Wyszukiwarka zarządzana przez OpenHuman jest niedostępna dla użytkowników lokalnych. Dodaj własny klucz API Parallel, Brave, Querit, Exa lub Tavily, aby włączyć wyszukiwanie w sieci.',
'settings.search.engineParallelLabel': 'Parallel',
'settings.search.engineParallelDesc':
'Bezpośrednie API Parallel: szukaj, wyciąg, czat, badania, wzbogacenie, narzędzia datasetowe.',
@@ -1424,6 +1424,9 @@ const messages: TranslationMap = {
'settings.search.engineExaLabel': 'Exa',
'settings.search.engineExaDesc':
'Wyszukiwanie neuronowe oparte na Exa. Wymaga własnego klucza API Exa. Dodaje narzędzia wyszukiwania, podobnych stron i treści stron.',
+ 'settings.search.engineTavilyLabel': 'Tavily',
+ 'settings.search.engineTavilyDesc':
+ 'Wyszukiwanie w sieci, wiadomości i finansów oparte na Tavily. Wymaga własnego klucza API Tavily. Dodaje narzędzia wyszukiwania i wyodrębniania treści stron.',
'settings.search.statusConfigured': 'Skonfigurowano',
'settings.search.statusNeedsKey': 'Wymaga klucza API',
'settings.search.fallbackToManaged':
@@ -1445,6 +1448,8 @@ const messages: TranslationMap = {
'settings.search.placeholderBrave': 'BSA...',
'settings.search.placeholderQuerit': 'Klucz API Querit',
'settings.search.placeholderExa': 'Wklej swój klucz API Exa…',
+ 'settings.search.tavilyKeyLabel': 'Klucz API Tavily',
+ 'settings.search.placeholderTavily': 'tvly-...',
'settings.search.allowedSitesLabel': 'Dozwolone witryny',
'settings.search.allowedSitesHint':
'Hosty, które asystent może otwierać i odczytywać (poprzez pobieranie stron i narzędzie przeglądarki) jeden na linię, np. reuters.com. Host obejmuje również swoje subdomeny. Samo wyszukiwanie w internecie nie jest ograniczone przez tę listę.',
diff --git a/app/src/lib/i18n/pt.ts b/app/src/lib/i18n/pt.ts
index 3272e87acb..6eaf3ba067 100644
--- a/app/src/lib/i18n/pt.ts
+++ b/app/src/lib/i18n/pt.ts
@@ -1407,7 +1407,7 @@ const messages: TranslationMap = {
'settings.search.menuDesc':
'Padrão para pesquisa gerenciada por OpenHuman ou conecte seu próprio provedor com uma chave API.',
'settings.search.description':
- 'Escolha o mecanismo de busca usado pelo agente, ou desative as ferramentas de pesquisa completamente. Gerenciado usa o backend do OpenHuman (sem configuração). Parallel, Brave, Querit e Exa funcionam diretamente do seu computador usando sua chave de API.',
+ 'Escolha o mecanismo de busca usado pelo agente, ou desative as ferramentas de pesquisa completamente. Gerenciado usa o backend do OpenHuman (sem configuração). Parallel, Brave, Querit, Exa e Tavily funcionam diretamente do seu computador usando sua chave de API.',
'settings.search.engineAria': 'Mecanismo de pesquisa',
'settings.search.engineDisabledLabel': 'Disabled',
'settings.search.engineDisabledDesc':
@@ -1416,7 +1416,7 @@ const messages: TranslationMap = {
'settings.search.engineManagedDesc':
'Padrão. Roteado através do backend do OpenHuman, atualmente com tecnologia Exa: nenhuma chave API é necessária.',
'settings.search.localManagedUnavailable':
- 'A busca gerenciada pela OpenHuman não está disponível para usuários locais. Adicione sua própria chave de API do Parallel, Brave, Querit ou Exa para habilitar a busca na web.',
+ 'A busca gerenciada pela OpenHuman não está disponível para usuários locais. Adicione sua própria chave de API do Parallel, Brave, Querit, Exa ou Tavily para habilitar a busca na web.',
'settings.search.engineParallelLabel': 'Paralelo',
'settings.search.engineParallelDesc':
'Paralelo Direto API: buscar, extrair, conversar, pesquisar, enriquecer, ferramentas de conjunto de dados.',
@@ -1429,6 +1429,9 @@ const messages: TranslationMap = {
'settings.search.engineExaLabel': 'Exa',
'settings.search.engineExaDesc':
'Busca neural com tecnologia Exa. Requer sua própria chave de API do Exa. Adiciona ferramentas de busca, páginas semelhantes e conteúdo de páginas.',
+ 'settings.search.engineTavilyLabel': 'Tavily',
+ 'settings.search.engineTavilyDesc':
+ 'Busca web, notícias e finanças com tecnologia Tavily. Requer sua própria chave de API do Tavily. Adiciona ferramentas de busca e extração de conteúdo de páginas.',
'settings.search.statusConfigured': 'Configurado',
'settings.search.statusNeedsKey': 'Precisa da chave API',
'settings.search.fallbackToManaged':
@@ -1450,6 +1453,8 @@ const messages: TranslationMap = {
'settings.search.placeholderBrave': 'BSA...',
'settings.search.placeholderQuerit': 'Chave Querit API',
'settings.search.placeholderExa': 'Cole sua chave de API do Exa…',
+ 'settings.search.tavilyKeyLabel': 'Chave de API do Tavily',
+ 'settings.search.placeholderTavily': 'tvly-...',
'settings.search.allowedSitesLabel': 'Sites permitidos',
'settings.search.allowedSitesHint':
'Liste, um por linha, os hosts que o assistente pode abrir e ler (via busca na web e ferramenta de navegador), ex.: reuters.com. Um host também cobre seus subdomínios. A busca na web em si não é restringida por esta lista.',
diff --git a/app/src/lib/i18n/ru.ts b/app/src/lib/i18n/ru.ts
index fa1fa050df..0167e5fa73 100644
--- a/app/src/lib/i18n/ru.ts
+++ b/app/src/lib/i18n/ru.ts
@@ -1392,7 +1392,7 @@ const messages: TranslationMap = {
'settings.search.menuDesc':
'По умолчанию используется поиск, управляемый OpenHuman, или подключите собственного провайдера с помощью ключа API.',
'settings.search.description':
- 'Выберите поисковую систему, которую использует агент, или полностью отключите инструменты поиска. Управляемый режим использует серверную часть OpenHuman (настройка не требуется). Parallel, Brave, Querit и Exa работают напрямую с вашего устройства, используя ваш API-ключ.',
+ 'Выберите поисковую систему, которую использует агент, или полностью отключите инструменты поиска. Управляемый режим использует серверную часть OpenHuman (настройка не требуется). Parallel, Brave, Querit, Exa и Tavily работают напрямую с вашего устройства, используя ваш API-ключ.',
'settings.search.engineAria': 'Поисковая система',
'settings.search.engineDisabledLabel': 'Disabled',
'settings.search.engineDisabledDesc':
@@ -1401,7 +1401,7 @@ const messages: TranslationMap = {
'settings.search.engineManagedDesc':
'По умолчанию. Маршрутизируется через серверную часть OpenHuman, сейчас на базе Exa: ключ API не требуется.',
'settings.search.localManagedUnavailable':
- 'Поиск OpenHuman Managed недоступен для локальных пользователей. Добавьте свой ключ API Parallel, Brave, Querit или Exa, чтобы включить веб-поиск.',
+ 'Поиск OpenHuman Managed недоступен для локальных пользователей. Добавьте свой ключ API Parallel, Brave, Querit, Exa или Tavily, чтобы включить веб-поиск.',
'settings.search.engineParallelLabel': 'Параллельно',
'settings.search.engineParallelDesc':
'Direct Parallel API: инструменты поиска, извлечения, общения, исследования, обогащения и набора данных.',
@@ -1414,6 +1414,9 @@ const messages: TranslationMap = {
'settings.search.engineExaLabel': 'Exa',
'settings.search.engineExaDesc':
'Нейропоиск на базе Exa. Требуется ваш собственный ключ API Exa. Добавляет инструменты поиска, похожих страниц и содержимого страниц.',
+ 'settings.search.engineTavilyLabel': 'Tavily',
+ 'settings.search.engineTavilyDesc':
+ 'Веб-, новостной и финансовый поиск на базе Tavily. Требуется ваш собственный ключ API Tavily. Добавляет инструменты поиска и извлечения страниц.',
'settings.search.statusConfigured': 'Настроено',
'settings.search.statusNeedsKey': 'Требуется ключ API',
'settings.search.fallbackToManaged':
@@ -1435,6 +1438,8 @@ const messages: TranslationMap = {
'settings.search.placeholderBrave': 'BSA...',
'settings.search.placeholderQuerit': 'Запросить ключ API',
'settings.search.placeholderExa': 'Вставьте ваш ключ API Exa…',
+ 'settings.search.tavilyKeyLabel': 'Ключ API Tavily',
+ 'settings.search.placeholderTavily': 'tvly-...',
'settings.search.allowedSitesLabel': 'Разрешенные веб-сайты',
'settings.search.allowedSitesHint':
'Хосты, которые ассистент может открывать и читать (через веб-запросы и браузерный инструмент) по одному на строку, например reuters.com. Хост также охватывает все его поддомены. Веб-поиск не ограничивается этим списком.',
diff --git a/app/src/lib/i18n/zh-CN.ts b/app/src/lib/i18n/zh-CN.ts
index 38ccd9bb48..cf01dceafc 100644
--- a/app/src/lib/i18n/zh-CN.ts
+++ b/app/src/lib/i18n/zh-CN.ts
@@ -1294,7 +1294,7 @@ const messages: TranslationMap = {
'settings.search.title': '搜索引擎',
'settings.search.menuDesc': '默认使用 OpenHuman 托管搜索,或用 API 密钥接入你自己的提供商。',
'settings.search.description':
- '选择智能体使用的搜索引擎。托管模式使用 OpenHuman 后端(无需设置)。Parallel、Brave、Querit 和 Exa 会用你的 API 密钥从本机直接调用。',
+ '选择智能体使用的搜索引擎。托管模式使用 OpenHuman 后端(无需设置)。Parallel、Brave、Querit、Exa 和 Tavily 会用你的 API 密钥从本机直接调用。',
'settings.search.engineAria': '搜索引擎',
'settings.search.engineDisabledLabel': 'Disabled',
'settings.search.engineDisabledDesc': '从智能体上下文和可用工具列表中移除搜索工具。',
@@ -1302,7 +1302,7 @@ const messages: TranslationMap = {
'settings.search.engineManagedDesc':
'默认选项。通过 OpenHuman 后端路由,当前由 Exa 提供支持,无需 API 密钥。',
'settings.search.localManagedUnavailable':
- '本地用户无法使用 OpenHuman 托管搜索。请添加你自己的 Parallel、Brave、Querit 或 Exa API 密钥以启用网页搜索。',
+ '本地用户无法使用 OpenHuman 托管搜索。请添加你自己的 Parallel、Brave、Querit、Exa 或 Tavily API 密钥以启用网页搜索。',
'settings.search.engineParallelLabel': 'Parallel',
'settings.search.engineParallelDesc':
'直接调用 Parallel API:搜索、提取、聊天、研究、增强和数据集工具。',
@@ -1314,6 +1314,9 @@ const messages: TranslationMap = {
'settings.search.engineExaLabel': 'Exa',
'settings.search.engineExaDesc':
'由 Exa 提供的神经搜索。需要你自己的 Exa API 密钥。新增搜索、查找相似页面和获取页面内容工具。',
+ 'settings.search.engineTavilyLabel': 'Tavily',
+ 'settings.search.engineTavilyDesc':
+ '由 Tavily 提供支持的网页、新闻和财经搜索。需要你自己的 Tavily API 密钥。新增搜索和网页提取工具。',
'settings.search.statusConfigured': '已配置',
'settings.search.statusNeedsKey': '需要 API 密钥',
'settings.search.fallbackToManaged': '未配置密钥,保存密钥前搜索会回退到托管模式。',
@@ -1334,6 +1337,8 @@ const messages: TranslationMap = {
'settings.search.placeholderBrave': 'BSA...',
'settings.search.placeholderQuerit': 'Querit API 密钥',
'settings.search.placeholderExa': '粘贴你的 Exa API 密钥…',
+ 'settings.search.tavilyKeyLabel': 'Tavily API 密钥',
+ 'settings.search.placeholderTavily': 'tvly-...',
'settings.search.allowedSitesLabel': '允许的网站',
'settings.search.allowedSitesHint':
'助手在研究时可以打开并阅读的网站(每行一个主机,例如 reuters.com)。主机也包含其子域名。留空将阻止所有网页访问。',
diff --git a/app/src/utils/__tests__/toolTimelineFormatting.test.ts b/app/src/utils/__tests__/toolTimelineFormatting.test.ts
index 7b5e3592ba..0de8bb16e9 100644
--- a/app/src/utils/__tests__/toolTimelineFormatting.test.ts
+++ b/app/src/utils/__tests__/toolTimelineFormatting.test.ts
@@ -320,6 +320,7 @@ describe('extractSearchProvider', () => {
expect(extractSearchProvider('Search results for: q (via Exa)\n1. foo')).toBe('Exa');
expect(extractSearchProvider('Search results for: q (via Brave)')).toBe('Brave');
expect(extractSearchProvider('# Search results — `q` (via Querit)')).toBe('Querit');
+ expect(extractSearchProvider('# Search results -- `q` (via Tavily)')).toBe('Tavily');
});
it('returns undefined when there is no marker or no result', () => {
@@ -351,6 +352,7 @@ describe('extractSearchProvider', () => {
it('reads the marker from an empty-result heading', () => {
expect(extractSearchProvider('No results found for: q (via Exa)')).toBe('Exa');
expect(extractSearchProvider('_No results for `q`_ (via Brave)')).toBe('Brave');
+ expect(extractSearchProvider('_No results for `q`_ (via Tavily)')).toBe('Tavily');
});
});
diff --git a/app/src/utils/tauriCommands/config.ts b/app/src/utils/tauriCommands/config.ts
index d5bf2cab21..69d35f0d9a 100644
--- a/app/src/utils/tauriCommands/config.ts
+++ b/app/src/utils/tauriCommands/config.ts
@@ -730,7 +730,14 @@ export async function openhumanGetAnalyticsSettings(): Promise<
});
}
-export type SearchEngineId = 'disabled' | 'managed' | 'parallel' | 'brave' | 'querit' | 'exa';
+export type SearchEngineId =
+ | 'disabled'
+ | 'managed'
+ | 'parallel'
+ | 'brave'
+ | 'querit'
+ | 'exa'
+ | 'tavily';
export interface SearchSettingsUpdate {
engine?: SearchEngineId;
@@ -747,6 +754,11 @@ export interface SearchSettingsUpdate {
* `engine: 'exa'` is selected, search calls go straight to api.exa.ai.
*/
exa_api_key?: string;
+ /**
+ * Tavily API key (BYOK). Empty string clears the stored key. When set and
+ * `engine: 'tavily'` is selected, search calls go straight to api.tavily.com.
+ */
+ tavily_api_key?: string;
/**
* Websites the assistant may open/read (web_fetch / curl). Exact hosts
* match their subdomains; `"*"` allows all public sites; an empty list
@@ -771,6 +783,7 @@ export interface SearchSettings {
brave_configured: boolean;
querit_configured: boolean;
exa_configured: boolean;
+ tavily_configured: boolean;
/** Current allowed-websites host list (may contain `"*"`). */
allowed_domains: string[];
/** True when the allowlist contains the `"*"` wildcard. */
diff --git a/app/src/utils/toolTimelineFormatting.ts b/app/src/utils/toolTimelineFormatting.ts
index e88f53f54e..3a962c485f 100644
--- a/app/src/utils/toolTimelineFormatting.ts
+++ b/app/src/utils/toolTimelineFormatting.ts
@@ -476,7 +476,7 @@ const MAX_SEARCH_PROVIDER_LENGTH = 32;
* Extract the resolved search provider from a completed web-search result.
* Every search engine tags its output with a `(via <Provider>)` marker on the
* heading line (managed resolves to "Exa" by default, or to whatever the
- * backend reports; BYOK engines tag "Brave"/"Querit"/"Seltz"). Reading it back
+ * backend reports; BYOK engines tag "Brave"/"Querit"/"Seltz"/"Tavily"). Reading it back
* keeps the timeline attribution dynamic: it is driven by what actually ran,
* never by a hardcoded provider name (#5136).
*
diff --git a/docs/TEST-COVERAGE-MATRIX.md b/docs/TEST-COVERAGE-MATRIX.md
index 0f5b3f666b..4f0766995a 100644
--- a/docs/TEST-COVERAGE-MATRIX.md
+++ b/docs/TEST-COVERAGE-MATRIX.md
@@ -306,6 +306,7 @@ End-to-end coverage of the agent harness via the web-chat RPC surface against an
| 7.2.2 | Web Search Execution | WD | `skill-execution-flow.spec.ts` | 🟡 | Generic skill path |
| 7.2.3 | TinyFish Integration Tools | RU | `src/openhuman/integrations/tinyfish_tests.rs`, `src/openhuman/tools/ops_tests.rs::all_tools_executes_tinyfish_family_against_fake_backend` | ✅ | Backend-proxied Search, Fetch, and Agent run tools covered with fake backend |
| 7.2.4 | Exa BYOK search (direct API) | RU+RI+VU | `src/openhuman/search/tools/exa_tests.rs`, `src/openhuman/search/registry.rs`, `src/openhuman/config/schema/tools/search.rs`, `tests/config_auth_app_state_connectivity_e2e.rs`, `app/src/components/settings/panels/SearchPanel.test.tsx` (#5137) | ✅ | `exa_search` / `exa_find_similar` / `exa_get_contents` post straight to api.exa.ai against a local stand-in; missing and 401 keys give distinct errors without echoing the response body; keyless Exa falls back to managed; key round-trips through the config RPC, secret encryption, and env overlay; panel asserts the needs-key badge and the exa.ai key link |
+| 7.2.5 | Tavily BYOK search + extract (direct API) | RU+RI+VU | `src/openhuman/search/tools/tavily_tests.rs`, `src/openhuman/search/registry.rs`, `src/openhuman/config/schema/tools/search.rs`, `src/openhuman/config/ops_tests.rs` (`apply_search_settings_stores_and_clears_tavily_key`), `tests/config_auth_app_state_connectivity_e2e.rs`, `app/src/components/settings/panels/SearchPanel.test.tsx`, `app/src/utils/__tests__/toolTimelineFormatting.test.ts` | ✅ | `web_search_tool` / `tavily_search` / `tavily_extract` post straight to api.tavily.com with a Bearer key against a local stand-in; raw content, images, and the LLM answer render in markdown; missing and 401 keys give distinct errors without echoing the response body; batches over 20 URLs and keyless Tavily are rejected/fall back to managed; the `(via Tavily)` timeline marker is pinned; the panel asserts the needs-key badge and the tavily.com key link |
---
diff --git a/gitbooks/features/native-tools/README.md b/gitbooks/features/native-tools/README.md
index 3a2de9476c..00a744fb6f 100644
--- a/gitbooks/features/native-tools/README.md
+++ b/gitbooks/features/native-tools/README.md
@@ -25,7 +25,7 @@ A plugin-only model means tools live in different processes, behind RPC, with th
| Family | What it covers |
| ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
-| [Web Search](web-search.md) | Search the live web via the managed proxy (powered by Exa), backend-proxied Parallel, your own Exa/Brave/Querit key, or self-hosted SearXNG. |
+| [Web Search](web-search.md) | Search the live web via the managed proxy (powered by Exa), backend-proxied Parallel, your own Exa/Brave/Querit/Tavily key, or self-hosted SearXNG. |
| [Web Scraper](web-scraper.md) | Pull clean text out of any URL - articles, docs, READMEs. |
| [Coder](coder.md) | Read/write/edit/patch files, glob, grep, git, lint, test. |
| [Browser & Computer Control](browser-and-computer.md) | Open URLs, inspect DOM snapshots, click, type, move the mouse. |
diff --git a/gitbooks/features/native-tools/web-search.md b/gitbooks/features/native-tools/web-search.md
index ac65e52420..527bf606a7 100644
--- a/gitbooks/features/native-tools/web-search.md
+++ b/gitbooks/features/native-tools/web-search.md
@@ -23,6 +23,7 @@ Pick the engine under **Connections → Search**. Exactly one engine is active a
| ------------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **OpenHuman Managed** (default) | Not needed | The OpenHuman backend, currently powered by [Exa](https://exa.ai). |
| **Exa** | Your API key | Straight to `https://api.exa.ai` with your key. |
+| **Tavily** | Your API key | Straight to `https://api.tavily.com` with your key (web / news / finance search + page extraction). |
| **Parallel** | Local enablement value | Parallel-specific tools go through the OpenHuman backend to Parallel; the canonical `web_search_tool` keeps using the backend-resolved managed provider (currently Exa). The value selects the engine locally and is not sent to Parallel for authentication or billing. |
| **Brave** | Your API key | Straight to the Brave Search API with your key. |
| **Querit** | Your API key | Straight to the Querit API with your key. |
@@ -66,6 +67,35 @@ EXA_API_KEY=your-exa-api-key
`OPENHUMAN_EXA_API_KEY` and `EXA_API_KEY` both override `search.exa.api_key`; treat environment-provided keys as sensitive secrets.
+### Tavily (bring your own key)
+
+Prefer to run search on your own [Tavily](https://tavily.com) account? Grab a key from [tavily.com](https://tavily.com) and paste it under **Connections → Search → Tavily**. Calls then go straight from your machine to `https://api.tavily.com` with your key and never touch the managed backend. When secret encryption is enabled, OpenHuman stores the key as ciphertext in `config.toml`; the OS keyring protects the master encryption key, not the Tavily key itself.
+
+Choosing Tavily registers Tavily's search + extract family for the agent, on top of the usual `web_search_tool`:
+
+- `tavily_search` - web, news, and finance results with titles, URLs, and snippets. Supports search-depth levels (`basic`/`advanced`/`fast`/`ultra-fast`), a publish/update `time_range` or explicit `start_date`/`end_date`, domain include/exclude filters, an optional LLM-generated `answer`, bounded cleaned page content, and image links.
+- `tavily_extract` - cleaned content from one or more URLs, in markdown or plain text, for deep-reading sources the agent found. Agent output is bounded to 8,000 characters per URL.
+
+You can also select it from `config.toml`:
+
+```toml
+[search]
+engine = "tavily"
+
+[search.tavily]
+api_key = "tvly-your-tavily-api-key"
+```
+
+Or via environment:
+
+```bash
+OPENHUMAN_SEARCH_ENGINE=tavily
+TAVILY_API_KEY=tvly-your-tavily-api-key
+# OPENHUMAN_TAVILY_API_KEY is accepted as well
+```
+
+`OPENHUMAN_TAVILY_API_KEY` and `TAVILY_API_KEY` both override `search.tavily.api_key`. Do not commit a plaintext API key.
+
## Self-hosted SearXNG
SearXNG search is opt-in and exposed through the `openhuman.tools_searxng_search` RPC controller and MCP catalog; it is not registered as an agent tool. The controller calls your configured SearXNG `/search?format=json` endpoint and returns normalized `{ title, url, snippet, source }` results.
diff --git a/gitbooks/features/privacy-and-security.md b/gitbooks/features/privacy-and-security.md
index 9fd73e5332..5fd767436c 100644
--- a/gitbooks/features/privacy-and-security.md
+++ b/gitbooks/features/privacy-and-security.md
@@ -36,7 +36,7 @@ OpenHuman is designed so that the **memory of your life lives on your machine**.
| | |
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **LLM calls** | Proxied through the backend under one subscription, then forwarded to the underlying provider (Anthropic / OpenAI / Google / etc.) per the [model router](model-routing/). |
-| **Web search proxy** | The native [web search tool](native-tools/web-search.md) uses the backend proxy by default, currently powered by [Exa](https://exa.ai), so you don't carry a search API key. With your own Exa, Brave, or Querit key, queries go directly to that provider; Parallel remains routed through the OpenHuman backend. If you call the optional SearXNG tool, that query goes to your configured SearXNG instance instead. |
+| **Web search proxy** | The native [web search tool](native-tools/web-search.md) uses the backend proxy by default, currently powered by [Exa](https://exa.ai), so you don't carry a search API key. With your own Exa, Brave, Querit, or Tavily key, queries go directly to that provider; Parallel remains routed through the OpenHuman backend. If you call the optional SearXNG tool, that query goes to your configured SearXNG instance instead. |
| **Integration OAuth & tool proxy** | Token storage and rate-limited request brokering for [118+ integrations](integrations/README.md). |
| **TTS streaming** | Hosted [text-to-speech](native-tools/voice.md) audio streams. Audio is generated and discarded - not retained. |
diff --git a/src/openhuman/config/mod.rs b/src/openhuman/config/mod.rs
index 485e6b088a..c75c0e00b0 100644
--- a/src/openhuman/config/mod.rs
+++ b/src/openhuman/config/mod.rs
@@ -57,7 +57,7 @@ pub use schema::{
MODEL_AGENTIC_V1, MODEL_BURST_V1, MODEL_CHAT_V1, MODEL_CODING_V1, MODEL_REASONING_QUICK_V1,
MODEL_REASONING_V1, MODEL_SUMMARIZATION_V1, MODEL_VISION_V1, SEARCH_ENGINE_BRAVE,
SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL,
- SEARCH_ENGINE_QUERIT,
+ SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY,
};
// Kept as a separate re-export (issue #4117) so the large alphabetized group
// above stays byte-identical and rustfmt-stable.
diff --git a/src/openhuman/config/ops/ui.rs b/src/openhuman/config/ops/ui.rs
index 87b8895b99..d5951c117b 100644
--- a/src/openhuman/config/ops/ui.rs
+++ b/src/openhuman/config/ops/ui.rs
@@ -21,7 +21,8 @@ pub struct AnalyticsSettingsPatch {
#[derive(Debug, Clone, Default)]
pub struct SearchSettingsPatch {
- /// One of `disabled` | `managed` | `parallel` | `brave` | `querit` | `exa`.
+ /// One of `disabled` | `managed` | `parallel` | `brave` | `querit` |
+ /// `exa` | `tavily`.
/// Empty/unknown values are rejected by `apply_search_settings`.
/// Runtime fallback to `managed` applies only to persisted/legacy config
/// values resolved by `SearchConfig::effective_engine()`.
@@ -38,6 +39,8 @@ pub struct SearchSettingsPatch {
pub querit_api_key: Option<String>,
/// Exa API key (BYOK). An empty string clears the stored key.
pub exa_api_key: Option<String>,
+ /// Tavily API key (BYOK). An empty string clears the stored key.
+ pub tavily_api_key: Option<String>,
/// Websites the assistant may open/read (`web_fetch` / `curl`), as a
/// host allowlist. Entries are exact hosts (`reuters.com`), which also
/// match their subdomains, or `"*"` for all public sites. Empty list
@@ -161,12 +164,12 @@ pub async fn apply_search_settings(
if let Some(engine) = update.engine {
let trimmed = engine.trim();
match trimmed {
- "disabled" | "managed" | "parallel" | "brave" | "querit" | "exa" => {
+ "disabled" | "managed" | "parallel" | "brave" | "querit" | "exa" | "tavily" => {
config.search.engine = trimmed.to_string();
}
other => {
return Err(format!(
- "engine must be one of disabled/managed/parallel/brave/querit/exa (got {other:?})"
+ "engine must be one of disabled/managed/parallel/brave/querit/exa/tavily (got {other:?})"
));
}
}
@@ -217,6 +220,14 @@ pub async fn apply_search_settings(
Some(trimmed.to_string())
};
}
+ if let Some(raw) = update.tavily_api_key {
+ let trimmed = raw.trim();
+ config.search.tavily.api_key = if trimmed.is_empty() {
+ None
+ } else {
+ Some(trimmed.to_string())
+ };
+ }
let allowlist_touched = update.allowed_domains.is_some() || update.allow_all.is_some();
let before_count = config.http_request.allowed_domains.len();
let before_allow_all = config.http_request.allowed_domains.iter().any(|d| d == "*");
@@ -280,6 +291,7 @@ pub async fn get_search_settings() -> Result<RpcOutcome<serde_json::Value>, Stri
crate::openhuman::config::SearchEngine::Brave => "brave",
crate::openhuman::config::SearchEngine::Querit => "querit",
crate::openhuman::config::SearchEngine::Exa => "exa",
+ crate::openhuman::config::SearchEngine::Tavily => "tavily",
},
"max_results": config.search.max_results,
"timeout_secs": config.search.timeout_secs,
@@ -287,6 +299,7 @@ pub async fn get_search_settings() -> Result<RpcOutcome<serde_json::Value>, Stri
"brave_configured": config.search.brave.has_key(),
"querit_configured": config.search.querit.has_key(),
"exa_configured": config.search.exa.has_key(),
+ "tavily_configured": config.search.tavily.has_key(),
"allowed_domains": config.http_request.allowed_domains,
"allow_all": config.http_request.allowed_domains.iter().any(|d| d == "*"),
});
diff --git a/src/openhuman/config/ops_tests_part_01_tests.rs b/src/openhuman/config/ops_tests_part_01_tests.rs
index 653a84c0a7..e61bf39f28 100644
--- a/src/openhuman/config/ops_tests_part_01_tests.rs
+++ b/src/openhuman/config/ops_tests_part_01_tests.rs
@@ -608,6 +608,46 @@ async fn apply_search_settings_accepts_disabled_engine() {
);
}
+#[tokio::test]
+async fn apply_search_settings_stores_and_clears_tavily_key() {
+ let tmp = tempdir().unwrap();
+ let mut cfg = tmp_config(&tmp);
+
+ apply_search_settings(
+ &mut cfg,
+ SearchSettingsPatch {
+ engine: Some("tavily".to_string()),
+ tavily_api_key: Some(" tvly-test-key ".to_string()),
+ ..Default::default()
+ },
+ )
+ .await
+ .expect("save Tavily settings");
+
+ assert_eq!(cfg.search.engine, "tavily");
+ assert_eq!(cfg.search.tavily.api_key.as_deref(), Some("tvly-test-key"));
+ assert_eq!(
+ cfg.search.effective_engine(),
+ crate::openhuman::config::SearchEngine::Tavily
+ );
+
+ apply_search_settings(
+ &mut cfg,
+ SearchSettingsPatch {
+ tavily_api_key: Some(" ".to_string()),
+ ..Default::default()
+ },
+ )
+ .await
+ .expect("clear Tavily key");
+
+ assert!(cfg.search.tavily.api_key.is_none());
+ assert_eq!(
+ cfg.search.effective_engine(),
+ crate::openhuman::config::SearchEngine::Managed
+ );
+}
+
#[tokio::test]
async fn apply_search_settings_rejects_unknown_search_engine() {
let tmp = tempdir().unwrap();
@@ -623,5 +663,5 @@ async fn apply_search_settings_rejects_unknown_search_engine() {
.await
.expect_err("unknown engine should be rejected");
- assert!(err.contains("disabled/managed/parallel/brave/querit/exa"));
+ assert!(err.contains("disabled/managed/parallel/brave/querit/exa/tavily"));
}
diff --git a/src/openhuman/config/schema/load/env_overlay_impl_01_part_01.rs b/src/openhuman/config/schema/load/env_overlay_impl_01_part_01.rs
index 5b9c17f72d..9aedb80a84 100644
--- a/src/openhuman/config/schema/load/env_overlay_impl_01_part_01.rs
+++ b/src/openhuman/config/schema/load/env_overlay_impl_01_part_01.rs
@@ -243,6 +243,11 @@ impl Config {
self.search.exa.api_key = Some(key);
}
}
+ if let Some(key) = env.get_any(&["OPENHUMAN_TAVILY_API_KEY", "TAVILY_API_KEY"]) {
+ if !key.trim().is_empty() {
+ self.search.tavily.api_key = Some(key);
+ }
+ }
if let Some(max) = env.get_any(&["OPENHUMAN_SEARCH_MAX_RESULTS", "SEARCH_MAX_RESULTS"]) {
if let Ok(n) = max.parse::<usize>() {
if (1..=20).contains(&n) {
diff --git a/src/openhuman/config/schema/load/secrets.rs b/src/openhuman/config/schema/load/secrets.rs
index ebe36f68d7..99e43068d3 100644
--- a/src/openhuman/config/schema/load/secrets.rs
+++ b/src/openhuman/config/schema/load/secrets.rs
@@ -118,6 +118,11 @@ pub(super) fn decrypt_config_secrets(config: &mut Config, openhuman_dir: &Path)
"search.querit.api_key",
)?;
decrypt_optional_secret(&store, &mut config.search.exa.api_key, "search.exa.api_key")?;
+ decrypt_optional_secret(
+ &store,
+ &mut config.search.tavily.api_key,
+ "search.tavily.api_key",
+ )?;
let ch = &mut config.channels_config;
if let Some(ref mut tg) = ch.telegram {
@@ -222,6 +227,11 @@ pub(super) fn encrypt_config_secrets(config: &mut Config) -> Result<()> {
"search.querit.api_key",
)?;
encrypt_optional_secret(&store, &mut config.search.exa.api_key, "search.exa.api_key")?;
+ encrypt_optional_secret(
+ &store,
+ &mut config.search.tavily.api_key,
+ "search.tavily.api_key",
+ )?;
let ch = &mut config.channels_config;
if let Some(ref mut tg) = ch.telegram {
diff --git a/src/openhuman/config/schema/load_tests_part_02_tests.rs b/src/openhuman/config/schema/load_tests_part_02_tests.rs
index 17dcc64193..054ae3d8ae 100644
--- a/src/openhuman/config/schema/load_tests_part_02_tests.rs
+++ b/src/openhuman/config/schema/load_tests_part_02_tests.rs
@@ -246,6 +246,28 @@ fn env_overlay_web_search_limits_validated() {
assert_eq!(cfg.web_search.max_results, 4);
}
+#[test]
+fn env_overlay_tavily_api_key_supports_alias_precedence_and_ignores_blank_values() {
+ let mut cfg = Config::default();
+
+ cfg.apply_env_overlay_with(&HashMapEnv::new().with("TAVILY_API_KEY", "alias-key"));
+ assert_eq!(cfg.search.tavily.api_key.as_deref(), Some("alias-key"));
+
+ cfg.apply_env_overlay_with(
+ &HashMapEnv::new()
+ .with("TAVILY_API_KEY", "lower-priority-key")
+ .with("OPENHUMAN_TAVILY_API_KEY", "namespaced-key"),
+ );
+ assert_eq!(cfg.search.tavily.api_key.as_deref(), Some("namespaced-key"));
+
+ cfg.apply_env_overlay_with(&HashMapEnv::new().with("OPENHUMAN_TAVILY_API_KEY", " "));
+ assert_eq!(
+ cfg.search.tavily.api_key.as_deref(),
+ Some("namespaced-key"),
+ "a blank override must not clear the configured key"
+ );
+}
+
#[test]
fn env_overlay_searxng_config_validated() {
let mut cfg = Config::default();
diff --git a/src/openhuman/config/schema/mod.rs b/src/openhuman/config/schema/mod.rs
index b15220ac7f..2a21136993 100644
--- a/src/openhuman/config/schema/mod.rs
+++ b/src/openhuman/config/schema/mod.rs
@@ -117,7 +117,7 @@ pub use tools::{
MultimodalFileConfig, SearchConfig, SearchEngine, SearchEngineCredentials, SearxngConfig,
SecretsConfig, SeltzConfig, WebSearchConfig, COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT,
SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED,
- SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT,
+ SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY,
};
pub use update::{UpdateConfig, UpdateRestartStrategy};
mod voice_server;
diff --git a/src/openhuman/config/schema/tools/mod.rs b/src/openhuman/config/schema/tools/mod.rs
index 093458afd0..65cd794298 100644
--- a/src/openhuman/config/schema/tools/mod.rs
+++ b/src/openhuman/config/schema/tools/mod.rs
@@ -21,5 +21,5 @@ pub use multimodal::{MultimodalConfig, MultimodalFileConfig};
pub use search::{
SearchConfig, SearchEngine, SearchEngineCredentials, SearxngConfig, SeltzConfig,
WebSearchConfig, SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA,
- SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT,
+ SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY,
};
diff --git a/src/openhuman/config/schema/tools/search.rs b/src/openhuman/config/schema/tools/search.rs
index edc374180f..3e83b5dd5a 100644
--- a/src/openhuman/config/schema/tools/search.rs
+++ b/src/openhuman/config/schema/tools/search.rs
@@ -126,7 +126,8 @@ impl Default for WebSearchConfig {
// backend-proxied `web_search`; `parallel` → direct Parallel API tools
// (search/extract/chat/research/enrich/dataset); `brave` → direct Brave Search
// tools (web/news/images/videos); `querit` → direct Querit web search;
-// `exa` → direct Exa neural search (search / find similar / contents).
+// `exa` → direct Exa neural search (search / find similar / contents);
+// `tavily` → direct Tavily Search + Extract (web / news / finance).
pub const SEARCH_ENGINE_DISABLED: &str = "disabled";
pub const SEARCH_ENGINE_MANAGED: &str = "managed";
@@ -134,6 +135,7 @@ pub const SEARCH_ENGINE_PARALLEL: &str = "parallel";
pub const SEARCH_ENGINE_BRAVE: &str = "brave";
pub const SEARCH_ENGINE_QUERIT: &str = "querit";
pub const SEARCH_ENGINE_EXA: &str = "exa";
+pub const SEARCH_ENGINE_TAVILY: &str = "tavily";
fn default_search_engine() -> String {
SEARCH_ENGINE_MANAGED.into()
@@ -179,17 +181,17 @@ impl SearchEngineCredentials {
/// Unified search-engine configuration. Exactly one engine drives tool
/// registration at a time. `disabled` suppresses all search tools; `managed` is
-/// the backend-proxied default and requires no key; `parallel`, `brave`, and
-/// `querit` are BYO and require their own API key in the matching sub-block.
-/// `exa` is BYO too and routes directly to the Exa API.
+/// the backend-proxied default and requires no key; `parallel`, `brave`,
+/// `querit`, `exa`, and `tavily` are BYO and require their own API key in the
+/// matching sub-block.
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[serde(default)]
pub struct SearchConfig {
/// Active search engine. One of [`SEARCH_ENGINE_DISABLED`],
/// [`SEARCH_ENGINE_MANAGED`], [`SEARCH_ENGINE_PARALLEL`],
- /// [`SEARCH_ENGINE_BRAVE`], [`SEARCH_ENGINE_QUERIT`], or
- /// [`SEARCH_ENGINE_EXA`]. Unknown values fall back to managed at
- /// registration time.
+ /// [`SEARCH_ENGINE_BRAVE`], [`SEARCH_ENGINE_QUERIT`],
+ /// [`SEARCH_ENGINE_EXA`], or [`SEARCH_ENGINE_TAVILY`]. Unknown values fall
+ /// back to managed at registration time.
#[serde(default = "default_search_engine")]
pub engine: String,
@@ -217,6 +219,12 @@ pub struct SearchConfig {
/// straight to `https://api.exa.ai`, never through the managed backend.
#[serde(default)]
pub exa: SearchEngineCredentials,
+
+ /// Tavily credentials (used when `engine = "tavily"`). BYOK: search and
+ /// extract calls go straight to `https://api.tavily.com`, never through
+ /// the managed backend.
+ #[serde(default)]
+ pub tavily: SearchEngineCredentials,
}
impl Default for SearchConfig {
@@ -229,6 +237,7 @@ impl Default for SearchConfig {
brave: SearchEngineCredentials::default(),
querit: SearchEngineCredentials::default(),
exa: SearchEngineCredentials::default(),
+ tavily: SearchEngineCredentials::default(),
}
}
}
@@ -244,6 +253,7 @@ pub enum SearchEngine {
Brave,
Querit,
Exa,
+ Tavily,
}
impl SearchConfig {
@@ -258,6 +268,7 @@ impl SearchConfig {
SEARCH_ENGINE_BRAVE if self.brave.has_key() => SearchEngine::Brave,
SEARCH_ENGINE_QUERIT if self.querit.has_key() => SearchEngine::Querit,
SEARCH_ENGINE_EXA if self.exa.has_key() => SearchEngine::Exa,
+ SEARCH_ENGINE_TAVILY if self.tavily.has_key() => SearchEngine::Tavily,
_ => SearchEngine::Managed,
}
}
diff --git a/src/openhuman/config/schema/tools/search_search_config_tests_tests.rs b/src/openhuman/config/schema/tools/search_search_config_tests_tests.rs
index ec5146be48..8e8a29b630 100644
--- a/src/openhuman/config/schema/tools/search_search_config_tests_tests.rs
+++ b/src/openhuman/config/schema/tools/search_search_config_tests_tests.rs
@@ -72,6 +72,27 @@ fn exa_key_does_not_disturb_the_managed_default() {
assert_eq!(cfg.effective_engine(), SearchEngine::Managed);
}
+#[test]
+fn tavily_requires_key() {
+ let mut cfg = SearchConfig {
+ engine: SEARCH_ENGINE_TAVILY.into(),
+ ..Default::default()
+ };
+ assert_eq!(cfg.effective_engine(), SearchEngine::Managed);
+ cfg.tavily.api_key = Some(" ".into());
+ assert_eq!(cfg.effective_engine(), SearchEngine::Managed);
+ cfg.tavily.api_key = Some("real".into());
+ assert_eq!(cfg.effective_engine(), SearchEngine::Tavily);
+}
+
+#[test]
+fn tavily_key_does_not_disturb_the_managed_default() {
+ // BYOK Tavily must be opt-in: a stored key alone never flips the engine.
+ let mut cfg = SearchConfig::default();
+ cfg.tavily.api_key = Some("real".into());
+ assert_eq!(cfg.effective_engine(), SearchEngine::Managed);
+}
+
#[test]
fn http_request_defaults_to_allow_all() {
// Web research works out of the box: the default allowlist is the
diff --git a/src/openhuman/config/schemas/controllers_part_02.rs b/src/openhuman/config/schemas/controllers_part_02.rs
index 0031b3b82d..50fa42fc1c 100644
--- a/src/openhuman/config/schemas/controllers_part_02.rs
+++ b/src/openhuman/config/schemas/controllers_part_02.rs
@@ -130,6 +130,7 @@ fn handle_update_search_settings(params: Map<String, Value>) -> ControllerFuture
brave_api_key: update.brave_api_key,
querit_api_key: update.querit_api_key,
exa_api_key: update.exa_api_key,
+ tavily_api_key: update.tavily_api_key,
allowed_domains: update.allowed_domains,
allow_all: update.allow_all,
};
diff --git a/src/openhuman/config/schemas/helpers.rs b/src/openhuman/config/schemas/helpers.rs
index 301b73cc80..25675776df 100644
--- a/src/openhuman/config/schemas/helpers.rs
+++ b/src/openhuman/config/schemas/helpers.rs
@@ -111,6 +111,7 @@ pub(super) struct SearchSettingsUpdate {
pub(super) brave_api_key: Option<String>,
pub(super) querit_api_key: Option<String>,
pub(super) exa_api_key: Option<String>,
+ pub(super) tavily_api_key: Option<String>,
pub(super) allowed_domains: Option<Vec<String>>,
pub(super) allow_all: Option<bool>,
}
diff --git a/src/openhuman/config/schemas/schemas_schema_part_01.rs b/src/openhuman/config/schemas/schemas_schema_part_01.rs
index 52e150bcc2..ce4d9093ed 100644
--- a/src/openhuman/config/schemas/schemas_schema_part_01.rs
+++ b/src/openhuman/config/schemas/schemas_schema_part_01.rs
@@ -410,7 +410,7 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {
inputs: vec![
optional_string(
"engine",
- "Active engine: disabled | managed | parallel | brave | querit | exa.",
+ "Active engine: disabled | managed | parallel | brave | querit | exa | tavily.",
),
FieldSchema {
name: "max_results",
@@ -440,6 +440,10 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {
"exa_api_key",
"Exa API key (empty string clears the stored key).",
),
+ optional_string(
+ "tavily_api_key",
+ "Tavily API key (empty string clears the stored key).",
+ ),
FieldSchema {
name: "allowed_domains",
ty: TypeSchema::Option(Box::new(TypeSchema::Array(Box::new(
diff --git a/src/openhuman/search/README.md b/src/openhuman/search/README.md
index 821986b1da..00f80d3cd1 100644
--- a/src/openhuman/search/README.md
+++ b/src/openhuman/search/README.md
@@ -5,8 +5,8 @@ Top-level home for web search selection and agent-facing search tool registratio
## Shape
- `registry.rs` builds the active search tool surface from `Config.search`.
-- `engines/` contains one file per search engine (`managed`, `parallel`, `brave`, `querit`, `exa`, and `disabled`) so provider-specific registration stays isolated.
-- `tools/` contains all search-owned agent tools: `WebSearchTool`, Parallel, Brave, Querit, Exa, SearXNG, Seltz, and TinyFish.
+- `engines/` contains one file per search engine (`managed`, `parallel`, `brave`, `querit`, `exa`, `tavily`, and `disabled`) so provider-specific registration stays isolated.
+- `tools/` contains all search-owned agent tools: `WebSearchTool`, Parallel, Brave, Querit, Exa, Tavily, SearXNG, Seltz, and TinyFish.
- Search tools may use the shared `IntegrationClient` for backend-proxied requests, but their implementations live in this module.
## Engine Behavior
@@ -19,6 +19,7 @@ Top-level home for web search selection and agent-facing search tool registratio
- `brave` — register Brave web/news/image/video search when configured.
- `querit` — register Querit search plus `web_search_tool` when configured.
- `exa` — BYOK: register `exa_search`, `exa_find_similar`, `exa_get_contents` plus `web_search_tool` when configured. Calls go directly to `https://api.exa.ai` with the user's own key, never through the managed backend.
+- `tavily` — BYOK: register `tavily_search` (web/news/finance, search depth, time-range/date filters, domain include/exclude) and `tavily_extract` plus `web_search_tool` when configured. Calls go directly to `https://api.tavily.com` with the user's own key, never through the managed backend.
A BYO engine with no key configured falls back to the managed surface, so `managed` stays the effective default until a key is saved.
diff --git a/src/openhuman/search/engines/mod.rs b/src/openhuman/search/engines/mod.rs
index a6bb819442..b437263eb9 100644
--- a/src/openhuman/search/engines/mod.rs
+++ b/src/openhuman/search/engines/mod.rs
@@ -4,3 +4,4 @@ pub(crate) mod exa;
pub(crate) mod managed;
pub(crate) mod parallel;
pub(crate) mod querit;
+pub(crate) mod tavily;
diff --git a/src/openhuman/search/engines/tavily.rs b/src/openhuman/search/engines/tavily.rs
new file mode 100644
index 0000000000..985df8b4ee
--- /dev/null
+++ b/src/openhuman/search/engines/tavily.rs
@@ -0,0 +1,33 @@
+use crate::openhuman::config::Config;
+use crate::openhuman::search::registry::SearchToolParams;
+use crate::openhuman::tools::Tool;
+
+/// Tavily BYOK: every tool here calls `https://api.tavily.com` directly with the
+/// user's own key. Nothing in this surface routes through the managed backend.
+pub(crate) fn build(root_config: &Config, params: SearchToolParams) -> Vec<Box<dyn Tool>> {
+ tracing::debug!("[search] active engine = tavily (BYO direct API)");
+
+ let api_key = root_config.search.tavily.api_key.clone();
+ vec![
+ Box::new(
+ crate::openhuman::search::tools::TavilySearchTool::new_web_search_tool(
+ api_key.clone(),
+ None,
+ params.max_results,
+ params.timeout_secs,
+ ),
+ ),
+ Box::new(crate::openhuman::search::tools::TavilySearchTool::new(
+ api_key.clone(),
+ None,
+ params.max_results,
+ params.timeout_secs,
+ )),
+ Box::new(crate::openhuman::search::tools::TavilyExtractTool::new(
+ api_key,
+ None,
+ params.max_results,
+ params.timeout_secs,
+ )),
+ ]
+}
diff --git a/src/openhuman/search/registry.rs b/src/openhuman/search/registry.rs
index 5cdc6c99a8..754f29eb10 100644
--- a/src/openhuman/search/registry.rs
+++ b/src/openhuman/search/registry.rs
@@ -31,6 +31,7 @@ pub fn build_search_tools(root_config: &Config) -> Vec<Box<dyn Tool>> {
SearchEngine::Brave => engines::brave::build(root_config, params),
SearchEngine::Querit => engines::querit::build(root_config, params),
SearchEngine::Exa => engines::exa::build(root_config, params),
+ SearchEngine::Tavily => engines::tavily::build(root_config, params),
};
if engine != SearchEngine::Disabled {
diff --git a/src/openhuman/search/registry_tests.rs b/src/openhuman/search/registry_tests.rs
index ab4f4137a0..9aa7b55326 100644
--- a/src/openhuman/search/registry_tests.rs
+++ b/src/openhuman/search/registry_tests.rs
@@ -71,3 +71,29 @@ fn brave_engine_registers_brave_search_family() {
]
);
}
+
+#[test]
+fn tavily_engine_registers_the_byok_tavily_family() {
+ let mut cfg = Config::default();
+ cfg.search.engine = "tavily".to_string();
+ cfg.search.tavily.api_key = Some("test-key".to_string());
+
+ let tools = super::build_search_tools(&cfg);
+ let names = tools.iter().map(|tool| tool.name()).collect::<Vec<_>>();
+
+ assert_eq!(
+ names,
+ vec!["web_search_tool", "tavily_search", "tavily_extract"]
+ );
+}
+
+#[test]
+fn tavily_without_a_key_falls_back_to_the_managed_surface() {
+ let mut cfg = Config::default();
+ cfg.search.engine = "tavily".to_string();
+
+ let tools = super::build_search_tools(&cfg);
+ let names = tools.iter().map(|tool| tool.name()).collect::<Vec<_>>();
+
+ assert_eq!(names, vec!["web_search_tool"]);
+}
diff --git a/src/openhuman/search/tools/mod.rs b/src/openhuman/search/tools/mod.rs
index 6587e66df6..ea6f20d3c0 100644
--- a/src/openhuman/search/tools/mod.rs
+++ b/src/openhuman/search/tools/mod.rs
@@ -4,6 +4,7 @@ mod parallel;
mod querit;
mod searxng;
mod seltz;
+mod tavily;
mod tinyfish;
mod web_search;
@@ -23,6 +24,10 @@ pub use searxng::{
MAX_RESULTS as SEARXNG_MAX_RESULTS,
};
pub use seltz::SeltzSearchTool;
+pub use tavily::{
+ TavilyExtractResponse, TavilyExtractResult, TavilyExtractTool, TavilyImage, TavilyResultItem,
+ TavilySearchResponse, TavilySearchTool,
+};
pub use tinyfish::{TinyFishAgentRunTool, TinyFishFetchTool, TinyFishSearchTool};
pub use web_search::WebSearchTool;
// Crate-internal: the `tools.web_search` RPC reuses the same provider
diff --git a/src/openhuman/search/tools/tavily.rs b/src/openhuman/search/tools/tavily.rs
new file mode 100644
index 0000000000..4a93dd5b0c
--- /dev/null
+++ b/src/openhuman/search/tools/tavily.rs
@@ -0,0 +1,874 @@
+//! Tavily Search + Extract integration — direct API (BYOK, not backend-proxied).
+//!
+//! **Scope**: Agent + CLI/RPC.
+//!
+//! **Endpoints**: `POST https://api.tavily.com/search`,
+//! `POST https://api.tavily.com/extract`.
+//!
+//! **Auth**: `Authorization: Bearer <api key>`.
+//!
+//! When the user selects `tavily` as their search engine and has saved their own
+//! Tavily API key, every call in this family goes straight from the desktop
+//! client to `api.tavily.com` — the OpenHuman managed backend is never
+//! involved. The managed (`engine = "managed"`) path is untouched by this module.
+
+use crate::openhuman::tools::traits::{Tool, ToolCallOptions, ToolResult};
+use async_trait::async_trait;
+use serde::{Deserialize, Serialize};
+use serde_json::{json, Value};
+use std::time::Duration;
+
+const DEFAULT_API_URL: &str = "https://api.tavily.com";
+const SEARCH_EXCERPT_MAX_CHARS: usize = 500;
+const SEARCH_RAW_CONTENT_MAX_CHARS: usize = 8_000;
+const MAX_QUERY_IMAGES: usize = 10;
+const MAX_IMAGES_PER_RESULT: usize = 3;
+const IMAGE_DESCRIPTION_MAX_CHARS: usize = 300;
+
+/// Tavily may return image entries as a bare URL or as an object with an
+/// optional description, depending on the endpoint options and API version.
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(untagged)]
+pub enum TavilyImage {
+ Url(String),
+ Detailed {
+ #[serde(default)]
+ url: String,
+ #[serde(default)]
+ description: Option<String>,
+ },
+}
+
+impl TavilyImage {
+ fn url(&self) -> &str {
+ match self {
+ Self::Url(url) | Self::Detailed { url, .. } => url,
+ }
+ }
+
+ fn description(&self) -> Option<String> {
+ let description = match self {
+ Self::Url(_) => None,
+ Self::Detailed { description, .. } => non_empty(description.as_deref()),
+ }?;
+ let single_line = description.replace(['\r', '\n'], " ");
+ Some(crate::openhuman::util::truncate_with_ellipsis(
+ &single_line,
+ IMAGE_DESCRIPTION_MAX_CHARS,
+ ))
+ }
+}
+
+/// One Tavily search result, shared by `/search`.
+#[derive(Debug, Clone, Default, Deserialize, Serialize)]
+pub struct TavilyResultItem {
+ #[serde(default)]
+ pub title: Option<String>,
+ #[serde(default)]
+ pub url: String,
+ #[serde(default)]
+ pub content: Option<String>,
+ #[serde(default)]
+ pub score: Option<f64>,
+ #[serde(default, rename = "raw_content")]
+ pub raw_content: Option<String>,
+ #[serde(default)]
+ pub images: Vec<TavilyImage>,
+}
+
+impl TavilyResultItem {
+ /// Best available excerpt: the chunked `content` first, then the full
+ /// cleaned page (`raw_content`), only present when `include_raw_content`
+ /// was requested.
+ fn excerpt(&self) -> Option<String> {
+ non_empty(self.content.as_deref()).or_else(|| non_empty(self.raw_content.as_deref()))
+ }
+
+ fn display_title(&self) -> &str {
+ self.title
+ .as_deref()
+ .map(str::trim)
+ .filter(|t| !t.is_empty())
+ .unwrap_or("Untitled")
+ }
+}
+
+#[derive(Debug, Default, Deserialize, Serialize)]
+pub struct TavilySearchResponse {
+ #[serde(default)]
+ pub query: Option<String>,
+ #[serde(default)]
+ pub answer: Option<String>,
+ #[serde(default)]
+ pub images: Vec<TavilyImage>,
+ #[serde(default)]
+ pub results: Vec<TavilyResultItem>,
+}
+
+/// One URL's extracted content from `/extract`.
+#[derive(Debug, Clone, Default, Deserialize, Serialize)]
+pub struct TavilyExtractResult {
+ #[serde(default)]
+ pub url: String,
+ #[serde(default, rename = "raw_content")]
+ pub raw_content: Option<String>,
+}
+
+#[derive(Debug, Default, Deserialize, Serialize)]
+pub struct TavilyExtractResponse {
+ #[serde(default)]
+ pub results: Vec<TavilyExtractResult>,
+ #[serde(default, rename = "failed_results")]
+ pub failed_results: Vec<TavilyExtractFailure>,
+}
+
+/// A URL Tavily could not process. Errors are rendered but never attributed to
+/// a template — the `error` string is remote-controlled and must not be trusted.
+#[derive(Debug, Default, Deserialize, Serialize)]
+pub struct TavilyExtractFailure {
+ #[serde(default)]
+ pub url: Option<String>,
+ #[serde(default)]
+ pub error: Option<String>,
+}
+
+fn non_empty(value: Option<&str>) -> Option<String> {
+ value
+ .map(str::trim)
+ .filter(|s| !s.is_empty())
+ .map(str::to_string)
+}
+
+/// Escape a remote page title for use as a markdown link label. Titles are
+/// attacker-controlled, and an unescaped `[`/`]` breaks out of the link and
+/// lets a crafted page inject markdown into the agent transcript.
+fn escape_link_text(raw: &str) -> String {
+ raw.replace('\\', r"\\")
+ .replace('[', r"\[")
+ .replace(']', r"\]")
+}
+
+/// Render a URL as a markdown link destination. Bare parentheses (common in
+/// Wikipedia URLs) terminate the destination early, so wrap in angle brackets
+/// and drop the characters that would close them.
+fn escape_link_destination(raw: &str) -> String {
+ let cleaned: String = raw
+ .trim()
+ .chars()
+ .filter(|c| !matches!(c, '<' | '>' | ' '))
+ .collect();
+ format!("<{cleaned}>")
+}
+
+/// Shared HTTP plumbing for the Tavily BYOK tool family. Holds the user's key and
+/// the direct `api.tavily.com` base URL (overridable in tests).
+#[derive(Clone)]
+pub(crate) struct TavilyClient {
+ api_key: Option<String>,
+ api_url: String,
+ max_results: usize,
+ timeout_secs: u64,
+}
+
+impl TavilyClient {
+ pub(crate) fn new(
+ api_key: Option<String>,
+ api_url: Option<String>,
+ max_results: usize,
+ timeout_secs: u64,
+ ) -> Self {
+ Self {
+ api_key,
+ api_url: api_url.unwrap_or_else(|| DEFAULT_API_URL.to_string()),
+ max_results: max_results.clamp(1, 20),
+ timeout_secs: timeout_secs.max(1),
+ }
+ }
+
+ /// Build the HTTP client at call time, like `brave.rs::http_client`, so a
+ /// TLS-backend failure surfaces as a tool error instead of aborting the
+ /// process while a session is being constructed.
+ fn http_client(&self) -> anyhow::Result<reqwest::Client> {
+ crate::openhuman::util::tls::tls_client_builder()
+ .timeout(Duration::from_secs(self.timeout_secs))
+ .connect_timeout(Duration::from_secs(10))
+ .build()
+ .map_err(|e| anyhow::anyhow!("failed to build Tavily HTTP client: {e}"))
+ }
+
+ /// Destination host for the egress descriptor, e.g. `api.tavily.com`.
+ fn egress_host(&self) -> String {
+ reqwest::Url::parse(&self.api_url)
+ .ok()
+ .and_then(|u| u.host_str().map(str::to_string))
+ .unwrap_or_else(|| "api.tavily.com".to_string())
+ }
+
+ /// Egress descriptor for a call to Tavily. The query (or the requested URLs)
+ /// is user content leaving the device, so it carries `Prompt` on top of the
+ /// destination `Url` that `network_fetch` supplies.
+ fn egress_descriptor(&self) -> crate::openhuman::security::egress::EgressDescriptor {
+ crate::openhuman::security::egress::EgressDescriptor::network_fetch(self.egress_host())
+ .with_data_kind(crate::openhuman::security::egress::DataKind::Prompt)
+ }
+
+ /// Privacy epic S7 (#4441): under `LocalOnly` the search is refused before
+ /// anything reaches Tavily. Returns the `[policy-blocked]` tool result to hand
+ /// straight back from `execute`, or `None` when the transfer is permitted.
+ fn local_only_block(&self) -> Option<ToolResult> {
+ crate::openhuman::security::egress::local_only_tool_block(&self.egress_descriptor())
+ .map(ToolResult::error)
+ }
+
+ /// The configured key, or a user-actionable error naming exactly where to
+ /// set it. Surfaced verbatim on the first search attempt.
+ fn key(&self) -> anyhow::Result<&str> {
+ self.api_key
+ .as_deref()
+ .map(str::trim)
+ .filter(|k| !k.is_empty())
+ .ok_or_else(|| {
+ anyhow::anyhow!(
+ "Tavily search unavailable: no API key configured. Add your Tavily API key \
+ under Connections > Search engine, set TAVILY_API_KEY or \
+ OPENHUMAN_TAVILY_API_KEY, or add search.tavily.api_key to config.toml."
+ )
+ })
+ }
+
+ /// Requested result count, honouring both `max_results` and Tavily's native
+ /// `max_results` spelling. An explicit per-call value is clamped to the
+ /// API's own 1..=20 range rather than to the configured `max_results` --
+ /// config supplies the *default* when the call omits one, and a caller may
+ /// ask for more (this matches `querit.rs`).
+ fn requested_results(&self, args: &Value) -> usize {
+ args.get("max_results")
+ .and_then(Value::as_u64)
+ .map(|n| n.clamp(1, 20) as usize)
+ .unwrap_or(self.max_results)
+ }
+
+ async fn post(&self, path: &str, body: Value) -> anyhow::Result<Value> {
+ let api_key = self.key()?;
+ let client = self.http_client()?;
+ let url = format!("{}/{}", self.api_url.trim_end_matches('/'), path);
+ tracing::debug!(
+ path,
+ timeout_secs = self.timeout_secs,
+ "[tavily] POST {url} (direct BYOK)"
+ );
+
+ // Egress spine (privacy epic S2, #4436): disclose the destination before
+ // contacting Tavily. `local_only_block` has already refused the call if the
+ // live policy forbids it.
+ crate::openhuman::security::egress::emit_external_transfer(self.egress_descriptor());
+
+ let resp = client
+ .post(&url)
+ .bearer_auth(api_key)
+ .header("Content-Type", "application/json")
+ .header("Accept", "application/json")
+ .json(&body)
+ .send()
+ .await
+ .map_err(|e| {
+ tracing::warn!("[tavily] request to {path} failed: {e}");
+ anyhow::anyhow!("Tavily request failed: {e}")
+ })?;
+
+ let status = resp.status();
+ if !status.is_success() {
+ // Read and drop the body: Tavily echoes the query back in errors and
+ // the message could reach the agent transcript.
+ let body_len = resp.text().await.unwrap_or_default().len();
+ tracing::warn!(status = %status, body_len, "[tavily] non-2xx response");
+ if status == reqwest::StatusCode::UNAUTHORIZED
+ || status == reqwest::StatusCode::FORBIDDEN
+ {
+ anyhow::bail!(
+ "Tavily rejected the configured API key (HTTP {status}). \
+ Check your Tavily API key under Connections > Search engine."
+ );
+ }
+ anyhow::bail!("Tavily returned non-2xx status {status}");
+ }
+
+ resp.json().await.map_err(|e| {
+ tracing::warn!("[tavily] failed to read response JSON: {e}");
+ anyhow::anyhow!("Failed to read Tavily response JSON: {e}")
+ })
+ }
+
+ fn render_plain(
+ &self,
+ results: &[TavilyResultItem],
+ query_images: &[TavilyImage],
+ heading: &str,
+ limit: usize,
+ include_raw_content: bool,
+ include_images: bool,
+ ) -> String {
+ let mut lines = if results.is_empty() {
+ vec![format!("No Tavily results for: {heading} (via Tavily)")]
+ } else {
+ vec![format!("Search results for: {heading} (via Tavily)")]
+ };
+ for (i, item) in results.iter().take(limit).enumerate() {
+ lines.push(format!("{}. {}", i + 1, item.display_title()));
+ lines.push(format!(" {}", item.url.trim()));
+ if let Some(score) = item.score {
+ lines.push(format!(" Score: {score:.3}"));
+ }
+ if let Some(excerpt) = item.excerpt() {
+ let truncated = crate::openhuman::util::truncate_with_ellipsis(
+ &excerpt,
+ SEARCH_EXCERPT_MAX_CHARS,
+ );
+ lines.push(format!(" {truncated}"));
+ }
+ if include_raw_content {
+ if let Some(raw_content) = non_empty(item.raw_content.as_deref()) {
+ let truncated = crate::openhuman::util::truncate_with_ellipsis(
+ &raw_content,
+ SEARCH_RAW_CONTENT_MAX_CHARS,
+ );
+ lines.push(format!(" Full content:\n{truncated}"));
+ }
+ }
+ if include_images {
+ for image in item.images.iter().take(MAX_IMAGES_PER_RESULT) {
+ let url = image.url().trim();
+ if url.is_empty() {
+ continue;
+ }
+ let description = image
+ .description()
+ .map(|value| format!(" — {value}"))
+ .unwrap_or_default();
+ lines.push(format!(" Image: {url}{description}"));
+ }
+ }
+ }
+ if include_images && !query_images.is_empty() {
+ lines.push("Query-related images:".to_string());
+ for image in query_images.iter().take(MAX_QUERY_IMAGES) {
+ let url = image.url().trim();
+ if url.is_empty() {
+ continue;
+ }
+ let description = image
+ .description()
+ .map(|value| format!(" — {value}"))
+ .unwrap_or_default();
+ lines.push(format!("- {url}{description}"));
+ }
+ }
+ lines.join("\n")
+ }
+
+ fn render_markdown(
+ &self,
+ results: &[TavilyResultItem],
+ query_images: &[TavilyImage],
+ heading: &str,
+ limit: usize,
+ answer: Option<&str>,
+ include_raw_content: bool,
+ include_images: bool,
+ ) -> String {
+ let mut out = if results.is_empty() {
+ format!("_No results for `{heading}`_ (via Tavily)\n")
+ } else {
+ format!("# Search results -- `{heading}` (via Tavily)\n")
+ };
+ if let Some(answer) = answer {
+ out.push_str("\n## Answer\n\n");
+ out.push_str(answer);
+ out.push('\n');
+ }
+ for item in results.iter().take(limit) {
+ out.push_str(&format!(
+ "\n## [{}]({})\n",
+ escape_link_text(item.display_title()),
+ escape_link_destination(&item.url)
+ ));
+ if let Some(excerpt) = item.excerpt() {
+ let truncated = crate::openhuman::util::truncate_with_suffix(
+ &excerpt,
+ SEARCH_EXCERPT_MAX_CHARS,
+ "...",
+ );
+ out.push_str(&format!("> {truncated}\n"));
+ }
+ if include_raw_content {
+ if let Some(raw_content) = non_empty(item.raw_content.as_deref()) {
+ let truncated = crate::openhuman::util::truncate_with_suffix(
+ &raw_content,
+ SEARCH_RAW_CONTENT_MAX_CHARS,
+ "...",
+ );
+ out.push_str("\n### Full content\n\n");
+ out.push_str(&truncated);
+ out.push('\n');
+ }
+ }
+ if include_images {
+ for image in item.images.iter().take(MAX_IMAGES_PER_RESULT) {
+ let url = image.url().trim();
+ if url.is_empty() {
+ continue;
+ }
+ let description = image
+ .description()
+ .map(|value| format!(" — {value}"))
+ .unwrap_or_default();
+ out.push_str(&format!(
+ "\n[Image]({}){description}\n",
+ escape_link_destination(url)
+ ));
+ }
+ }
+ }
+ if include_images && !query_images.is_empty() {
+ out.push_str("\n## Query-related images\n");
+ for image in query_images.iter().take(MAX_QUERY_IMAGES) {
+ let url = image.url().trim();
+ if url.is_empty() {
+ continue;
+ }
+ let description = image
+ .description()
+ .map(|value| format!(" — {value}"))
+ .unwrap_or_default();
+ out.push_str(&format!(
+ "\n- [Image]({}){description}",
+ escape_link_destination(url)
+ ));
+ }
+ out.push('\n');
+ }
+ out
+ }
+}
+
+/// Copy a string array argument onto the Tavily request body.
+fn copy_domain_filter(args: &Value, from: &str, body: &mut Value) {
+ if let Some(list) = args.get(from).filter(|v| v.is_array()) {
+ body[from] = list.clone();
+ }
+}
+
+/// Copy an optional string argument onto the Tavily request body under the
+/// same (already snake_case) key.
+fn copy_string(args: &Value, key: &str, body: &mut Value) {
+ if let Some(value) = non_empty(args.get(key).and_then(Value::as_str)) {
+ body[key] = json!(value);
+ }
+}
+
+/// Copy an optional boolean argument onto the Tavily request body.
+fn copy_bool(args: &Value, key: &str, body: &mut Value) {
+ if let Some(value) = args.get(key).and_then(Value::as_bool) {
+ body[key] = json!(value);
+ }
+}
+
+/// Web / news / finance search via the Tavily API (`POST /search`).
+pub struct TavilySearchTool {
+ tool_name: &'static str,
+ client: TavilyClient,
+}
+
+impl TavilySearchTool {
+ pub fn new(
+ api_key: Option<String>,
+ api_url: Option<String>,
+ max_results: usize,
+ timeout_secs: u64,
+ ) -> Self {
+ Self {
+ tool_name: "tavily_search",
+ client: TavilyClient::new(api_key, api_url, max_results, timeout_secs),
+ }
+ }
+
+ /// Same tool under the canonical `web_search_tool` slot, so selecting Tavily
+ /// satisfies the agent's generic "search the web" affordance.
+ pub fn new_web_search_tool(
+ api_key: Option<String>,
+ api_url: Option<String>,
+ max_results: usize,
+ timeout_secs: u64,
+ ) -> Self {
+ Self {
+ tool_name: "web_search_tool",
+ client: TavilyClient::new(api_key, api_url, max_results, timeout_secs),
+ }
+ }
+
+ fn build_body(&self, args: &Value, query: &str) -> Value {
+ let mut body = json!({
+ "query": query,
+ "max_results": self.client.requested_results(args),
+ });
+ copy_string(args, "search_depth", &mut body);
+ copy_string(args, "topic", &mut body);
+ copy_string(args, "time_range", &mut body);
+ copy_string(args, "start_date", &mut body);
+ copy_string(args, "end_date", &mut body);
+ copy_bool(args, "include_answer", &mut body);
+ copy_bool(args, "include_raw_content", &mut body);
+ copy_bool(args, "include_images", &mut body);
+ copy_domain_filter(args, "include_domains", &mut body);
+ copy_domain_filter(args, "exclude_domains", &mut body);
+ body
+ }
+}
+
+#[async_trait]
+impl Tool for TavilySearchTool {
+ fn name(&self) -> &str {
+ self.tool_name
+ }
+
+ fn description(&self) -> &str {
+ "Search the web with Tavily. Returns ranked pages with URLs, titles, and \
+ snippets. Supports general, news, and finance topics; search-depth levels; \
+ a publish/update time range or explicit start/end dates; domain include/ \
+ exclude filters; and an optional LLM-generated answer, cleaned page content, \
+ or image links."
+ }
+
+ fn parameters_schema(&self) -> Value {
+ json!({
+ "type": "object",
+ "properties": {
+ "query": {
+ "type": "string",
+ "description": "The search query. Write it in the language you want results in."
+ },
+ "max_results": {
+ "type": "integer",
+ "description": "Maximum number of results to return (default from config, max 20)."
+ },
+ "search_depth": {
+ "type": "string",
+ "enum": ["basic", "advanced", "fast", "ultra-fast"],
+ "description": "Latency vs. relevance tradeoff. Advanced costs more and gives higher-relevance results; ultra-fast is the quickest."
+ },
+ "topic": {
+ "type": "string",
+ "enum": ["general", "news", "finance"],
+ "description": "Category of the search. Use 'news' for real-time coverage, 'finance' for financial data."
+ },
+ "time_range": {
+ "type": "string",
+ "enum": ["day", "week", "month", "year"],
+ "description": "Only results published or updated within this period back from today. Alternative to start_date/end_date."
+ },
+ "start_date": {
+ "type": "string",
+ "description": "Only results published/updated on or after this YYYY-MM-DD date."
+ },
+ "end_date": {
+ "type": "string",
+ "description": "Only results published/updated on or before this YYYY-MM-DD date."
+ },
+ "include_answer": {
+ "type": "boolean",
+ "description": "Also return an LLM-generated concise answer to the query."
+ },
+ "include_raw_content": {
+ "type": "boolean",
+ "description": "Also return cleaned page content for each result, bounded by OpenHuman to protect the agent context (larger responses)."
+ },
+ "include_images": {
+ "type": "boolean",
+ "description": "Also return query-related images in the response."
+ },
+ "include_domains": {
+ "type": "array",
+ "items": { "type": "string" },
+ "description": "Only return results from these domains."
+ },
+ "exclude_domains": {
+ "type": "array",
+ "items": { "type": "string" },
+ "description": "Exclude results from these domains."
+ }
+ },
+ "required": ["query"]
+ })
+ }
+
+ fn supports_markdown(&self) -> bool {
+ true
+ }
+
+ async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {
+ self.execute_with_options(args, ToolCallOptions::default())
+ .await
+ }
+
+ async fn execute_with_options(
+ &self,
+ args: Value,
+ options: ToolCallOptions,
+ ) -> anyhow::Result<ToolResult> {
+ if let Some(blocked) = self.client.local_only_block() {
+ return Ok(blocked);
+ }
+
+ let query = non_empty(args.get("query").and_then(Value::as_str))
+ .ok_or_else(|| anyhow::anyhow!("Missing required parameter: query"))?;
+
+ let limit = self.client.requested_results(&args);
+ let body = self.build_body(&args, &query);
+ let value = self.client.post("search", body).await?;
+ let parsed: TavilySearchResponse = serde_json::from_value(value).map_err(|e| {
+ tracing::warn!("[tavily] failed to parse search response: {e}");
+ anyhow::anyhow!("Failed to parse Tavily search response: {e}")
+ })?;
+
+ tracing::debug!(result_count = parsed.results.len(), "[tavily] search ok");
+
+ // A Tavily-generated answer is the provider's own synthesis of the
+ // results; surface it when requested so the agent does not re-answer
+ // from the scraps.
+ let answer = non_empty(parsed.answer.as_deref());
+ let include_raw_content = args
+ .get("include_raw_content")
+ .and_then(Value::as_bool)
+ .unwrap_or(false);
+ let include_images = args
+ .get("include_images")
+ .and_then(Value::as_bool)
+ .unwrap_or(false);
+ let plain = self.client.render_plain(
+ &parsed.results,
+ &parsed.images,
+ &query,
+ limit,
+ include_raw_content,
+ include_images,
+ );
+ let markdown = self.client.render_markdown(
+ &parsed.results,
+ &parsed.images,
+ &query,
+ limit,
+ answer.as_deref(),
+ include_raw_content,
+ include_images,
+ );
+ let output = match answer {
+ Some(answer) => format!("Answer: {answer}\n\n{plain}"),
+ None => plain,
+ };
+
+ let mut result = ToolResult::success(output);
+ if options.prefer_markdown {
+ result.markdown_formatted = Some(markdown);
+ }
+ Ok(result)
+ }
+}
+
+/// Retrieve full page contents for a list of URLs (`POST /extract`).
+pub struct TavilyExtractTool {
+ client: TavilyClient,
+}
+
+impl TavilyExtractTool {
+ pub fn new(
+ api_key: Option<String>,
+ api_url: Option<String>,
+ max_results: usize,
+ timeout_secs: u64,
+ ) -> Self {
+ // Extraction transfers the full cleaned page, which can be hundreds of
+ // kilobytes or more over a slow link, while search only moves small
+ // excerpts. A hot folder of small search responses needs 15s; a single
+ // large page commonly does not. Tavily itself allows up to 60s per
+ // request, so the extract budget must never be smaller than that cap —
+ // otherwise a large page dies to `operation timed out` after the server
+ // already answered 200.
+ Self {
+ client: TavilyClient::new(api_key, api_url, max_results, timeout_secs.max(60)),
+ }
+ }
+
+ /// Accept either a `urls` array or a single `url` string, so the agent can
+ /// call this the obvious way for the one-document case.
+ fn collect_urls(args: &Value) -> anyhow::Result<Vec<String>> {
+ let urls: Vec<String> = match args.get("urls") {
+ Some(Value::Array(items)) => items
+ .iter()
+ .filter_map(|v| non_empty(v.as_str()))
+ .collect::<Vec<_>>(),
+ Some(Value::String(single)) => non_empty(Some(single)).into_iter().collect(),
+ _ => non_empty(args.get("url").and_then(Value::as_str))
+ .into_iter()
+ .collect(),
+ };
+ if urls.is_empty() {
+ anyhow::bail!("Missing required parameter: urls (a non-empty list of page URLs)");
+ }
+ if urls.len() > 20 {
+ anyhow::bail!(
+ "Tavily extract accepts at most 20 URLs per call (got {})",
+ urls.len()
+ );
+ }
+ Ok(urls)
+ }
+
+ fn render_plain(&self, results: &[TavilyExtractResult]) -> String {
+ if results.is_empty() {
+ return "No Tavily extraction results.".to_string();
+ }
+ let mut lines = Vec::new();
+ for (i, item) in results.iter().enumerate() {
+ lines.push(format!("{}. {}", i + 1, item.url.trim()));
+ match non_empty(item.raw_content.as_deref()) {
+ Some(content) => {
+ let truncated = crate::openhuman::util::truncate_with_ellipsis(&content, 8_000);
+ lines.push(format!(" {truncated}"));
+ }
+ None => lines.push(" (no content extracted)".to_string()),
+ }
+ }
+ lines.join("\n")
+ }
+
+ fn render_markdown(&self, results: &[TavilyExtractResult]) -> String {
+ if results.is_empty() {
+ return "_No Tavily extraction results._".to_string();
+ }
+ let mut out = String::from("# Tavily extraction\n");
+ for item in results {
+ out.push_str(&format!(
+ "\n## [{}]({})\n",
+ escape_link_text(item.url.trim()),
+ escape_link_destination(&item.url)
+ ));
+ match non_empty(item.raw_content.as_deref()) {
+ Some(content) => {
+ let truncated =
+ crate::openhuman::util::truncate_with_suffix(&content, 8_000, "...");
+ out.push_str(&truncated);
+ out.push('\n');
+ }
+ None => out.push_str("_No content extracted._\n"),
+ }
+ }
+ out
+ }
+}
+
+#[async_trait]
+impl Tool for TavilyExtractTool {
+ fn name(&self) -> &str {
+ "tavily_extract"
+ }
+
+ fn description(&self) -> &str {
+ "Extract cleaned content from one or more web pages using Tavily. Returns \
+ markdown or plain text, bounded to 8,000 characters per URL."
+ }
+
+ fn parameters_schema(&self) -> Value {
+ json!({
+ "type": "object",
+ "properties": {
+ "urls": {
+ "type": "array",
+ "items": { "type": "string" },
+ "minItems": 1,
+ "maxItems": 20,
+ "description": "The page URLs to extract content from (up to 20)."
+ },
+ "format": {
+ "type": "string",
+ "enum": ["markdown", "text"],
+ "description": "Format of the extracted content. Defaults to markdown."
+ },
+ "extract_depth": {
+ "type": "string",
+ "enum": ["basic", "advanced"],
+ "description": "basic is faster and cheaper; advanced also captures tables and embedded content."
+ }
+ },
+ "required": ["urls"]
+ })
+ }
+
+ fn supports_markdown(&self) -> bool {
+ true
+ }
+
+ async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {
+ self.execute_with_options(args, ToolCallOptions::default())
+ .await
+ }
+
+ async fn execute_with_options(
+ &self,
+ args: Value,
+ options: ToolCallOptions,
+ ) -> anyhow::Result<ToolResult> {
+ if let Some(blocked) = self.client.local_only_block() {
+ return Ok(blocked);
+ }
+
+ let urls = Self::collect_urls(&args)?;
+
+ let mut body = json!({
+ "urls": urls,
+ "format": "markdown",
+ });
+ copy_string(&args, "format", &mut body);
+ copy_string(&args, "extract_depth", &mut body);
+
+ let value = self.client.post("extract", body).await?;
+ let parsed: TavilyExtractResponse = serde_json::from_value(value).map_err(|e| {
+ tracing::warn!("[tavily] failed to parse extract response: {e}");
+ anyhow::anyhow!("Failed to parse Tavily extract response: {e}")
+ })?;
+
+ tracing::debug!(result_count = parsed.results.len(), "[tavily] extract ok");
+
+ let failed = parsed.failed_results.len();
+ if failed > 0 {
+ tracing::warn!(failed, "[tavily] extraction failures");
+ }
+ if parsed.results.is_empty() && failed > 0 {
+ return Ok(ToolResult::error(format!(
+ "Tavily could not extract any of the requested URLs ({failed} failed)."
+ )));
+ }
+
+ let plain = self.render_plain(&parsed.results);
+ let mut markdown = self.render_markdown(&parsed.results);
+ let output = if failed == 0 {
+ plain
+ } else {
+ // Report failures as a trailing line without echoing the remote
+ // error verbatim into the transcript.
+ markdown.push_str(&format!(
+ "\n> {failed} URL(s) could not be extracted by Tavily.\n"
+ ));
+ format!("{plain}\n\n({failed} URL(s) could not be extracted by Tavily)")
+ };
+
+ let mut result = ToolResult::success(output);
+ if options.prefer_markdown {
+ result.markdown_formatted = Some(markdown);
+ }
+ Ok(result)
+ }
+}
+
+#[cfg(test)]
+#[path = "tavily_tests.rs"]
+mod tests;
diff --git a/src/openhuman/search/tools/tavily_tests.rs b/src/openhuman/search/tools/tavily_tests.rs
new file mode 100644
index 0000000000..4573325233
--- /dev/null
+++ b/src/openhuman/search/tools/tavily_tests.rs
@@ -0,0 +1,616 @@
+//! Tests for the Tavily BYOK search + extract tool family.
+
+use super::*;
+use axum::{extract::Json, http::StatusCode, routing::post, Router};
+
+fn search_tool() -> TavilySearchTool {
+ TavilySearchTool::new(None, None, 5, 15)
+}
+
+fn search_tool_with_key() -> TavilySearchTool {
+ TavilySearchTool::new(Some("test-key".into()), None, 5, 15)
+}
+
+/// Spawn a local stand-in for `api.tavily.com` and return its base URL.
+async fn spawn(app: Router) -> String {
+ let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
+ let addr = listener.local_addr().unwrap();
+ tokio::spawn(async move {
+ axum::serve(listener, app).await.unwrap();
+ });
+ format!("http://127.0.0.1:{}", addr.port())
+}
+
+fn one_result_payload() -> Value {
+ json!({
+ "query": "tavily byok",
+ "answer": "A concise answer to the query.",
+ "results": [
+ {
+ "title": "Tavily Result",
+ "url": "https://example.com/a",
+ "content": "Snippet content from Tavily.",
+ "score": 0.42,
+ "raw_content": null
+ }
+ ],
+ "response_time": "0.7"
+ })
+}
+
+#[test]
+fn tool_names_match_the_documented_byok_surface() {
+ assert_eq!(search_tool().name(), "tavily_search");
+ assert_eq!(
+ TavilySearchTool::new_web_search_tool(None, None, 5, 15).name(),
+ "web_search_tool"
+ );
+ assert_eq!(
+ TavilyExtractTool::new(None, None, 5, 15).name(),
+ "tavily_extract"
+ );
+}
+
+#[test]
+fn search_schema_exposes_the_tavily_filters() {
+ let schema = search_tool().parameters_schema();
+ assert_eq!(schema["type"], "object");
+ assert!(schema["properties"]["query"].is_object());
+ assert!(schema["properties"]["search_depth"].is_object());
+ assert!(schema["properties"]["topic"].is_object());
+ assert!(schema["properties"]["time_range"].is_object());
+ assert!(schema["properties"]["include_answer"].is_object());
+ assert!(schema["properties"]["include_domains"].is_object());
+ assert!(schema["properties"]["exclude_domains"].is_object());
+ assert_eq!(schema["required"][0], "query");
+}
+
+#[test]
+fn search_depth_enum_matches_tavily_documented_levels() {
+ let schema = search_tool().parameters_schema();
+ let levels = schema["properties"]["search_depth"]["enum"]
+ .as_array()
+ .expect("search_depth enum")
+ .iter()
+ .map(|v| v.as_str().unwrap().to_string())
+ .collect::<Vec<_>>();
+
+ assert_eq!(levels, vec!["basic", "advanced", "fast", "ultra-fast"]);
+}
+
+#[test]
+fn topic_enum_matches_tavily_documented_topics() {
+ let schema = search_tool().parameters_schema();
+ let topics = schema["properties"]["topic"]["enum"]
+ .as_array()
+ .expect("topic enum")
+ .iter()
+ .map(|v| v.as_str().unwrap().to_string())
+ .collect::<Vec<_>>();
+
+ assert_eq!(topics, vec!["general", "news", "finance"]);
+}
+
+#[test]
+fn search_body_maps_snake_case_args_to_tavily_params() {
+ let tool = search_tool_with_key();
+ let body = tool.build_body(
+ &json!({
+ "max_results": 3,
+ "search_depth": "advanced",
+ "topic": "news",
+ "time_range": "week",
+ "include_answer": true,
+ "include_raw_content": true,
+ "include_images": true,
+ "include_domains": ["reuters.com"],
+ "exclude_domains": ["spam.test"]
+ }),
+ "election updates",
+ );
+
+ assert_eq!(body["query"], "election updates");
+ assert_eq!(body["max_results"], 3);
+ assert_eq!(body["search_depth"], "advanced");
+ assert_eq!(body["topic"], "news");
+ assert_eq!(body["time_range"], "week");
+ assert_eq!(body["include_answer"], true);
+ assert_eq!(body["include_raw_content"], true);
+ assert_eq!(body["include_images"], true);
+ assert_eq!(body["include_domains"][0], "reuters.com");
+ assert_eq!(body["exclude_domains"][0], "spam.test");
+}
+
+#[test]
+fn search_body_supports_start_and_end_dates_instead_of_time_range() {
+ let body = search_tool_with_key().build_body(
+ &json!({
+ "start_date": "2026-01-01",
+ "end_date": "2026-06-30"
+ }),
+ "archive piece",
+ );
+
+ assert_eq!(body["start_date"], "2026-01-01");
+ assert_eq!(body["end_date"], "2026-06-30");
+ assert!(body.get("time_range").is_none());
+}
+
+#[test]
+fn search_body_omits_unrequested_optional_params() {
+ let body = search_tool_with_key().build_body(&json!({}), "plain query");
+ assert_eq!(body["query"], "plain query");
+ assert_eq!(body["max_results"], 5);
+ assert!(body.get("topic").is_none());
+ assert!(body.get("include_answer").is_none());
+ assert!(body.get("include_domains").is_none());
+}
+
+#[test]
+fn web_search_tool_slot_shares_the_full_tavily_body() {
+ // The canonical `web_search_tool` slot is the same tool under a different
+ // name (mirrors `exa_search` -> `web_search_tool`), so the full argument
+ // surface stays available to the agent on the generic affordance too.
+ let tool = TavilySearchTool::new_web_search_tool(Some("test-key".into()), None, 5, 15);
+ let body = tool.build_body(
+ &json!({
+ "topic": "news",
+ "search_depth": "advanced",
+ "max_results": 7
+ }),
+ "generic query",
+ );
+
+ assert_eq!(body["query"], "generic query");
+ assert_eq!(body["max_results"], 7);
+ assert_eq!(body["topic"], "news");
+ assert_eq!(body["search_depth"], "advanced");
+}
+
+#[test]
+fn excerpt_prefers_content_then_raw_content() {
+ let mut item = TavilyResultItem {
+ raw_content: Some("full raw".into()),
+ ..Default::default()
+ };
+ assert_eq!(item.excerpt().as_deref(), Some("full raw"));
+
+ item.content = Some("chunk snippet".into());
+ assert_eq!(item.excerpt().as_deref(), Some("chunk snippet"));
+}
+
+#[test]
+fn extract_accepts_a_urls_array_a_bare_string_or_a_single_url() {
+ assert_eq!(
+ TavilyExtractTool::collect_urls(
+ &json!({"urls": ["https://a.test", " ", "https://b.test"]})
+ )
+ .unwrap(),
+ vec!["https://a.test".to_string(), "https://b.test".to_string()]
+ );
+ assert_eq!(
+ TavilyExtractTool::collect_urls(&json!({"urls": "https://a.test"})).unwrap(),
+ vec!["https://a.test".to_string()]
+ );
+ assert_eq!(
+ TavilyExtractTool::collect_urls(&json!({"url": "https://a.test"})).unwrap(),
+ vec!["https://a.test".to_string()]
+ );
+ assert!(TavilyExtractTool::collect_urls(&json!({"urls": []})).is_err());
+}
+
+#[test]
+fn extract_rejects_a_batch_over_twenty_urls() {
+ let urls: Vec<String> = (0..25)
+ .map(|i| format!("https://example.com/{i}"))
+ .collect();
+ let error = TavilyExtractTool::collect_urls(&json!({ "urls": urls }))
+ .expect_err("over-limit batches must not be silently truncated");
+
+ assert!(error.to_string().contains("at most 20 URLs"));
+}
+
+#[test]
+fn extract_never_uses_a_sub_minute_http_timeout() {
+ // Extraction transfers the full cleaned page, which can exceed a small
+ // search-facing timeout by orders of magnitude. A config value of a few
+ // seconds must not make `tavily_extract` fail on a large page after the
+ // server already answered 200 (`operation timed out` while reading the
+ // body). The tool floors its request budget at Tavily's own 60s cap.
+ let tool = TavilyExtractTool::new(Some("test-key".into()), None, 5, 15);
+ assert_eq!(tool.client.timeout_secs, 60);
+
+ let tool = TavilyExtractTool::new(Some("test-key".into()), None, 5, 90);
+ assert_eq!(tool.client.timeout_secs, 90);
+}
+
+#[tokio::test]
+async fn search_without_a_key_reports_where_to_set_one() {
+ let err = search_tool()
+ .execute(json!({"query": "test"}))
+ .await
+ .expect_err("missing key must fail");
+ let message = err.to_string();
+
+ assert!(message.contains("no API key configured"));
+ assert!(message.contains("Connections > Search engine"));
+}
+
+#[tokio::test]
+async fn search_requires_a_query() {
+ assert!(search_tool_with_key().execute(json!({})).await.is_err());
+}
+
+#[tokio::test]
+async fn search_posts_directly_to_tavily_with_bearer_auth_and_renders_results() {
+ let app = Router::new().route(
+ "/search",
+ post(
+ |headers: axum::http::HeaderMap, Json(body): Json<Value>| async move {
+ let auth = headers
+ .get("authorization")
+ .and_then(|v| v.to_str().ok())
+ .unwrap_or_default();
+ assert_eq!(auth, "Bearer test-key");
+ assert_eq!(body["query"], "tavily byok");
+ assert_eq!(body["max_results"], 3);
+ assert_eq!(body["include_domains"][0], "example.com");
+ Json(one_result_payload())
+ },
+ ),
+ );
+ let base_url = spawn(app).await;
+
+ let tool = TavilySearchTool::new(Some("test-key".into()), Some(base_url), 5, 15);
+ let result = tool
+ .execute(json!({
+ "query": "tavily byok",
+ "max_results": 3,
+ "include_domains": ["example.com"]
+ }))
+ .await
+ .expect("execute() should succeed");
+
+ assert!(result.output().contains("via Tavily"));
+ assert!(result.output().contains("Tavily Result"));
+ assert!(result.output().contains("https://example.com/a"));
+ assert!(result.output().contains("Snippet content from Tavily."));
+}
+
+#[tokio::test]
+async fn search_surfaces_the_tavily_generated_answer_when_requested() {
+ let app = Router::new().route(
+ "/search",
+ post(|Json(_): Json<Value>| async move { Json(one_result_payload()) }),
+ );
+ let base_url = spawn(app).await;
+
+ let tool = TavilySearchTool::new(Some("test-key".into()), Some(base_url), 5, 15);
+ let result = tool
+ .execute_with_options(
+ json!({"query": "tavily byok", "include_answer": true}),
+ ToolCallOptions {
+ prefer_markdown: true,
+ },
+ )
+ .await
+ .expect("execute() should succeed");
+
+ let production_output = result.output_for_llm(true);
+ assert!(production_output.contains("## Answer"));
+ assert!(production_output.contains("A concise answer to the query."));
+ assert!(production_output
+ .lines()
+ .next()
+ .unwrap_or_default()
+ .ends_with("(via Tavily)"));
+}
+
+#[tokio::test]
+async fn search_surfaces_requested_raw_content_and_images_in_markdown() {
+ let app = Router::new().route(
+ "/search",
+ post(|Json(_): Json<Value>| async move {
+ Json(json!({
+ "query": "rich result",
+ "images": [{
+ "url": "https://images.example.com/query.png",
+ "description": "Query overview"
+ }],
+ "results": [{
+ "title": "Rich result",
+ "url": "https://example.com/rich",
+ "content": "Short snippet.",
+ "raw_content": "Full cleaned page content that must not be shadowed by the snippet.",
+ "images": ["https://images.example.com/result.png"]
+ }]
+ }))
+ }),
+ );
+ let base_url = spawn(app).await;
+
+ let tool = TavilySearchTool::new(Some("test-key".into()), Some(base_url), 5, 15);
+ let result = tool
+ .execute_with_options(
+ json!({
+ "query": "rich result",
+ "include_raw_content": true,
+ "include_images": true
+ }),
+ ToolCallOptions {
+ prefer_markdown: true,
+ },
+ )
+ .await
+ .expect("execute() should succeed");
+
+ let production_output = result.output_for_llm(true);
+ assert!(production_output.contains("### Full content"));
+ assert!(production_output.contains("Full cleaned page content"));
+ assert!(production_output.contains("https://images.example.com/query.png"));
+ assert!(production_output.contains("https://images.example.com/result.png"));
+}
+
+#[tokio::test]
+async fn extract_posts_urls_and_renders_the_cleaned_content() {
+ let app = Router::new().route(
+ "/extract",
+ post(|Json(body): Json<Value>| async move {
+ assert_eq!(body["urls"][0], "https://example.com/a");
+ assert_eq!(body["format"], "markdown");
+ assert_eq!(body["extract_depth"], "advanced");
+ Json(json!({
+ "results": [{
+ "url": "https://example.com/a",
+ "raw_content": "Full cleaned page text."
+ }],
+ "failed_results": [],
+ "response_time": 1.2
+ }))
+ }),
+ );
+ let base_url = spawn(app).await;
+
+ let tool = TavilyExtractTool::new(Some("test-key".into()), Some(base_url), 5, 15);
+ let result = tool
+ .execute(json!({
+ "urls": ["https://example.com/a"],
+ "format": "markdown",
+ "extract_depth": "advanced"
+ }))
+ .await
+ .expect("execute() should succeed");
+
+ assert!(result.output().contains("https://example.com/a"));
+ assert!(result.output().contains("Full cleaned page text."));
+}
+
+#[tokio::test]
+async fn extract_marks_a_complete_failure_as_an_error_without_echoing_remote_details() {
+ let app = Router::new().route(
+ "/extract",
+ post(|Json(_): Json<Value>| async move {
+ Json(json!({
+ "results": [],
+ "failed_results": [{
+ "url": "https://example.com/blocked",
+ "error": "403 sensitive upstream detail"
+ }],
+ "response_time": 0.4
+ }))
+ }),
+ );
+ let base_url = spawn(app).await;
+
+ let tool = TavilyExtractTool::new(Some("test-key".into()), Some(base_url), 5, 15);
+ let result = tool
+ .execute_with_options(
+ json!({"urls": ["https://example.com/blocked"]}),
+ ToolCallOptions {
+ prefer_markdown: true,
+ },
+ )
+ .await
+ .expect("execute() should succeed");
+
+ assert!(
+ result.is_error,
+ "a response with no extracted URLs must fail"
+ );
+ let production_output = result.output_for_llm(true);
+ assert!(production_output.contains("could not extract any of the requested URLs"));
+ assert!(
+ !production_output.contains("403 sensitive upstream detail"),
+ "the remote error string must not reach the transcript"
+ );
+}
+
+#[tokio::test]
+async fn extract_keeps_partial_results_successful_and_reports_the_failed_count() {
+ let app = Router::new().route(
+ "/extract",
+ post(|Json(_): Json<Value>| async move {
+ Json(json!({
+ "results": [{
+ "url": "https://example.com/ok",
+ "raw_content": "Extracted page content."
+ }],
+ "failed_results": [{
+ "url": "https://example.com/blocked",
+ "error": "403 sensitive upstream detail"
+ }]
+ }))
+ }),
+ );
+ let base_url = spawn(app).await;
+
+ let tool = TavilyExtractTool::new(Some("test-key".into()), Some(base_url), 5, 15);
+ let result = tool
+ .execute_with_options(
+ json!({"urls": ["https://example.com/ok", "https://example.com/blocked"]}),
+ ToolCallOptions {
+ prefer_markdown: true,
+ },
+ )
+ .await
+ .expect("partial extraction should return a tool result");
+
+ assert!(
+ !result.is_error,
+ "one extracted URL makes this a partial success"
+ );
+ let production_output = result.output_for_llm(true);
+ assert!(production_output.contains("Extracted page content."));
+ assert!(production_output.contains("1 URL(s) could not be extracted"));
+ assert!(
+ !production_output.contains("403 sensitive upstream detail"),
+ "the remote error string must not reach the transcript"
+ );
+}
+
+#[tokio::test]
+async fn unauthorized_status_names_the_key_without_leaking_the_body() {
+ let app = Router::new().route(
+ "/search",
+ post(|| async {
+ (
+ StatusCode::UNAUTHORIZED,
+ "secret query context should stay private",
+ )
+ }),
+ );
+ let base_url = spawn(app).await;
+
+ let tool = TavilySearchTool::new(Some("bad-key".into()), Some(base_url), 5, 15);
+ let err = tool
+ .execute(json!({"query": "private search"}))
+ .await
+ .expect_err("401 must fail");
+ let message = err.to_string();
+
+ assert!(message.contains("Tavily rejected the configured API key"));
+ assert!(message.contains("Connections > Search engine"));
+ assert!(!message.contains("secret query context"));
+}
+
+#[tokio::test]
+async fn non_success_status_does_not_expose_the_response_body() {
+ let app = Router::new().route(
+ "/search",
+ post(|| async {
+ (
+ StatusCode::BAD_REQUEST,
+ "sensitive query context should stay private",
+ )
+ }),
+ );
+ let base_url = spawn(app).await;
+
+ let tool = TavilySearchTool::new(Some("test-key".into()), Some(base_url), 5, 15);
+ let err = tool
+ .execute(json!({"query": "private search"}))
+ .await
+ .expect_err("non-2xx responses should fail");
+ let message = err.to_string();
+
+ assert!(message.contains("Tavily returned non-2xx status 400 Bad Request"));
+ assert!(!message.contains("sensitive query context"));
+}
+
+/// Privacy epic S7 (#4441): `LocalOnly` must refuse every Tavily call before any
+/// query or URL reaches api.tavily.com. The base URL points at a port nothing is
+/// listening on, so a request escaping the guard fails the test rather than
+/// silently passing.
+fn local_only() -> crate::openhuman::security::live_policy::TestPrivacyGuard {
+ crate::openhuman::security::live_policy::test_privacy_scope(
+ crate::openhuman::config::PrivacyMode::LocalOnly,
+ )
+}
+
+#[tokio::test]
+async fn search_is_refused_under_local_only_privacy_mode() {
+ let _mode = local_only();
+ let tool = TavilySearchTool::new(
+ Some("test-key".into()),
+ Some("http://127.0.0.1:1".into()),
+ 5,
+ 15,
+ );
+
+ let result = tool
+ .execute(json!({"query": "private search"}))
+ .await
+ .expect("the block is a tool error, not a transport failure");
+
+ assert!(result.is_error);
+ assert!(
+ result.output().contains("[policy-blocked]"),
+ "got: {}",
+ result.output()
+ );
+ assert!(
+ !result.output().contains("private search"),
+ "the block message must not echo the query: {}",
+ result.output()
+ );
+}
+
+#[tokio::test]
+async fn extract_is_refused_under_local_only() {
+ let _mode = local_only();
+ let tool = TavilyExtractTool::new(Some("k".into()), Some("http://127.0.0.1:1".into()), 5, 15);
+
+ let result = tool
+ .execute(json!({"urls": ["https://example.com/a"]}))
+ .await
+ .expect("blocked, not failed");
+ assert!(result.is_error);
+ assert!(result.output().contains("[policy-blocked]"));
+}
+
+#[test]
+fn markdown_rendering_neutralizes_hostile_titles_and_urls() {
+ // Title and URL are remote, attacker-controlled. An unescaped `]` would
+ // close the link label and let a crafted page inject markdown into the
+ // agent transcript.
+ let client = TavilyClient::new(Some("k".into()), None, 5, 15);
+ let results = vec![TavilyResultItem {
+ url: "https://example.com/a_(b)".into(),
+ title: Some("Pwned](https://evil.test) [click".into()),
+ ..Default::default()
+ }];
+
+ let out = client.render_markdown(&results, &[], "q", 5, None, false, false);
+
+ // The hostile `]` is escaped, so the label never closes early and the
+ // injected `(https://evil.test)` cannot become a link destination. Bare
+ // parens need no escaping inside a label.
+ assert!(!out.contains("[Pwned](https://evil.test)"));
+ assert!(out.contains(r"[Pwned\](https://evil.test) \[click]"));
+ // Parenthesised URLs survive intact inside an angle-bracket destination.
+ assert!(out.contains("(<https://example.com/a_(b)>)"));
+}
+
+#[tokio::test]
+async fn empty_results_keep_the_provider_marker_in_markdown() {
+ let app = Router::new().route(
+ "/search",
+ post(|Json(_): Json<Value>| async move { Json(json!({ "results": [] })) }),
+ );
+ let base_url = spawn(app).await;
+
+ let tool = TavilySearchTool::new(Some("test-key".into()), Some(base_url), 5, 15);
+ let result = tool
+ .execute_with_options(
+ json!({"query": "nothing here"}),
+ ToolCallOptions {
+ prefer_markdown: true,
+ },
+ )
+ .await
+ .expect("execute() should succeed");
+
+ let production_output = result.output_for_llm(true);
+ assert!(production_output.contains("No results for `nothing here`"));
+ assert!(production_output.ends_with("(via Tavily)\n"));
+}
diff --git a/src/openhuman/tools/ops.rs b/src/openhuman/tools/ops.rs
index 04ac02f16c..eb2688e79a 100644
--- a/src/openhuman/tools/ops.rs
+++ b/src/openhuman/tools/ops.rs
@@ -1363,6 +1363,7 @@ fn tool_group(name: &str) -> crate::core::all::DomainGroup {
|| name.starts_with("brave_")
|| name.starts_with("parallel_")
|| name.starts_with("querit_")
+ || name.starts_with("tavily_")
|| name.starts_with("google_places_")
|| name.starts_with("stock_")
|| name.starts_with("storage_")
diff --git a/tests/config_auth_app_state_connectivity_e2e.rs b/tests/config_auth_app_state_connectivity_e2e.rs
index 4e424364b6..f54c326b2b 100644
--- a/tests/config_auth_app_state_connectivity_e2e.rs
+++ b/tests/config_auth_app_state_connectivity_e2e.rs
@@ -528,6 +528,8 @@ async fn setup() -> TestHarness {
EnvVarGuard::unset("BACKEND_URL"),
EnvVarGuard::unset("VITE_BACKEND_URL"),
EnvVarGuard::unset("OPENHUMAN_API_URL"),
+ EnvVarGuard::unset("OPENHUMAN_TAVILY_API_KEY"),
+ EnvVarGuard::unset("TAVILY_API_KEY"),
EnvVarGuard::unset("OPENHUMAN_CORE_RPC_URL"),
EnvVarGuard::unset("OPENHUMAN_CORE_PORT"),
EnvVarGuard::set("OPENHUMAN_KEYRING_BACKEND", "file"),
@@ -2079,6 +2081,8 @@ async fn config_save_and_load_encrypts_channel_secret_fields() {
EnvVarGuard::unset("OPENHUMAN_WORKSPACE"),
EnvVarGuard::unset(APP_ENV_VAR),
EnvVarGuard::unset(VITE_APP_ENV_VAR),
+ EnvVarGuard::unset("OPENHUMAN_TAVILY_API_KEY"),
+ EnvVarGuard::unset("TAVILY_API_KEY"),
EnvVarGuard::set("OPENHUMAN_MEMORY_EMBED_STRICT", "false"),
EnvVarGuard::set("OPENHUMAN_MEMORY_EMBED_ENDPOINT", ""),
EnvVarGuard::set("OPENHUMAN_MEMORY_EMBED_MODEL", ""),
@@ -2102,6 +2106,7 @@ async fn config_save_and_load_encrypts_channel_secret_fields() {
config.search.brave.api_key = Some("brave-secret".into());
config.search.querit.api_key = Some("querit-secret".into());
config.search.exa.api_key = Some("exa-secret".into());
+ config.search.tavily.api_key = Some("tavily-secret".into());
config.channels_config.telegram = Some(TelegramConfig {
bot_token: "telegram-secret".into(),
chat_id: None,
@@ -2186,6 +2191,7 @@ async fn config_save_and_load_encrypts_channel_secret_fields() {
"api-secret",
"parallel-secret",
"exa-secret",
+ "tavily-secret",
"telegram-secret",
"discord-secret",
"slack-bot-secret",
@@ -2214,6 +2220,10 @@ async fn config_save_and_load_encrypts_channel_secret_fields() {
Some("parallel-secret")
);
assert_eq!(loaded.search.exa.api_key.as_deref(), Some("exa-secret"));
+ assert_eq!(
+ loaded.search.tavily.api_key.as_deref(),
+ Some("tavily-secret")
+ );
assert_eq!(
loaded
.channels_config
@@ -3407,6 +3417,7 @@ async fn config_runtime_flags_settings_readbacks_and_validation_paths_are_exerci
"brave_api_key": " brave-rpc-key ",
"querit_api_key": " querit-rpc-key ",
"exa_api_key": " exa-rpc-key ",
+ "tavily_api_key": " tavily-rpc-key ",
"allowed_domains": [" example.com ", "", "example.com", "docs.example.com"],
"allow_all": false
}),
@@ -3467,6 +3478,12 @@ async fn config_runtime_flags_settings_readbacks_and_validation_paths_are_exerci
.and_then(Value::as_bool),
Some(true)
);
+ assert_eq!(
+ search_payload
+ .get("tavily_configured")
+ .and_then(Value::as_bool),
+ Some(true)
+ );
assert_eq!(
search_payload.get("allow_all").and_then(Value::as_bool),
Some(false)
@@ -3475,6 +3492,42 @@ async fn config_runtime_flags_settings_readbacks_and_validation_paths_are_exerci
search_payload.get("allowed_domains"),
Some(&json!(["docs.example.com", "example.com"]))
);
+ let select_tavily = rpc(
+ &harness.rpc_base,
+ 11_126,
+ "openhuman.config_update_search_settings",
+ json!({ "engine": "tavily" }),
+ )
+ .await;
+ let select_tavily_payload = payload(&select_tavily, "select Tavily search engine");
+ assert_eq!(
+ select_tavily_payload.pointer("/config/search/engine"),
+ Some(&json!("tavily"))
+ );
+ let tavily_readback = rpc(
+ &harness.rpc_base,
+ 11_127,
+ "openhuman.config_get_search_settings",
+ json!({}),
+ )
+ .await;
+ let tavily_payload = payload(&tavily_readback, "get_search_settings for Tavily");
+ assert_eq!(
+ tavily_payload.get("engine").and_then(Value::as_str),
+ Some("tavily")
+ );
+ assert_eq!(
+ tavily_payload
+ .get("effective_engine")
+ .and_then(Value::as_str),
+ Some("tavily")
+ );
+ assert_eq!(
+ tavily_payload
+ .get("tavily_configured")
+ .and_then(Value::as_bool),
+ Some(true)
+ );
let allow_all_search = rpc(
&harness.rpc_base,
11_027,
@@ -3484,6 +3537,7 @@ async fn config_runtime_flags_settings_readbacks_and_validation_paths_are_exerci
"brave_api_key": " ",
"querit_api_key": " ",
"exa_api_key": " ",
+ "tavily_api_key": " ",
"allow_all": true
}),
)