# LangChain Integration (/docs/langchain)



The SERPHouse AI SDK is a Python SDK for the SERPHouse search API, built to plug live web search data directly into AI agents. It provides first-class, framework-native integrations for both LangChain and LlamaIndex.

<ResourceCards>
  <ResourceCard title="GitHub" subtitle="SERPHouse/ai-sdk-python" href="https://github.com/SERPHouse/ai-sdk-python" icon="github" />

  <ResourceCard title="PyPI" subtitle="serphouse-ai-sdk" href="https://pypi.org/project/serphouse-ai-sdk/" icon="pypi" />
</ResourceCards>

## Installation [#installation]

<Callout type="success">
  Quick setup with a single pip command.
</Callout>

```bash
pip install serphouse-ai-sdk[langchain]
```

<Callout type="info">
  For all frameworks: 

  <code>pip install serphouse-ai-sdk[all]</code>
</Callout>

## API Key Setup [#api-key-setup]

<Callout type="warn">
  Set your <code>SERPHOUSE\_API\_KEY</code> environment variable before using the SDK.
</Callout>

```bash
export SERPHOUSE_API_KEY=your_key_here
```

## Available Tools [#available-tools]

| Tool            | Description                | Endpoint                   |
| --------------- | -------------------------- | -------------------------- |
| `search()`      | Google Web Search          | `/web-search-lite`         |
| `news()`        | Google News Search         | `/google-news`             |
| `short_video()` | Google Short Videos Search | `/google-short-videos-api` |

## Usage Example [#usage-example]

```python
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)
```

<Callout type="idea">
  Works with OpenAI, Anthropic Claude, and Google Gemini models.
</Callout>

## Related Links [#related-links]

<Cards>
  <Card title="LlamaIndex" href="/llamaindex" />

  <Card title="Vercel AI SDK" href="/vercel-ai-sdk" />

  <Card title="MCP Server" href="/mcp-server" />
</Cards>
