Conversation
check_web_api_key() only recognized the hardcoded built-in backends, so a third-party web search plugin (registered via PluginContext.register_web_search_provider, e.g. a Kagi provider keyed on KAGI_API_KEY) was silently disabled: the web_search/web_extract tools were filtered out of the registry because the availability check returned False even though the plugin provider registered successfully and reports is_available() == True. After the built-in checks, consult agent.web_search_registry via get_active_search_provider(); return True when a registered provider is available. Registry import/availability failures are swallowed so the gate can never hard-fail. Built-in backend behavior is unchanged. Fixes NousResearch#31873
|
Thanks for posting this. It looks like there's a second half to it that's also needed because the dispatch is routing to the wrong provider.
Something like this will solve the issue: I've tested it against my Kagi plugin and it's working well with this fix. Additionally those hardcoded backends should probably be replaced by your _BUILTIN_BACKENDS as well. EDIT: |
|
Superseded by #57779, which fixes this same bug class (plugin-registered web providers invisible to the tool-availability gate) as a single chokepoint in Your PR targeted the same gate and informed the approach — thanks for the contribution, credited in the merged PR body. Closing as superseded. #57779 |
Fixes #31873.
Summary
check_web_api_key()only knew the hardcoded built-in backends, so a third-party web search plugin — registered viaPluginContext.register_web_search_provider()(e.g. a Kagi provider keyed onKAGI_API_KEY) — was silently disabled:web_search/web_extractwere filtered out of the tool registry because the availability gate returnedFalse, even though the plugin registered successfully and itsis_available()returnsTrue.After the built-in checks, this now consults
agent.web_search_registry.get_active_search_provider()and returnsTruewhen a registered provider is available. The registry already backs the actualweb_searchdispatch in this module (it's imported attools/web_tools.py:806), so the gate now matches real runtime availability.Pre-implement audit
agent.web_search_registry.get_active_search_provider(already imported elsewhere inweb_tools.pyfor dispatch) — no new registry/lookup logic.check_web_api_keyis a tool-availabilitycheck_fn; the change only widensFalse → Truewhen a provider is genuinely available, so no caller is regressed. Built-in path unchanged.Real-behavior proof
Test plan
New
tests/tools/test_web_api_key_plugin_providers.py: available plugin → True; no plugin → False; plugin present but unavailable → False; registry exception → False (no crash); built-in backend still short-circuits to True.