Skip to content

New Official SDKs for TypeScript, Python and Go

SerpKite
Get API key

Python · langchain-serpkite

LangChain + SerpKite

Give a LangChain agent real-time Google search with the official langchain-serpkite package: a ready-made search tool, a retriever that returns Documents, and a loader that turns any URL into Markdown.

Overview

What LangChain is, and where SerpKite fits

LangChain is the most widely used Python framework for LLM apps and agents. langchain-serpkite is SerpKite's first-party integration package, built on the official serpkite Python SDK.

SerpKiteSearch returns the results page as compact Markdown, so the agent spends fewer tokens reading results. SerpKiteSearchResults returns a JSON list when you want structured rows, and SerpKiteRetriever returns Document objects for RAG chains.

Setup

Set it up in 4 steps

  1. 1

    Get an API key

    Sign up (no card), create a key in the dashboard and export it as SERPKITE_API_KEY. New accounts get 2,500 free credits, then 1,000 every month.

    export SERPKITE_API_KEY=skt_live_…
  2. 2

    Install langchain-serpkite

    Any chat model provider works; the example uses OpenAI.

    pip install -U langchain-serpkite langchain langchain-openai
  3. 3

    Create the search tool

    SerpKiteSearch() reads SERPKITE_API_KEY and returns Markdown the model can read directly.

  4. 4

    Create the agent and ask a question

    Pass the tool to create_agent. The model decides when to search.

Code

Complete example

from langchain.agents import create_agent
from langchain_serpkite import SerpKiteSearch

search = SerpKiteSearch()  # reads SERPKITE_API_KEY, returns Markdown

agent = create_agent(
    model="openai:gpt-5-mini",
    tools=[search],
    system_prompt="You are a research assistant. Search before answering and cite URLs.",
)

result = agent.invoke(
    {"messages": [{"role": "user", "content": "Who won the most recent Tour de France?"}]}
)
print(result["messages"][-1].content)

What's in the package

Tools, retriever and loader

  • SerpKiteSearch

    a tool that returns the results page as Markdown (AI Overview, results, People Also Ask). The best default for agents.

  • SerpKiteSearchResults

    a tool that returns a JSON list of results (title, link, snippet, position) when you need structured rows.

  • SerpKiteRetriever(k=5, include_content=2)

    a retriever that returns list[Document], optionally with full page content.

  • SerpKiteWebpageLoader([urls])

    a document loader that reads any public URL as clean Markdown via /v1/webpage.

  • SerpKiteAPIWrapper

    the underlying wrapper if you want to call the API from your own tool.

Go deeper

Let the agent read pages too

Search snippets are often not enough. Load full pages with SerpKiteWebpageLoader, or give the agent a second tool that reads a URL as Markdown (1 credit per page).

Python
from langchain.agents import create_agent
from langchain_core.tools import tool
from langchain_serpkite import SerpKiteSearch, SerpKiteWebpageLoader


@tool
def read_webpage(url: str) -> str:
    """Fetch a public web page and return its main content as Markdown."""
    docs = SerpKiteWebpageLoader([url]).load()
    return docs[0].page_content if docs else "Could not read the page."


agent = create_agent(model="openai:gpt-5-mini", tools=[SerpKiteSearch(), read_webpage])

FAQ

LangChain and SerpKite: common questions

Start building

Give your LangChain project Google search

2,500 free credits, then 1,000 every month. No credit card.