Add live web search to your LangChain agent or LlamaIndex pipeline in under 10 minutes. Drop-in BaseTool subclass. Zero extra dependencies beyond requests.
50M+
API requests served
99.9%
Uptime SLA
100+
Countries supported
<5s
Median response time
Trusted by companies worldwide
Capabilities
One REST endpoint. Structured JSON. Works with every major Python agent framework.
LangChain BaseTool
Subclass BaseTool in 15 lines. Pass it to AgentExecutor and your agent instantly has live web search. Works with all LangChain agent types.
LlamaIndex Reader
Implement a custom reader that returns Document objects. Drop into any LlamaIndex query engine, retriever, or RAG pipeline.
LangGraph Tool Node
Define as a standard tool node in LangGraph state machines. Reuse the same tool definition across any graph-based agent workflow.
LCEL Compatible
Wrap as a Runnable in LangChain Expression Language (LCEL) chains. Pipe search results directly into your prompt templates.
Async Python Support
Full async implementation with aiohttp or httpx. Run parallel searches in a single agent turn without blocking the event loop.
Framework Agnostic Core
The REST API works with AutoGen, CrewAI, Haystack, Semantic Kernel, and any custom agent. Not just LangChain.
How It Works
The SERPHouse Web Search API integrates into LangChain and LlamaIndex using standard Python patterns. No custom SDK. No complex configuration.
Get your SERPHouse API key
Sign up free. No credit card. Copy the key from your dashboard.
Subclass BaseTool (LangChain) or BaseReader (LlamaIndex)
Implement the _run method to call the SERPHouse REST API. 15 lines of Python.
Pass the tool to your agent executor
Add it to the tools list in AgentExecutor.from_agent_and_tools() or create_openai_tools_agent().
Agent searches when needed
The LLM decides when to call the tool. Results return as structured text the model uses as context.
Why a custom tool vs. built-in search tools
| Feature | SERPHouse | Built-in Google |
|---|---|---|
| Setup complexity | REST API key | Google API + CSE setup |
| Output format | Structured JSON | Unstructured text |
| Search engines | Google + Bing + Yahoo | Google only |
| Country targeting | 100+ countries | Limited |
| Production SLA | 99.9% uptime | Quota limits |
LangChain's built-in Google Search wrapper requires a Google Custom Search API key, hits strict free-tier quotas, and returns unstructured text your LLM must parse. SERPHouse gives structured JSON (including position, title, link, and snippet) ready to drop into context.
Code Examples
Complete, runnable examples. Subclass BaseTool for LangChain agents, BaseReader for LlamaIndex pipelines, or call the REST endpoint directly from any Python framework.
BaseTool._run
·
LangChain: 15 lines of Python
BaseReader.load_data
·
LlamaIndex: returns Document objects
results.organic[]
·
title, link, snippet per result
from langchain.tools import BaseTool from pydantic import BaseModel, Field import requests from typing import Optional class WebSearchInput(BaseModel): query: str = Field(description="The search query to look up on the web") num_result: Optional[int] = Field( default=5, description="Number of results to return (1-10)" ) class SERPHouseSearchTool(BaseTool): name: str = "web_search" description: str = ( "Search the live web for current information, recent events, " "and up-to-date facts. Use this when your knowledge may be " "outdated or when you need to verify current information." ) args_schema: type[BaseModel] = WebSearchInput def _run(self, query: str, num_results: int = 5) -> str: response = requests.get( "https://api.serphouse.com/serp/live", headers={"Authorization": "Bearer YOUR_API_KEY"}, params={ "q": query, "loc": "United+States", "num_result": 10 } ) results = response.json()["results"]["organic"] return "\n\n".join([ f"{r['position']}. {r['title']}\n{r['snippet']}\nURL: {r['link']}" for r in results ]) from langchain.agents import AgentExecutor, create_openai_tools_agent from langchain_openai import ChatOpenAI from langchain import hub llm = ChatOpenAI(model="gpt-4o", temperature=0) tools = [SERPHouseSearchTool()] prompt = hub.pull("hwchase17/openai-tools-agent") agent = create_openai_tools_agent(llm, tools, prompt) executor = AgentExecutor(agent=agent, tools=tools, verbose=True) result = executor.invoke({ "input": "What are the most popular AI agent frameworks in 2025?" }) print(result["output"])
Why SERPHouse
LangChain's built-in search integrations often require separate API credentials, hit free tier quotas, and return unstructured text. SERPHouse gives you structured JSON per result, 100+ country support, Google + Bing + Yahoo in one endpoint, and a production SLA, so the tool your agent relies on doesn't become its reliability bottleneck.
BaseTool in 15 lines, with no complex setup or extra dependencies.
Structured JSON: title, link, snippet per result, with no post-processing.
Works with LCEL, AgentExecutor, LangGraph, and ReAct agents.
LlamaIndex compatible: BaseReader returns Document objects natively.
99.9% uptime SLA, so your agent tool stays available when your users need it.
LangChain AgentExecutor
Works with create_openai_tools_agent, initialize_agent, and ReAct agents. The same tool definition works across all executor types.
LangGraph
Register as a ToolNode in any graph. Same tool definition, any workflow topology,ReAct-style loops, parallel branches, or conditional routing between nodes.
LlamaIndex
Custom BaseReader returns Document objects for any query engine or RAG pipeline. Results include title, link, and position in metadata.
FAQ
Common questions about integrating SERPHouse with LangChain, LlamaIndex, and LangGraph.
Subclass BaseTool from langchain.tools, define a name and description, implement the _run method to call the SERPHouse REST API, and pass the instance in the tools list when creating your agent. The _run method should return a formatted string of results. For structured input, define an args_schema using Pydantic's BaseModel.
LangChain's GoogleSearchAPIWrapper requires a Google Custom Search API key and has strict quota limits. SERPHouse provides a dedicated REST API with structured JSON output (title, link, snippet per result), supports Google, Bing, and Yahoo, covers 100+ countries, and offers a production SLA. SERPHouse results are also already structured, while built-in tools often return raw text that requires additional parsing.
Yes. In LangGraph, define a SERPHouseSearchTool instance as you would for any LangChain agent, then pass it to a ToolNode. The tool integrates seamlessly with any LangGraph state machine topology (ReAct-style loops, parallel branches, or conditional routing). Use the same tool definition across different graph configurations without changes.
Wrap the SERPHouseSearchTool as a RunnableLambda or use it directly in a chain with a prompt template and LLM. For example: chain = search_tool | prompt_template | llm. Results from the search tool are passed as a string to the prompt, which formats them for the LLM. LCEL's composable interface makes it easy to add retrieval to any existing chain.
Subclass BaseReader from llama_index.core.readers.base, implement load_data(query) to call the SERPHouse API, and return a list of Document objects where text is the snippet and metadata contains title, link, and position. Pass document instances to VectorStoreIndex.from_documents() or use the reader directly with a SimpleDirectoryReader-compatible interface.
Yes. SERPHouseSearchTool works with ReAct-style agents initialized via initialize_agent with AgentType.REACT_DOCSTORE or AgentType.ZERO_SHOT_REACT_DESCRIPTION. The tool's name and description fields guide the agent in deciding when to search. Clear, specific descriptions produce more reliable tool selection in ReAct loops.
For parallel searches, run multiple SERPHouse API calls concurrently using Python's asyncio. Implement an async _arun method in your BaseTool subclass using aiohttp or httpx.AsyncClient. LangChain's AgentExecutor supports async execution. Alternatively, create multiple tool instances with different default parameters (e.g., different country codes) and let the agent choose between them.
OpenAI Tools agents (create_openai_tools_agent) are the most reliable for web search because the underlying model is trained specifically for tool selection. ReAct agents also work well with a clear tool description. For complex research workflows, LangGraph gives you explicit control over when search is triggered and how results flow through the agent.
Related Use Cases
Explore other production use cases for the SERPHouse Web Search API.
AI Agents
Build autonomous agents with real-time web grounding. Works with AutoGen, CrewAI, LangGraph, and custom frameworks.
Learn more
RAG Pipelines
Use SERPHouse as the retrieval layer in your RAG system. Fresh documents at query time, meaning no stale vector store.
Learn more
Real-Time News Monitoring
Keep your LangChain agent informed with live news. Surface breaking events and trending topics the moment they happen.
Learn more
Free tier available. No credit card. Your BaseTool calls the live web in under 10 minutes.
Need a custom plan or enterprise volume? Talk to our team →