fix(web): add runtime backend failover for search and extract - #11331
Open
sangjunseo613-bot wants to merge 1 commit into
Open
sangjunseo613-bot wants to merge 1 commit into
sangjunseo613-bot wants to merge 1 commit into
Conversation
19 tasks
13 tasks
teknium1
reviewed
Jul 12, 2026
teknium1
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the resilience work. The underlying runtime-failover gap remains on current main: tools/web_tools.py:667-704 invokes one selected search provider, and tools/web_tools.py:821-907 invokes one selected extract provider; their outer handlers return provider exceptions rather than trying another provider.
Problems
- The implementation targets the retired inline dispatch model. Current main was cut over by
b05253ceed5f9d139f4a7d8705f5c97fcf644a2ctoagent.web_search_registry; the active dispatch paths use registeredWebSearchProviderinstances, including plugin providers and capability checks (tools/web_tools.py:656-704,tools/web_tools.py:821-907). - The proposed fallback loop is hard-coded to four vendor names (
tools/web_tools.py:136in the PR), so salvaging it directly would bypass registered providers and their capability contract.
Suggested changes
- Rework failover around a registry-native, capability-aware candidate resolver, then exercise it from the existing search and extract dispatch paths.
- Add provider-level regression coverage for retryable failures, explicit/per-capability pins, sync/async extraction, and policy-blocked URLs.
Automated hermes-sweeper review.
| return [primary] if primary else [] | ||
|
|
||
| ordered: List[str] = [] | ||
| for backend in (primary, "firecrawl", "parallel", "tavily", "exa"): |
Collaborator
There was a problem hiding this comment.
Current main dispatches through agent.web_search_registry and supports registered plugin providers plus capability checks. Please do not retain a hard-coded vendor list here when salvaging; build candidates from the registry filtered by search/extract capability and availability.
This branch has not been deployed
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.
Summary
web_searchacross Firecrawl, Exa, Tavily, and Parallelweb_extractwith retryable provider-error classificationweb.backendpins; cross-provider failover only happens in auto-detect modeWhy
web_search/web_extractalready supported multiple backends, but selected a single provider and returned errors immediately when that provider hit retryable runtime failures (for example Firecrawl402 Insufficient credits). This patch makes the web tools materially more resilient while preserving user/provider-intent boundaries.Behavior
402, quota/rate-limit, transient upstream/network failures) can fail over to another available backend.web.backendis explicitly configured, Hermes honors that provider pin and does not switch providers.Validation
python -m pytest tests/tools/test_web_tools_config.py tests/tools/test_web_tools_tavily.py tests/tools/test_web_tools_failover.py -qpython -m py_compile tools/web_tools.py tests/tools/test_web_tools_failover.pyweb_searchloggedfirecrawl failed ... retrying with exaand returned successful resultsweb_extractloggedfirecrawl failed ... retrying with exaand returned successful extractionNotes