· Also on dev.to
If your agent searches Google through LangChain or LlamaIndex, it almost certainly does it through Google's Custom Search JSON API. That covers GoogleSearchAPIWrapper in LangChain, GoogleSearchToolSpec in LlamaIndex and GoogleCustomSearch in LangChain.js. All three are thin layers over that API, and all three need a search engine id (cx), which only Custom Search has.
Google has closed that API to new customers. On 1 January 2027 it stops searching the whole web for everyone else too, and that's a month away.
We read those three tools line by line, because we wanted replacements that behave exactly the same. A few things surprised us.
They won't all fail loudly
LangChain's Python tool goes through Google's client library, so a refused call raises an exception and the agent run stops with an error. LangChain.js throws too.
LlamaIndex's tool doesn't look at the response status. It reads items from whatever comes back, and an error body has no items. So when the key stops working, the tool tells the model "No search results available". The agent doesn't crash. It carries on as if the web had nothing on the question, and answers from what it already knows.
If you run LlamaIndex agents, look there first. A broken search looks like a quiet day, not an outage.
The tool's name is part of your prompt
The model never sees your code. It sees the tool's name and description: google_search, "A wrapper around Google Search. Useful for when you need to answer questions about current events." Prompts, few-shot examples and evals often lean on those exact strings, and traces get searched by them.
So a "better search tool" with a new name and a new output shape is a bigger change than it looks. You're re-testing the agent, not swapping a dependency.
One more detail. LangChain's google_search_results_json says it returns a JSON array, but it actually returns Python's str() of a list, with single quotes. Models cope fine. But anything downstream that parses that output already depends on the quirk.
What we built
We already answer Custom Search's own request at the same path, so code that calls the API directly moves by changing the host and the key. For the frameworks, we made three small packages. Each keeps its tool's name, description, arguments and answers exactly as Google's, quirks included:
from langchain_serpbit import SerpbitSearchAPIWrapper, SerpbitSearchRun
search = SerpbitSearchRun(api_wrapper=SerpbitSearchAPIWrapper()) # reads SERPBIT_API_KEY
search.invoke("espresso grinder")
llama-index-tools-serpbit and @serpbit/langchain do the same for the other two, beside langchain-serpbit above. To check that "the same" really is the same, each package's tests point Google's own tool and ours at one fake Custom Search. They compare the answers, names and descriptions, and fail on any difference.
Some things do differ, and we'd rather say so up front:
- A search engine's own list of sites doesn't carry over.
siteSearchcovers a single site. - There's no
pagemap, so no thumbnails. - A search takes about 2 seconds, not under one.
- Our LlamaIndex tool raises an error instead of reporting no results. We did that on purpose.
The first 1,000 searches each month are free.
We'd like to hear from you
Which framework holds your search tool, and did anything else in your stack lean on Custom Search? Write to support@serpbit.com and tell us what we missed.