Repository navigation
Add Keenable web search tool to the agent - #16233
Conversation
Keenable is a web search API built for AI agents. Unlike the other search tools, it works without an API key by default (keyless public endpoint); setting an API key uses the authenticated endpoint and lifts rate limits. Backend: agent/tools/keenable.py (KeenableSearch), auto-registered. Frontend: operator + icon + form wired into the agent builder, search menu, and the api_key export sanitizer. Usage: add the Keenable search tool to an agent; no key required.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds a new ChangesKeenableSearch Operator
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@agent/tools/keenable.py`:
- Around line 118-156: The _invoke method in the KeenableSearch tool class
currently only logs exceptions but lacks observability for normal operation
flows. Add logging statements to track: (1) entry into the method at the start,
(2) when the query is empty or processing is cancelled at different checkpoints,
(3) before each retry attempt in the loop, and (4) after successful retrieval
when results are processed and the formalized_content output is set. Ensure all
logs are descriptive for debugging but do not include sensitive data like query
contents or API keys in the log messages.
- Around line 149-155: The exception handler in the retry loop currently treats
all exceptions the same way, causing unnecessary delays even for non-transient
errors like configuration or local errors that won't be fixed by retrying.
Modify the exception handling to distinguish between transient errors
(network-related, timeouts) and non-transient errors (configuration, local
issues). For non-transient errors, re-raise the exception or break from the
retry loop instead of sleeping and retrying. Only apply the sleep delay and
retry logic to transient failures that might succeed on the next attempt.
- Around line 93-99: The check() method validates that mode is one of the
allowed values but does not enforce the requirement that mode="realtime" must
have a non-empty api_key. Add an additional validation in the check() method
after the existing mode validation to verify that whenever self.mode is set to
"realtime", the self.api_key must be present and non-empty, using a similar
pattern to the existing check_valid_value and check_positive_integer calls to
ensure the contract between realtime mode and API key is enforced at config
validation time rather than at runtime.
In `@web/src/pages/agent/constant/index.tsx`:
- Around line 200-206: The initialKeenableValues object has top_n set as a
number (10) but the Keenable form schema defines top_n as a string (z.string()).
Update the top_n field in the initialKeenableValues object to be a string value
('10') instead of a number (10) to align with the form schema definition and
ensure consistent type handling during validation.
In `@web/src/pages/agent/form/keenable-form/index.tsx`:
- Around line 28-33: The top_n field in the KeenableFormPartialSchema is
declared as z.string() but is used as a numeric value in the form
(initialKeenableValues.top_n = 10) and TopNFormField component, causing a type
mismatch. Change the top_n schema declaration from z.string() to z.number() to
align the validation schema with the actual numeric values being used in the
form.
- Line 13: Replace the project-wrapped useTranslate hook with the standard
react-i18next hook. Remove the import statement for useTranslate from
'`@/hooks/common-hooks`' and instead import useTranslation from 'react-i18next'.
Then locate where useTranslate('flow') is being called (around line 41) and
replace it with useTranslation('translation', { keyPrefix: 'flow' }). The
existing translation key references like t('keenableApiKeyTip') will continue to
work without modification since the keyPrefix parameter handles the scope.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 69cfb77e-c8bb-470f-875d-e79a656549da
⛔ Files ignored due to path filters (1)
web/src/assets/svg/keenable.svgis excluded by!**/*.svg
📒 Files selected for processing (15)
agent/tools/keenable.pyweb/src/constants/agent.tsxweb/src/locales/en.tsweb/src/pages/agent/canvas/node/dropdown/accordion-operators.tsxweb/src/pages/agent/constant/index.tsxweb/src/pages/agent/form-sheet/form-config-map.tsxweb/src/pages/agent/form/agent-form/tool-popover/tool-command.tsxweb/src/pages/agent/form/keenable-form/index.tsxweb/src/pages/agent/form/tool-form/constant.tsxweb/src/pages/agent/form/tool-form/keenable-form/index.tsxweb/src/pages/agent/hooks/use-add-node.tsweb/src/pages/agent/hooks/use-agent-tool-initial-values.tsweb/src/pages/agent/hooks/use-export-json.tsweb/src/pages/agent/log-sheet/tool-timeline-item.tsxweb/src/pages/agent/operator-icon.tsx
| export const initialKeenableValues = { | ||
| api_key: '', | ||
| query: AgentGlobals.SysQuery, | ||
| mode: KeenableMode.Pro, | ||
| site: '', | ||
| top_n: 10, | ||
| outputs: { |
There was a problem hiding this comment.
Align top_n default type with the Keenable form schema.
initialKeenableValues.top_n is a number (10), but the Keenable form schema defines top_n as z.string(). This creates a cross-file contract mismatch and can break validation/default handling when the field is untouched.
💡 Proposed fix
export const initialKeenableValues = {
api_key: '',
query: AgentGlobals.SysQuery,
mode: KeenableMode.Pro,
site: '',
- top_n: 10,
+ top_n: '10',
outputs: {
formalized_content: {
value: '',
type: 'string',
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export const initialKeenableValues = { | |
| api_key: '', | |
| query: AgentGlobals.SysQuery, | |
| mode: KeenableMode.Pro, | |
| site: '', | |
| top_n: 10, | |
| outputs: { | |
| export const initialKeenableValues = { | |
| api_key: '', | |
| query: AgentGlobals.SysQuery, | |
| mode: KeenableMode.Pro, | |
| site: '', | |
| top_n: '10', | |
| outputs: { |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/src/pages/agent/constant/index.tsx` around lines 200 - 206, The
initialKeenableValues object has top_n set as a number (10) but the Keenable
form schema defines top_n as a string (z.string()). Update the top_n field in
the initialKeenableValues object to be a string value ('10') instead of a number
(10) to align with the form schema definition and ensure consistent type
handling during validation.
| } from '@/components/ui/form'; | ||
| import { Input } from '@/components/ui/input'; | ||
| import { RAGFlowSelect } from '@/components/ui/select'; | ||
| import { useTranslate } from '@/hooks/common-hooks'; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify current usage pattern in agent forms
rg -n "useTranslate\\(|useTranslation\\(" web/src/pages/agent/form --iglob "*.tsx"Repository: infiniflow/ragflow
Length of output: 8211
🏁 Script executed:
# Read the keenable-form file to see full context
cat -n web/src/pages/agent/form/keenable-form/index.tsx | head -50Repository: infiniflow/ragflow
Length of output: 2058
🏁 Script executed:
# Check the definition of useTranslate in common-hooks
rg -A 10 "export.*useTranslate|function useTranslate" web/src/hooks/common-hooksRepository: infiniflow/ragflow
Length of output: 129
🏁 Script executed:
# List files in common-hooks directory
ls -la web/src/hooks/common-hooks/Repository: infiniflow/ragflow
Length of output: 137
🏁 Script executed:
# Search for useTranslate definition
rg -n "export.*useTranslate|function useTranslate" web/src/hooks/Repository: infiniflow/ragflow
Length of output: 150
🏁 Script executed:
# Read the useTranslate implementation
sed -n '140,160p' web/src/hooks/common-hooks.tsxRepository: infiniflow/ragflow
Length of output: 286
🏁 Script executed:
# Also check what react-i18next's useTranslation looks like when used
rg -B 2 -A 5 "useTranslation" web/src/pages/agent/form/begin-form/index.tsx | head -20Repository: infiniflow/ragflow
Length of output: 694
🏁 Script executed:
# Check how the t variable is used in keenable-form
rg -n "t\(" web/src/pages/agent/form/keenable-form/index.tsxRepository: infiniflow/ragflow
Length of output: 449
🏁 Script executed:
# Check the translation file structure for flow namespace
find web -name "*.json" -path "*translation*" -o -name "*flow*" -path "*locales*" | head -20Repository: infiniflow/ragflow
Length of output: 44
🏁 Script executed:
# Look for translation file that contains these keys
rg -l "keenableApiKeyTip|keenableMode|keenableSite" web/Repository: infiniflow/ragflow
Length of output: 133
🏁 Script executed:
# Check the translation structure in en.ts
rg -B 2 -A 2 "keenableApiKeyTip|keenableMode|keenableSite" web/src/locales/en.tsRepository: infiniflow/ragflow
Length of output: 525
🏁 Script executed:
# Also check what other useTranslate('flow') calls use as keys
rg "useTranslate\('flow'\)" -A 30 web/src/pages/agent/form/ | grep "t\(" | head -20Repository: infiniflow/ragflow
Length of output: 86
🏁 Script executed:
# Check the translation structure to understand keyPrefix organization
rg "keenableApiKeyTip" -B 5 web/src/locales/en.tsRepository: infiniflow/ragflow
Length of output: 449
🏁 Script executed:
# Check how other components that use useTranslate('flow') access keys
rg -A 5 "useTranslate\('flow'\)" web/src/pages/agent/form/yahoo-finance-form/index.tsx | head -20Repository: infiniflow/ragflow
Length of output: 478
🏁 Script executed:
# Check the full translation file structure around those keys
rg "flow:" -A 50 web/src/locales/en.ts | head -80Repository: infiniflow/ragflow
Length of output: 4348
🏁 Script executed:
# Also check if there's a nested structure
cat web/src/locales/en.ts | head -100Repository: infiniflow/ragflow
Length of output: 3228
🏁 Script executed:
# Verify the exact structure - check what keys are directly under flow
rg "flow: \{" -A 200 web/src/locales/en.ts | grep -E "^\s+[a-zA-Z]+:" | head -30Repository: infiniflow/ragflow
Length of output: 1474
🏁 Script executed:
# Check if any components successfully use useTranslation() for flow-level keys
rg -B 3 "useTranslation\(\)" web/src/pages/agent/form/ | grep -A 3 "t\(" | head -30Repository: infiniflow/ragflow
Length of output: 86
🏁 Script executed:
# Check how components using useTranslation() access keys that might be in flow namespace
rg "useTranslation" -A 10 web/src/pages/agent/form/begin-form/index.tsx | grep "t'" | head -10Repository: infiniflow/ragflow
Length of output: 178
🏁 Script executed:
# Check if any files use both useTranslation and reference keys with 'flow.' prefix
rg "useTranslation\(\)" -l web/src/pages/agent/form/ | head -5 | xargs -I {} sh -c 'echo "File: {}"; rg "t\(" {} | head -3'Repository: infiniflow/ragflow
Length of output: 895
🏁 Script executed:
# Check if react-i18next's useTranslation supports keyPrefix parameter
rg "useTranslation.*keyPrefix" web/src/Repository: infiniflow/ragflow
Length of output: 451
🏁 Script executed:
# Check the implementation of the useTranslate wrapper more carefully
cat -n web/src/hooks/common-hooks.tsx | sed -n '135,150p'Repository: infiniflow/ragflow
Length of output: 408
Replace useTranslate('flow') with useTranslation('translation', { keyPrefix: 'flow' }) to use the standard react-i18next hook directly.
Currently imports the project-wrapped useTranslate utility. Per coding guidelines, use useTranslation from react-i18next directly. Replace the import on line 13 and update line 41:
- Remove:
import { useTranslate } from '@/hooks/common-hooks'; - Add:
import { useTranslation } from 'react-i18next'; - Change:
const { t } = useTranslate('flow');toconst { t } = useTranslation('translation', { keyPrefix: 'flow' });
The existing translation keys (t('keenableApiKeyTip'), etc.) will continue to work unchanged since the keyPrefix parameter handles the scope.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/src/pages/agent/form/keenable-form/index.tsx` at line 13, Replace the
project-wrapped useTranslate hook with the standard react-i18next hook. Remove
the import statement for useTranslate from '`@/hooks/common-hooks`' and instead
import useTranslation from 'react-i18next'. Then locate where
useTranslate('flow') is being called (around line 41) and replace it with
useTranslation('translation', { keyPrefix: 'flow' }). The existing translation
key references like t('keenableApiKeyTip') will continue to work without
modification since the keyPrefix parameter handles the scope.
Source: Coding guidelines
…-fast on config errors, numeric top_n) - check(): reject realtime mode without an API key (was a runtime failure) - _invoke(): add start/success/cancel logs; break (don't retry/sleep) on ValueError config errors - frontend: top_n schema z.coerce.number() to match the numeric default + TopNFormField
|
Thanks for the review. Addressed in the latest push:
On the |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16233 +/- ##
==========================================
- Coverage 94.56% 93.16% -1.40%
==========================================
Files 10 10
Lines 717 717
Branches 118 118
==========================================
- Hits 678 668 -10
- Misses 25 29 +4
- Partials 14 20 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Port of python PR infiniflow#16233 to the Go workflow. Keenable is a web search API that works without an API key by default (keyless free tier); providing a key lifts rate limits and unlocks 'realtime' mode. - internal/agent/tool/keenable.go: KeenableTool + constructors following the Tavily/DuckDuckGo pattern. POSTs to /v1/search/public (keyless) or /v1/search (keyed, X-API-Key) with the User-Agent/X-Keenable-Title attribution headers. Mode defaults to 'pro', top_n defaults to 10, site is an optional single-domain filter. KEENABLE_API_URL overrides the base (HTTPS enforced; loopback http allowed for local dev). Realtime mode without a key is rejected at config time. - internal/agent/tool/registry.go: register "keenable". - internal/agent/tool/keenable_test.go: 13 tests covering the keyless/keyed paths, site+top_n, default top_n, missing query, invalid mode, realtime-needs-key, base-URL guard, env override, upstream errors, and Info metadata. Co-Authored-By: Claude <[email protected]>
…alidation to accept any version Port of python PR infiniflow#16233 to the Go workflow. Keenable is a web search API that works without an API key by default (keyless free tier); providing a key lifts rate limits and unlocks 'realtime' mode.
…alidation to accept any version, ensure retrieval node work Port of python PR infiniflow#16233 to the Go workflow. Keenable is a web search API that works without an API key by default (keyless free tier); providing a key lifts rate limits and unlocks 'realtime' mode.
…alidation to accept any version, ensure retrieval node work Port of python PR infiniflow#16233 to the Go workflow. Keenable is a web search API that works without an API key by default (keyless free tier); providing a key lifts rate limits and unlocks 'realtime' mode.
…flow#18341) ### Summary Follow-up bug fix to infiniflow#16233 (the Keenable search tool, merged 2026-06-25).
### Summary @JinHai-CN — the agent tool you asked for in #18478, as its own PR. Adds `YouComSearch` to the agent tool set, modeled on the Keenable tool (#16233) rather than Querit's: You.com exposes a small parameter surface, so this needs a two-field form rather than a bespoke form suite. **+594 lines**, close to Keenable's +392 and well under Querit's +3527. Independent of #18478. That PR wires You.com into chat retrieval; this one is the agent canvas node. Neither depends on the other and they share no lines. --------- Co-authored-by: Brian Sparker <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Adds Keenable as a web search tool in the agent, alongside the existing
Tavily/DuckDuckGo/SearXNG/Google tools.
The main difference from the other search tools is that it doesn't require an
API key. By default it uses Keenable's keyless public endpoint, so it works out
of the box. Providing a key (in the tool config) switches to the authenticated
endpoint and lifts the rate limits.
Changes
agent/tools/keenable.py—KeenableSearch, follows theTavily/DuckDuckGo tool shape (results go through
_retrieve_chunks).Auto-registered by
agent/tools/__init__.py.(optional API key, search mode, site filter, top N), the search tool menu,
and the existing api_key export sanitizer.
Config
realtimemode.site: restrict to a single domain.mode:pro(default) orrealtime.Notes
KEENABLE_API_URLcan override the API base (HTTPS enforced; defaults tohttps://api.keenable.ai). The tool only sends the query (no URL fetch), sothere's no SSRF surface. Verified the frontend with
vite buildand thebackend search path against the public endpoint.