A wascally web research toolkit for agents; web search, web fetch, and publication research.
uv add wesearchSee Install for additional details.
wesearch is a synchronous, batteries-included library for programmatic web access: run a
search, fetch a page through a real-browser fingerprint, extract content, and look up scholarly
papers across multiple providers. It is the web layer factored out of a larger agent stack, so
it is built to survive bot-detection, rate limits, and flaky endpoints without a running browser
in the common case.
from wesearch.search.search import search
from wesearch.fetch import RequestParams, RetryParams, fetch
from wesearch.scrape import get_element_content
# Web search: walks DEFAULT_SEARCH_CHAIN; first non-empty answer wins
hits = search("denoising recursion models", num_results=10)
for r in hits:
print(r.title, r.url)
# Fetch + scrape
body = fetch(
"https://example.com", request=RequestParams(retry=RetryParams(timeout_sec=10))
)
title = get_element_content(body.decode("utf-8"), "h1")
# Scholarly papers: Semantic Scholar + OpenAlex, reciprocal-rank-fused by default
from wesearch.paper.search import search as paper_search
from wesearch.paper.ids import normalize_id
from wesearch.paper.details import metadata
result = paper_search("attention is all you need", limit=5)
for rec in result.records:
print(rec.title, rec.year)
meta = metadata(*normalize_id("arXiv:1706.03762"))Each name is imported from the submodule that defines it; the top-level __init__ re-exports
nothing.
wesearch/
βββ types/ the vocabulary every layer shares; imports nothing internal
β βββ params.py RequestParams + Content/Retry/Observe/Policy; Transport,
β β Extractor
β βββ errors.py FetchError, BotDetectionError + subclasses
βββ fetch/ the sole HTTP egress
β βββ fetch.py fetch(url, request=RequestParams(...)) -> body
β βββ gate.py host-wide per-site pacing and block recovery
β βββ transport/ how bytes are retrieved
β β βββ curl.py curl-cffi transport (TLS/JA3 browser impersonation)
β β βββ stdlib.py dependency-free urllib transport
β β βββ zendriver.py opt-in real-Chrome backend for JS-gated pages
β β βββ transport_routing.py per-domain transport selection
β βββ html_to_text.py how a fetched page becomes text
β βββ providers/ per-site fetch strategies (reddit, google_news, x, ...)
β βββ challenge.py bot-challenge detection and classification
βββ search/ web search over pluggable backends
β βββ search.py search(...) over SearXNG / DuckDuckGo / Google;
β SearchResult / PaperResult / ImageResult
βββ paper/ scholarly-paper lookup
β βββ search.py search(...) across Semantic Scholar, OpenAlex, SearXNG
β βββ details.py metadata / references / citations
β βββ authors.py author search and publication lists
β βββ fetch.py PDF download cascade
β βββ providers/ per-source backends (openalex, s2, searxng)
βββ mcp/ the MCP surface; the only place the mcp SDK is imported
β βββ server.py wesearch-mcp, one tool per public function
βββ chrome/ real-browser fingerprints
β βββ headers.py Chrome request headers (incl. x-browser-validation)
β βββ useragents.py vendored, refreshable User-Agent pools
βββ web.py fetch_web(...): fetch + provider dispatch + extraction
βββ profile.py cross-process per-(egress_ip, domain) cookie jar
βββ scrape.py get_element_content(html, selector)
uv add wesearchIf you're missing uv,
- Mac
brew install uv
- Linux
sudo apt install -y curl curl -LsSf https://astral.sh/uv/install.sh | sh
Or with pip,
python -m pip install wesearchfetch picks a transport per domain:
- curl-cffi (default): TLS/JA3 browser impersonation, no browser process.
- stdlib: dependency-free
urllibfallback. - zendriver: a headless Chrome for JavaScript-gated pages, used only for domains that require it. One Chrome serves every process on the host: the first fetch launches it detached, later fetches attach over DevTools and work in their own tab.
A persistent per-(egress_ip, domain) cookie profile is loaded and saved
transparently. Every fetch is paced host-wide per site and IP (fetch/gate.py holds the
per-site table). A block locks the site briefly; one caller then probes it, a success
unlocks every caller, and a failure doubles the lock. Run webrowser to clear
blocks by hand: it opens a tab per challenge-locked site, and each site you load
there is unlocked. Run webrowser URL to open a specific page or sign in;
webrowser shares Chrome's profile and cookies with browser tools and fetches.
The command was previously named zendriver; the transport name remains
"zendriver". Search results are cached host-wide for an hour, and a domain
learned to need the browser is re-probed after a week.
Check backend health with python -m wesearch.tools (add --processes 12 to load-test the
shared browser).
Everything works keyless out of the box; the environment variables below raise your rate limits or unlock a backend, and are all optional unless noted.
SEMANTIC_SCHOLAR_API_KEY-- optional. Without it, Semantic Scholar lookups (paper.search,paper.details) share a low-rate public tier, andpaper.search(..., source="fused")may returncomplete=Falsewhen S2 throttles the request. Set it for a higher-throughput tier.OPENALEX_EMAIL-- optional. Identifies you to OpenAlex's "polite pool" for more headroom than anonymous requests.OPENALEX_API_KEY-- optional. A higher OpenAlex request budget.BRAVE_API_KEY-- optional. Enables the Brave Search API, last in the default search chain because it bills per request.SEARXNG_URL-- optional. The base URL of a SearXNG instance you control or trust; enables the"searxng"backend and the category tabs.
State (the cookie profile jar, cross-process rate-limit lockfiles, the browser
transport's persistent Chrome profile) is written under the OS's standard per-user data
directory -- XDG_DATA_HOME (or ~/.local/share) on Linux, ~/Library/Application Support on
macOS, %LOCALAPPDATA% on Windows -- namespaced per component (see wesearch/lib/userdirs.py).
No configuration file is required or read.
The "zendriver" transport needs a non-snap Chrome or Chromium (e.g. Google Chrome's
.deb on x86_64). Snap-packaged Chromium fails every launch with BrowserUnavailableError
for two reasons, neither of which the library can work around:
- The snap wrapper takes several seconds to expose DevTools -- far beyond the launch budget
(0.5s per attempt, 6 attempts), which is sized so the
curl-then-zendrivercascade fails fast on hosts with no usable browser rather than stalling every fetch. - Snap's AppArmor confinement silently blocks writes under hidden home paths like
~/.local/share, so Chrome dies on its profile lock wherever the profile jar lands by default.
uv sync --all-groupsTests are tiered with pytest markers; the default run (uv run pytest) executes only the fast
unit tier:
addopts = -m 'not ci_smoke and not cuda and not integration and not performance and not cluster and not slow'
ci_smoke-- slower package smoke tests, run explicitly in CI.cuda-- requires a real CUDA device.integration-- requires networking or external CLIs.performance-- timing-sensitive.cluster-- requires live cluster access.slow-- expensive local correctness tests (JIT, full fixtures, git, bash, a fresh interpreter).real_llm-- spawns a live LLM CLI; skipped unlessRUN_REAL_LLM=1.
Run a specific tier with uv run pytest -m integration, or everything with
uv run pytest -m ''.
The zendriver backend tests need a Chrome or Chromium binary on PATH; without one they are
skipped automatically. No other system dependency is required to run the fast unit tier.
The toolkit is directly callable by coding agents over MCP:
pip install 'wesearch[mcp]'
wesearch-mcp # serves stdio; register it with your MCP clientFor Claude Code: claude mcp add --scope user wesearch -- wesearch-mcp.
Tools exposed: paper_search (fused Semantic Scholar + OpenAlex),
paper_details, paper_references, paper_citations, paper_pdf
(downloads into the user cache and returns the path), author_search,
author_papers, web_search, and web_fetch (extracted page text; the
default transport escalates to a headless browser when a site bot-blocks the
header transports). Outputs are
deliberately compact for model consumption; abstracts are truncated and
empty fields dropped. The server is synchronous and per-client β state that
must be shared (rate limits, cookie profiles) is already cross-process
safe on disk, so no daemon is needed.
Sibling projects in the rekursiv-ai family:
- sagent β The self-mutating multi-provider coding-agent CLI and typed Python library.
- trackinizer β Centralized agent database for tracking inquiries, work, and the evidence behind conclusions.
- madcatter β Rich-based Markdown renderer for the terminal; ships the
mdcatCLI. - priml β Composable PyTorch building blocks: models, optimizers, losses, and a step-based training loop.
- configgle β Hierarchical experiment configuration in typed pure-Python dataclasses instead of YAML.
- copybarista β Bidirectional source sync for publishing OSS-ready trees from a monorepo.
If you find our work useful, please consider citing:
@misc{rekursivai2026wesearch,
title={Wesearch - A wascally web research toolkit for agents.},
author={Joshua V. Dillon},
year={2026},
howpublished={Github},
url={https://github.com/rekursiv-ai/wesearch},
}