feat(websearch): add AnySearch as a web search provider - #9767
Open
WangPan59 wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. If the integration is wrong, users selecting AnySearch could have queries sent to the wrong external service, consume API quota, or receive failed or misleading results; requests and any exposed query data cannot be undone by reverting. The impact is limited to users who enable this provider, and no application data is persisted or deleted.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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
This PR adds AnySearch as a first-class web search provider in AstrBot,
following the same architecture as the existing Exa (#8973), Brave and Firecrawl integrations.
AnySearch is an AI search infrastructure that provides general web search plus
domain-specific retrieval (academic, code docs, finance, legal, security).
It also serves anonymous traffic with a daily free quota, so users can try the
provider without registering an API key first.
What's included
Backend (
astrbot/core/tools/web_search_tools.py)AnySearchWebSearchTool(web_search_anysearch) — search with tag / zone / language filters_anysearch_search()— async helper forapi.anysearch.com/v1/search_ANYSEARCH_KEY_ROTATORfor multi-key rotationDispatch & config
astr_main_agent.py: registered in_apply_web_search_tools()+WEB_SEARCH_CITATION_TOOL_NAMESconfig/default.py:websearch_anysearch_key: []default +"anysearch"in provider optionsi18n
Docs
docs/en/use/websearch.mdanddocs/zh/use/websearch.mdupdated with an AnySearch sectionTests
fail-fast on 5xx, max_results clamping, snippet fallback, legacy config migration
Notes
web_searchandwebsearch_providerare untouched.aiohttp.Test Results
Unit tests
uv run pytest tests/unit/test_web_search_tools.py -q -k anysearch
....... [100%]
7 passed
Lint checks
ruff check .
All checks passed!
End-to-end test (anonymous mode)
Configuration
Summary by Sourcery
Add AnySearch as a first-class web search provider with configurable keys, anonymous access, filtering, and citation support.
New Features:
Enhancements:
Tests: