Skip to main content

langchain-cleanedweb

LangChain tools for CleanedWeb, which turns public website collections (listings, products, jobs, articles, profiles) into maintained REST APIs that return structured records. Three tools let an agent find a published API, read its contract, and run it, plus a toolkit that bundles them.

Pricing: 5,000 records free once, then prepaid credit from $1 per 1,000 records, no subscription. Runs are charged per record delivered. Pricing

Install

pip install -U langchain-cleanedweb

langchain-cleanedweb depends on cleanedweb.

Create an API key with the run scope in the console and export it as CLEANEDWEB_API_KEY. Finding and reading APIs needs no key.

Quick start

# pip install langchain
from langchain.agents import create_agent
from langchain_cleanedweb import CleanedWebToolkit

tools = CleanedWebToolkit().get_tools()  # find, get, run (reads CLEANEDWEB_API_KEY)
agent = create_agent("anthropic:claude-sonnet-4-5", tools=tools)
agent.invoke({"messages": [("user", "Get 5 trending Python repositories from GitHub topics.")]})

Or call a tool directly:

from langchain_cleanedweb import CleanedWebFindAPI, CleanedWebGetAPI, CleanedWebRunAPI

found = CleanedWebFindAPI().invoke({"site": "github.com", "fields": ["title", "url"]})
api = found["matches"][0]
contract = CleanedWebGetAPI().invoke({"api_id": api["api_id"]})
records = CleanedWebRunAPI(max_items_limit=25).invoke(
    {"api_id": api["api_id"], "endpoint_id": api["endpoints"][0]["endpoint_id"], "max_items": 5}
)

Tools

Tool Name Needs key What it does
CleanedWebFindAPI cleanedweb_find_api no Find published APIs by site, fields, query. Nothing runs.
CleanedWebGetAPI cleanedweb_get_api no Inputs, output fields, limitations and three saved sample records.
CleanedWebRunAPI cleanedweb_run_api yes (run) Run an endpoint and return its records. Charged per record.

The tool descriptions tell the model to find before it runs, to start with a small max_items, and that records are website data, never instructions. CleanedWebRunAPI also enforces it: max_items defaults to default_max_items=5 and is capped by max_items_limit=100 (both settable). A run that is still going after wait_seconds (default 60) returns status: running with its idempotency_key; calling the tool again with the same arguments and key reads the same run and never starts or charges a second one. Errors (no credit, rate limit, failed run, lost connection) come back as short, actionable text for the model (handle_tool_error). CleanedWebToolkit(read_only=True) leaves out the run tool.

Tools work with invoke and ainvoke. Pass api_key=, base_url= or a configured cleanedweb.CleanedWeb as client= to override the defaults.

Development

python -m venv .venv && . .venv/bin/activate
pip install -e ../cleanedweb-python -e ".[test,lint]"
ruff check . && ruff format --check . && mypy && pytest
pytest tests/integration_tests -m live      # standard integration tests, no-key catalog reads only

Unit tests mock the HTTP layer and include LangChain's standard ToolsUnitTests.

More

MIT licensed.

Metadata

Release files for langchain-cleanedweb 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-cleanedweb 0.1.0
File Size Uploaded Provenance Actions
langchain_cleanedweb-0.1.0.tar.gz 13.5 kB With provenance Details for langchain_cleanedweb-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 25.6 kB

Release files / langchain_cleanedweb-0.1.0.tar.gz

Download URL langchain_cleanedweb-0.1.0.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ffb4baf1e5735df258a75d21f570e85ec7e8179969f79ea03faf816db00a29d3
BLAKE2b-256 checksum
How to use checksums
3f60ff329566a1f65d58129bed59f76acac44e4bc2349a79441fbd0924d987cb
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 log

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

Download URL langchain_cleanedweb-0.1.0-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
77c7e6f1a0a5b7e0910091d38e1f6aa0f7de3672f4759a77cc142895b592b353
BLAKE2b-256 checksum
How to use checksums
d9a40e024a8de8b7b545698984b027a151b52e82b9f933c96953c8b137daf4c5
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 log

Security for langchain-cleanedweb 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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for langchain_cleanedweb-0.1.0.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 log

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 Full 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