Serqo Python SDK
Official Python client for the Serqo Search API. Retrieve clean, structured Google & Bing SERP results in JSON with zero proxy setup.
Get started with 100 free requests on serqo.io.
Highlights
- Standard Library Only: Zero external dependencies. Uses Python's built-in
urllibandjson. - Clean Structured JSON: Returns normalized titles, organic snippets, answer boxes, sitelinks, and rich SERP features without HTML parsing overhead.
- Drop-in SerpApi Alternative: Sub-second latency, transparent pay-as-you-go pricing from $0.001/query, and no mandatory monthly subscriptions.
- AI Agent Ready: Ultra-compact token footprints for LangChain, LlamaIndex, and CrewAI pipelines.
- Multi-Round Autocomplete: Real-time search suggestions with A-Z alphabet soup and question keyword expansion.
Installation
pip install serqo
Quick Start
import os
from serqo import Serqo
# 1. Initialize client with your API key from https://serqo.io/console/keys
client = Serqo(api_key=os.environ["SERP_API_KEY"])
# 2. Run a Google web search
response = client.search({
"q": "open source ai agents",
"engine": "google",
"type": "web",
"gl": "us",
"hl": "en",
})
# 3. Read normalized organic results
for item in response["data"]["results"][:5]:
print(f"- {item['title']}: {item['link']}")
Real-Time Search Suggestions & Keyword Mining
Serqo provides programmatic access to Google's real-time autocomplete suggestions, including A-Z alphabet soup and question keyword discovery:
# Direct completion (instant ~200ms suggestions)
suggest = client.autocomplete({"q": "langchain", "strategy": "normal"})
print(suggest["data"]["suggestions"])
# 26-Letter A-Z Alphabet Soup Expansion (dispatches 27 parallel sub-queries)
alphabet = client.autocomplete({
"q": "nextjs",
"strategy": "alphabet",
"gl": "us",
"hl": "en"
})
print(f"Discovered {alphabet['meta']['totalKeywords']} keywords across 26 letters:")
for item in alphabet["data"]["suggestions"][:10]:
print(f"- [{item['group']}] {item['keyword']}")
Supported expansion strategies: normal, alphabet, questions, prepositions, intent, seo_matrix, deep.
Using as a Tool with LangChain & AI Agents
Serqo's lightweight JSON payloads prevent LLM context-window bloating. Here is a production-ready LangChain BaseTool example:
from typing import Type
from pydantic import BaseModel, Field
from langchain_core.tools import BaseTool
from serqo import Serqo
class SearchInput(BaseModel):
query: str = Field(description="Search terms to look up on Google")
class SerqoSearchTool(BaseTool):
name: str = "google_search"
description: str = "Search Google for current news, technical documentation, or real-time facts."
args_schema: Type[BaseModel] = SearchInput
client: Serqo = None
def __init__(self, api_key: str):
super().__init__()
self.client = Serqo(api_key=api_key)
def _run(self, query: str) -> str:
try:
res = self.client.search({"q": query, "engine": "google", "type": "web"})
results = res.get("data", {}).get("results", [])[:3]
formatted = [f"[{r.get('title')}]({r.get('link')}): {r.get('snippet')}" for r in results]
return "\n\n".join(formatted) or "No search results found."
except Exception as e:
return f"Search error: {str(e)}"
# Ready to use in any LangChain Agent or ReAct loop!
tool = SerqoSearchTool(api_key=os.environ["SERP_API_KEY"])
print(tool.run("what is serqo search api"))
Pagination & Advanced Parameters
# First page
page1 = client.search({"q": "best coffee", "engine": "google", "type": "web"})
# Next page using nextStart token
if page1["data"]["pagination"].get("hasNext"):
next_start = page1["data"]["pagination"]["nextStart"]
page2 = client.search({
"q": "best coffee",
"engine": "google",
"type": "web",
"start": next_start,
})
Idempotency & Safe Retries
To retry network timeouts without double-charging your account balance, pass a unique idempotency_key:
import uuid
key = str(uuid.uuid4())
response = client.search(
{"q": "financial reports", "engine": "google", "type": "news"},
idempotency_key=key,
)
Within 24 hours, sending the same idempotency_key returns the cached original result with zero additional charge.
Error Handling
API errors raise SerqoError, containing HTTP status and machine-readable error codes:
from serqo import Serqo, SerqoError
try:
res = client.search({"q": "test", "engine": "google", "type": "web"})
except SerqoError as err:
print(f"Status: {err.status}, Code: {err.code}, RequestId: {err.request_id}")
if err.retryable:
print(f"Retry allowed after {err.retry_after_ms}ms")
Common status codes:
401 UNAUTHORIZED: Missing or invalid API key.402 INSUFFICIENT_CREDITS: Account balance exhausted. Top up on serqo.io/pricing.422 INVALID_PARAM: Missing required parameter or invalid option.429 QUOTA_EXCEEDED: Concurrency rate limit exceeded.
Documentation & Support
- Web Documentation: https://serqo.io/docs
- Interactive Playground: https://serqo.io/console/playground
- Get API Key (100 Free Credits): https://serqo.io
- License: MIT
Metadata
Release files for serqo 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| serqo-0.1.1.tar.gz | 6.6 kB | With provenance | Details for serqo-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| serqo-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for serqo-0.1.1-py3-none-any.whl |
Total release size: 13.3 kB
Release files / serqo-0.1.1.tar.gz
| Download URL | serqo-0.1.1.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b2094274b43e0db49119bae7a8f38333f2258a380ecf3f8b93247b3e30795102
|
|
BLAKE2b-256 checksum How to use checksums |
4be13dcf627cfecaf0825d3e08a3af3f437a69954e39bb0930f36183e5e67dcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / serqo-0.1.1-py3-none-any.whl
| Download URL | serqo-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb9e5b7b6f6c95b409d10d8a4710d93d74470bceb554433b08102f7a0cfe46c0
|
|
BLAKE2b-256 checksum How to use checksums |
bc5d911faea576b29b3f8537d752294df83e0c8918a947ab50b3e17f609641ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logSecurity for serqo 0.1.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for serqo-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logA 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.