Skip to main content

langchain-piloterr

LangChain integration for Piloterr, a web data API.

It adds three components:

  • PiloterrGoogleSearch, a tool that searches Google;
  • PiloterrWebsiteScraper, a tool that reads a web page and returns its text;
  • PiloterrLoader, a document loader that turns web pages into LangChain documents.

Piloterr fetches pages on its own infrastructure in one of three ways:

  • crawler: plain HTTP, the default;
  • rendering: a headless browser, for JavaScript pages;
  • webunlocker: for pages behind anti-bot protection.

Installation

pip install -U langchain-piloterr

Get an API key at app.piloterr.com and set it in the environment:

export PILOTERR_API_KEY="your-api-key"

You can also pass api_key=... to any component.

Google search tool

from langchain_piloterr import PiloterrGoogleSearch

tool = PiloterrGoogleSearch(max_results=5, country="us")
tool.invoke({"query": "web scraping api"})

The tool returns the query and a results list. Each result has title, url, content (the snippet) and position.

Option Default Description
max_results 10 Results requested from Google, 1 to 100
country Two-letter country code, such as us
language Language code, optionally with a region, such as en-gb
location City or region to search from, such as Paris, France
timeout 60 Seconds to wait for Piloterr

Website scraper tool

from langchain_piloterr import PiloterrWebsiteScraper

tool = PiloterrWebsiteScraper(engine="rendering", wait_in_seconds=2)
print(tool.invoke({"url": "https://example.com"}))

The tool returns the page title as a heading, followed by the readable text. Scripts, styles and markup are removed. The text is cut at max_characters (20,000 by default; None keeps everything).

Option Default Description
engine crawler crawler, rendering or webunlocker
wait_in_seconds Rendering only: extra wait after the page loads, 0 to 30
max_characters 20000 Truncate the returned text
timeout 120 Seconds to wait for Piloterr

Both tools return API errors to the model as text instead of raising, and the key never appears in them. Piloterr reports a rate limit as HTTP 401 with "Rate limit exceeded"; the tools say "rate limit exceeded" in that case.

With an agent

from langchain.agents import create_agent
from langchain_piloterr import PiloterrGoogleSearch, PiloterrWebsiteScraper

agent = create_agent("openai:gpt-4.1-mini", tools=[PiloterrGoogleSearch(), PiloterrWebsiteScraper()])
agent.invoke({"messages": [{"role": "user", "content": "Summarize the home page of piloterr.com"}]})

Document loader

from langchain_piloterr import PiloterrLoader

loader = PiloterrLoader(
    ["https://example.com", "https://www.python.org"],
    engine="crawler",
    continue_on_failure=True,
)
docs = loader.load()

Each document's page_content is the readable text of the page. Its metadata holds source, title and engine. Set include_html=True to also keep the raw HTML in metadata["html"].

All components have async versions (ainvoke, aload).

Development

pip install -e ".[test]"
pytest tests/unit_tests                         # offline
PILOTERR_API_KEY=... pytest tests/integration_tests  # live

License

MIT

Metadata

Release files for langchain-piloterr 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-piloterr 0.1.0
File Size Uploaded Provenance Actions
langchain_piloterr-0.1.0.tar.gz 11.0 kB Without provenance Details for langchain_piloterr-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-piloterr 0.1.0
File Interpreter ABI Platform Actions
langchain_piloterr-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_piloterr-0.1.0-py3-none-any.whl

Total release size: 21.5 kB

Release files / langchain_piloterr-0.1.0.tar.gz

Download URL langchain_piloterr-0.1.0.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8f9ef0e1cbad0e5b177c80da505a87c3c7447096843e948c5d685a354b7d26a6
BLAKE2b-256 checksum
How to use checksums
85cb8a121efc2f9a40699be19eef298c079dd19646a4333c451eaa9620cccbae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / langchain_piloterr-0.1.0-py3-none-any.whl

Download URL langchain_piloterr-0.1.0-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e218a3b2133bf72f5d035febcae0e4bcf25e380d23e8687aa9ade0c328da73a
BLAKE2b-256 checksum
How to use checksums
69d153dbbc54b9b9483eb98c4624d3b19a05d8db59bcbe80d3285adc04453705
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for langchain-piloterr 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page