fix: make _is_backend_available() plugin-aware - #36987
Closed
h121b wants to merge 1 commit into
Closed
Conversation
…ackends User-installed web plugins register via agent.web_search_registry but _is_backend_available() has a hardcoded list that doesn't include them. This causes web.extract_backend to fall back to the wrong backend. Add a registry fallback at the end of _is_backend_available() that checks get_provider() for any unrecognized backend name. Only triggers for unknown backends — no change for built-in backends. Co-authored-by: h121b <h121b@users.noreply.github.com>
18 tasks
This was referenced Jun 24, 2026
1 task
Contributor
|
Thanks for identifying a real plugin-resolution gap. This is now implemented on
|
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.
Background
I wanted to use Firecrawl and Crawl4AI together — Crawl4AI has better markdown support and I can use custom LLM extraction (via Hermes auxiliary provider). I asked Hermes to build a custom plugin for me. After some hiccups, the plugin works as a terminal call but fails when registered as a
web.extract_backend— because Hermes core code is hardcoded to look for a select few plugins only.Broader question: Can such type of fix be allowed for all plugins — allowing user-created plugins to be registered and used, overriding hardcoding if any? At the moment, I have to daily patch this code in my local installation (as I run
hermes update --yesdaily via cron and it overwrites my patch).Disclaimer: Rest of this PR is AI generated. I am vibe coding. This suggestion to the code was made by AI, and I have patched the code locally to verify it works (tested by Hermes' own tool calls).
Problem
_is_backend_available()intools/web_tools.pyhas a hardcoded list of backend names. User-installed web plugins register viaagent.web_search_registry.register_provider()but the function never checks the registry — only recognized names returnTrue.When a user sets
web.extract_backend: firecrawl-crawl4ai(a plugin-registered backend), the function returnsFalse, causing_get_capability_backend()to fall back toweb.backend(typicallysearxng), which is search-only.Why This Matters
The plugin system is the extensibility mechanism for Hermes. If plugin-registered backends can't be selected via config, the plugin system's web provider interface is effectively broken for dispatch purposes. The plugin registers successfully (
plugins.enabledcheck passes,register(ctx)runs, provider appears in the registry), but the tool dispatcher ignores it.This affects any user who:
web.extract_backendto the plugin's nameweb_extractto use their pluginFix
Add a registry fallback at the end of
_is_backend_available():Safety
get_provider()is a simple dict lookup — no network calls, no side effectsp.is_available()is the provider's own check (env var, importable dep)try/except ImportErrorhandles contexts where the registry isn't loadedreturn Falsefallthrough case)Alternatives Considered
_is_backend_availableget_active_extract_provider()handle it_get_capability_backend()filters before reaching itTesting
Verified with
firecrawl-crawl4aiplugin:web_extract(urls=["https://example.com"])routes to the plugin instead of falling back to SearXNG