Skip to content

Add Serply as an optional keyed backend for web and Google Scholar search #321

Open

Description

@googio

Context

Stage 4's web augmentation (researchclaw/web/) has two search paths today:

  • WebSearchClient: Tavily when TAVILY_API_KEY is set, otherwise a DuckDuckGo HTML scrape.
  • GoogleScholarClient: the scholarly scraper (optional web extra). Google blocks it fairly quickly on unattended runs, and use_proxy only partly helps.

There is no keyed option for Google web or Google Scholar results, and there is no way to get Scholar results at all without installing scholarly.

Proposal

Add Serply as an optional keyed backend behind the existing clients, following the same pattern Tavily uses (key from config or env, everything unchanged when the key is absent):

  • WebSearchClient: try Serply's /v1/search/ after Tavily and before the DuckDuckGo fallback.
  • GoogleScholarClient: query Serply's /v1/scholar/ first when a key is set, fall back to scholarly if that call fails. This also lets the Scholar client run without scholarly installed.
  • WebSearchConfig: serply_api_key / serply_api_key_env (default SERPLY_API_KEY), passed through _literature.py to WebSearchAgent like tavily_api_key_env.
  • Plain urllib, no new dependency. Tests with mocked responses for both clients plus the config parsing.

Disclosure: I work with Serply. Happy to adjust the shape (for example, a separate scholar_backend setting) if you would rather not have it inside the existing clients.

I have a branch ready and will open the PR referencing this issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions