fix(web_tools): delegate backend availability to provider registry is_available()#28652
Open
m0n5t3r wants to merge 3 commits into
Open
fix(web_tools): delegate backend availability to provider registry is_available()#28652m0n5t3r wants to merge 3 commits into
m0n5t3r wants to merge 3 commits into
Conversation
added 3 commits
May 19, 2026 10:42
- _is_backend_available() now uses provider.is_available() from web_search_registry - _get_backend() walks _LEGACY_PREFERENCE via registry with fallback to legacy checks - Removed redundant _ddgs_package_importable() - Full backward compat: falls back to env-var checks for unregistered providers
…ockability Reviewer feedback: keeping the helper function preserves the ability for tests to monkeypatch a single symbol and retains the documentation comment explaining why ddgs uses package-presence checks instead of env vars.
…le() returns False When a provider is registered but is_available() returns False (e.g. ddgs plugin loaded but package not installed), fall through to the legacy env-var/package check instead of returning False immediately. This preserves test monkeypatch ability: tests mock _ddgs_package_importable() to return True, and the fallback path picks it up correctly.
Contributor
Author
|
huh, maybe I should fix the git data hermes uses (it made up the email address that fails the check) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
_get_backend() and _is_backend_available() in tools/web_tools.py used hardcoded env-var checks per known backend, meaning custom web providers registered via the plugin system were never discovered during fallback resolution. This refactors both functions to delegate to agent.web_search_registry.get_provider().is_available(), with a legacy env-var fallback for unregistered providers.
Related Issue
Fixes #28651
Type of Change
Changes Made
tools/web_tools.py — 26 insertions, 19 deletions
_get_backend() — replaced hardcoded candidate list with iteration over agent.web_search_registry._LEGACY_PREFERENCE, checking each via _is_backend_available()
_is_backend_available() — first looks up the provider from the registry and calls is_available(), falls back to legacy env-var checks for unregistered providers or when is_available() returns False (preserves test monkeypatch compatibility)
How to Test
web_extractplugin (without any API key for builtin providers)web_extractChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/A