SERPHouse AI SDK
Python SDK for the SERPHouse search API — with first-class integrations for LangChain and LlamaIndex.
Drop live Google, Bing, and Yahoo search data into your AI agents. No boilerplate, no custom API clients — just import, configure, and let your agent search the web.
Table of Contents
- Why SERPHouse AI SDK
- Installation
- Quick Start
- API Key
- Tools Reference
- Advanced Usage
- Development
- Contributing
- License
Why SERPHouse AI SDK
| Zero boilerplate | Two lines to add web search, news, or video results to any LangChain or LlamaIndex agent |
| Framework-native | Functions return standard StructuredTool / FunctionTool objects — no wrappers, no adapters |
| Live SERP data | Every call hits the SERPHouse API in real time. No cached or stale results. |
| Production-ready | Built on requests and pydantic with typed schemas, configurable timeouts, and clear error handling |
Installation
pip install serphouse-ai-sdk
With framework extras:
pip install serphouse-ai-sdk[langchain]
pip install serphouse-ai-sdk[llamaindex]
pip install serphouse-ai-sdk[all] # both frameworks
Quick Start
Set the SERPHOUSE_API_KEY environment variable (or pass it per tool).
LangChain
from langchain.agents import create_agent
from langchain_openai import ChatOpenAI
from serphouse.langchain import search, news, short_video
agent = create_agent(
model=ChatOpenAI(model="gpt-4"),
tools=[search(), news(), short_video()],
)
response = agent.invoke({
"messages": [{"role": "user", "content": "Latest AI news from OpenAI"}]
})
print(response["messages"][-1].content)
LlamaIndex
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from serphouse.llamaindex import search, news, short_video
agent = FunctionAgent(
llm=OpenAI(model="gpt-4"),
tools=[search(), news(), short_video()],
)
response = agent.run("Latest AI news from OpenAI")
print(response)
API Key
Get your key at serphouse.com and choose one of:
| Method | Example |
|---|---|
| Environment variable (recommended) | export SERPHOUSE_API_KEY=your_key_here |
| Per-tool options dict | search({"api_key": "your_key_here"}) |
| SERPHouseClient | SERPHouseClient(api_key="your_key_here") |
Tools Reference
| Tool | Framework | Endpoint | Description |
|---|---|---|---|
search() |
LangChain, LlamaIndex | /web-search-lite |
General web search |
news() |
LangChain, LlamaIndex | /google-news |
Google News search |
short_video() |
LangChain, LlamaIndex | /google-short-videos-api |
Google Short Videos (Shorts) |
All tools accept the following parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
q |
str |
— | Search query (required) |
domain |
str |
google.com |
Search domain |
lang |
str |
en |
Search language code |
loc |
str |
New York,New York,United States |
Location (City,State,Country) |
device |
str |
desktop |
desktop or mobile |
page |
int |
— | Page number |
date_range |
str |
y |
h (hour), d (24h), w (week), m (month), y (year), or YYYY-MM-DD,YYYY-MM-DD |
gl |
str |
US |
Country code (ISO 3166-1 alpha-2, search only) |
video_quality |
str |
high |
Video quality (short_video only) |
Advanced Usage
Custom API key per tool
from serphouse.langchain import search
tool = search({"api_key": "your-key"})
SERPHouseClient
Use the raw client directly for custom integrations:
from serphouse import SERPHouseClient
client = SERPHouseClient(api_key="your-key")
result = client.post("/web-search-lite", {"q": "python sdk"})
print(result)
Development
# Clone and enter the repo
git clone https://github.com/serphouse/ai-sdk.git
cd ai-sdk
# Create a virtual environment
python3 -m venv venv
source venv/bin/activate
# Install in editable mode with all dev dependencies
pip install -e ".[test]"
# Run tests
pytest tests -v
# Run only unit tests (skip OpenAI integration tests)
pytest tests -v -k "not Integration"
# Run integration tests (requires OPENAI_API_KEY)
OPENAI_API_KEY=sk-... pytest tests -v -k "Integration"
Contributing
Contributions are welcome. Please keep changes focused and match existing code style.
git checkout -b feature/your-feature
pip install -e ".[test]"
# make changes
pytest tests -v
git commit -m "Add your feature"
git push origin feature/your-feature
Then open a Pull Request. Update this README if you change setup or configuration.
License
MIT License — Copyright SERPHouse.
Metadata
Release files for serphouse-ai-sdk 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 |
|---|---|---|---|---|
| serphouse_ai_sdk-0.1.1.tar.gz | 10.9 kB | Without provenance | Details for serphouse_ai_sdk-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| serphouse_ai_sdk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for serphouse_ai_sdk-0.1.1-py3-none-any.whl |
Total release size: 18.8 kB
Release files / serphouse_ai_sdk-0.1.1.tar.gz
| Download URL | serphouse_ai_sdk-0.1.1.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07d2edec835278869deb277e72481ebcd0f056c19ef87cce7a0429cc12dbf7ba
|
|
BLAKE2b-256 checksum How to use checksums |
f830a12f5744eac6f45ad2cbc4eb80a6da5651752a8069752b9d09917cbb0787
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / serphouse_ai_sdk-0.1.1-py3-none-any.whl
| Download URL | serphouse_ai_sdk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a20e06068171baafea4a0fa3a04143526ec6d3a5e44d8408fc7bee7b8e6a1a9d
|
|
BLAKE2b-256 checksum How to use checksums |
2f6b157caee76e10c1bbe1c8ac388b431f97eca5c6765b24f5e0c1a8ae1d29ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for serphouse-ai-sdk 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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.