Metadata-Version: 2.5
Name: langchain-reserp
Version: 0.2.0
Summary: Minimal LangChain tool for the Reserp Google Search API v2 URL index
Project-URL: Homepage, https://reserp.ai/
Project-URL: Documentation, https://reserp.ai/docs
Project-URL: Repository, https://github.com/reserp-ai/langchain-reserp
Project-URL: Issues, https://github.com/reserp-ai/langchain-reserp/issues
Author: Reserp
License: MIT
License-File: LICENSE
Keywords: google-search,langchain,reserp,search-api,serp-api
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: langchain-core<2,>=0.3
Description-Content-Type: text/markdown

# LangChain Reserp

A minimal LangChain tool for the [Reserp Google Search API v2](https://reserp.ai/docs).

The tool accepts a complete Google Search URL, makes one request to `POST /v2/serp/urls`, and returns the public JSON payload unchanged. The v2 URL index is flat, page ordered, and deduplicated, with an optional visible-text field on each URL. The package adds no retries, timeout policy, concurrency management, caching, queues, result conversion, or automatic pagination.

## Installation

```bash
pip install langchain-reserp
```

## Usage

```python
import os

from langchain_reserp import ReserpSearchTool

os.environ["RESERP_API_KEY"] = "your-api-key"

tool = ReserpSearchTool()
result = tool.invoke(
    {"url": "https://www.google.com/search?q=photonic+computing&gl=us&hl=en"}
)

if result["ok"]:
    for item in result["urls"]:
        print(item.get("text"), item["url"])
```

Every successful response includes `pagination.next_url`. Submit that value in a later tool call to advance; its presence does not prove another page contains results. Do not infer pagination from `len(result["urls"])`.

The surrounding application owns retries, timeouts, task queues, concurrency, observability, and pagination. When the API reports `retryable`, this package exposes that field and takes no action itself.

## Migrating from 0.1

Version 0.2 moves from the v1 recursive `results[]` response to the v2 flat `urls[]` index. Other notable field renames are `url` → `request.url`, `finalUrl` → `page.url`, `pagination.nextUrl` → `pagination.next_url`, and `billingSource` → `billing_source`.

For typed result families, SERP features, and explicit positions, call the [structured v2 endpoint](https://reserp.ai/docs/structured) directly or use an official Reserp SDK.

## API contract

- [Reserp API documentation](https://reserp.ai/docs)
- [OpenAPI definition](https://reserp.ai/openapi.json)
- [Postman collection](https://www.postman.com/reserp-ai/reserp-google-search-api)

## License

MIT
