I work on Serpbit, and this post ends with something we built. The first half holds whichever way you go.
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 January 1, 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, and found a few things we didn't expect.
LlamaIndex's tool fails without an error
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, check them first, because a broken search there raises no error.
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 search tool with a new name and a new output shape is a bigger change than it looks: you have to re-test the agent.
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.
Three packages that keep Google's names and answers
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. 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.
These things differ:
- 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.
If your search tool lives in a framework we didn't cover, or something else in your stack leaned on Custom Search, tell me in the comments.
Top comments (0)