Skip to main content

langchain-webextract

LangChain tools for WebExtract. The tool names and outputs match the WebExtract MCP tools:

  • extract_url: clean Markdown plus fixed-schema JSON (metadata, product and price with price_detail, tables). $0.005 or 1 credit.
  • page_markdown: clean Markdown only. $0.002 or 0.4 credit.
pip install langchain-webextract

This also installs the core client from PyPI webextract-sdk (imported as webextract). For x402 pay per call add pip install "webextract-sdk[x402]".

from langchain_webextract import WebExtractExtractUrl, WebExtractPageMarkdown, get_webextract_tools
from webextract import WebExtract

tools = get_webextract_tools()                                    # free tier, or WEBEXTRACT_API_KEY if set
tools = get_webextract_tools(api_key="lx_...")                     # prepaid credits (SecretStr field)
tools = get_webextract_tools(client=WebExtract(api_key="lx_..."))  # prepaid credits
print(WebExtractPageMarkdown().invoke({"url": "https://example.com"}))

x402 pay per call (async). Build the paying client with the official x402 SDK, then hand it over. This package never sees the private key.

from webextract import AsyncWebExtract
tool = WebExtractExtractUrl(async_client=AsyncWebExtract(payment_client=x402_httpx_client))
await tool.ainvoke({"url": "https://web-scraping.dev/product/1"})

The tools return a JSON string. By default, API errors come back to the model as {"ok": false, "error": {"error", "status", "message", "charged", "reason", "hint", ...}}, so an agent can react to free_limit_reached, robots_disallowed and so on. Set on_error="raise" to raise webextract.WebExtractError subclasses instead.

Tests

pytest --disable-socket --allow-unix-socket tests/unit_tests                  # mocks + langchain-tests ToolsUnitTests
pytest --disable-socket --allow-unix-socket tests/integration_tests           # ToolsIntegrationTests, offline (mocked API)
WEBEXTRACT_SANDBOX_TESTS=1 X402_TESTNET_ENV_FILE=/path/to/testnet.env \
  pytest tests/integration_tests/test_standard_sandbox.py                     # live sandbox, Base Sepolia TEST USDC only

License: MIT © TAINCHENG, L.L.C.

Metadata

Release files for langchain-webextract 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-webextract 0.1.0
File Size Uploaded Provenance
langchain_webextract-0.1.0.tar.gz 7.8 kB With provenance Details

Built distribution (wheel)

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

Total release size: 13.3 kB

Release files / langchain_webextract-0.1.0.tar.gz

Download URL langchain_webextract-0.1.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
554d7646a6459d72527e230c6e73572ea0ba56fe9c62439473d71f2165a16330
BLAKE2b-256 checksum
How to use checksums
1a15e25cf98b66afbd6cdfea40df5980c426b6f61e69e415f72c60ea938921a8
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 Oct 21, 2026.

Transparency log

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

Download URL langchain_webextract-0.1.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61e80760c3c10414640ffefce7b0addd9c461ff46299c9a023bb73f8eb8b3072
BLAKE2b-256 checksum
How to use checksums
0e0970756203691ba78bf9be1692bf4ee3fb331a6d26573596112ba5d7d49a29
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 Oct 21, 2026.

Transparency log

Security for langchain-webextract 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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for langchain_webextract-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 Oct 21, 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.

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