Skip to main content

langchain-serpbit

Serpbit for LangChain, in two parts:

  • Browser tools. A real Chrome or Firefox on a home connection in the country you pick opens the pages that block plain requests or need JavaScript. Your agent gets them as Markdown with numbered elements to click and type into.
  • Google Search. Google's Custom Search JSON API stops searching the whole web on January 1, 2027. These are the Google Search tools of langchain-google-community, with the same calls, names and answers, served from Google's own results pages.
pip install langchain-serpbit

Browser tools

from langchain.agents import create_agent
from langchain_serpbit import SerpbitBrowserToolkit

tools = SerpbitBrowserToolkit().get_tools()  # SERPBIT_API_KEY
agent = create_agent("google_genai:gemini-3.5-flash", tools)  # or any model with tool calling
agent.invoke({"messages": [{"role": "user", "content":
    "What is the price of the first product in walmart.com's search results for running shoes?"}]})

The tools are the browser_* tools of Serpbit's MCP server, with its names, descriptions and arguments, read from the server when you call get_tools():

  • browser_fetch: one page in a browser of its own, returned as Markdown with its links. The simplest one to give an agent: SerpbitBrowserToolkit(tools=["browser_fetch"]).
  • browser_open, then browser_navigate, browser_click, browser_type, browser_snapshot, browser_screenshot, browser_solve_captcha and browser_close: a session that stays open for several steps. browser_open returns a live view link that a person can open to watch, or to take over for a sign-in or a CAPTCHA.

browser_fetch and browser_open take country (a two-letter code) and engine: auto picks Firefox for DataDome and Akamai sites and Chrome for Cloudflare, from our measurements. A screenshot comes back as the tool call's artifact, an MCP image block in base64. A refusal, such as an ended session, goes back to the model as the tool's answer. The browser is billed by the traffic it moves, about 1 to 3 MB a page. See the Browser API for plans, and the docs to use the same browser from Playwright, Puppeteer, browser-use or Stagehand.

Moving is two lines: the import and the key. Make a key at https://app.serpbit.com/keys and set SERPBIT_API_KEY. The search engine id is gone, because the results come from the whole web.

# Before
from langchain_google_community import GoogleSearchAPIWrapper, GoogleSearchResults, GoogleSearchRun
search = GoogleSearchAPIWrapper(k=5)  # GOOGLE_API_KEY, GOOGLE_CSE_ID

# After
from langchain_serpbit import SerpbitSearchAPIWrapper, SerpbitSearchResults, SerpbitSearchRun
search = SerpbitSearchAPIWrapper(k=5)  # SERPBIT_API_KEY

search.run("espresso grinder")  # the results' snippets
search.results("espresso grinder", 3, search_params={"gl": "de", "dateRestrict": "m1"})

tools = [SerpbitSearchRun(api_wrapper=search), SerpbitSearchResults(api_wrapper=search, num_results=4)]

The tools keep Google's names, google_search and google_search_results_json, and Google's descriptions, so prompts, traces and evaluations stay as they are. search_params are Custom Search's own: gl, hl, lr, safe, dateRestrict, siteSearch, fileType, start, exactTerms and the rest (the full list).

What differs from Google's:

  • siterestrict=True is refused, because a Custom Search engine's own list of sites does not carry over. To search one site, pass search_params={"siteSearch": "example.com"}.
  • results() has no image or thumbnail, because Serpbit's answer has no pagemap.
  • A failed call raises the serpbit client's errors, such as serpbit.InsufficientCreditsError when the credits run out.
  • A search takes about 2 seconds, against under 1 on Google's API.

Each search costs 1 credit. The free plan gives 1,000 credits a month, with no card.

Metadata

Release files for langchain-serpbit 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-serpbit 0.2.0
File Size Uploaded Provenance Actions
langchain_serpbit-0.2.0.tar.gz 12.4 kB Without provenance Details for langchain_serpbit-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-serpbit 0.2.0
File Interpreter ABI Platform Actions
langchain_serpbit-0.2.0-py3-none-any.whl Python 3 none any Details for langchain_serpbit-0.2.0-py3-none-any.whl

Total release size: 22.3 kB

Release files / langchain_serpbit-0.2.0.tar.gz

Download URL langchain_serpbit-0.2.0.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7ddae38801b10537d3560221a3170d55236466482210091dda86aad0197d7002
BLAKE2b-256 checksum
How to use checksums
980054c5cfe495fba996c4dce53f5044d53c544add6d66eb6e19be1da5404d9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.16

Release files / langchain_serpbit-0.2.0-py3-none-any.whl

Download URL langchain_serpbit-0.2.0-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
839e2ec975fe2b038301c2ebffd05b9510715db0887db92cb18253e4303c8b36
BLAKE2b-256 checksum
How to use checksums
9749b530f2371ce074ddb6c6cef5ddfc6ae90f9500505018f6209918b674fa83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.16

Security for langchain-serpbit 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page