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.1

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.1
File Size Uploaded Provenance Actions
langchain_webextract-0.1.1.tar.gz 7.7 kB With provenance Details for langchain_webextract-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 13.3 kB

Release files / langchain_webextract-0.1.1.tar.gz

Download URL langchain_webextract-0.1.1.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8270ad59f0552478a9ab2de416f3190099bde68b38be4cee072c4046e4d4470b
BLAKE2b-256 checksum
How to use checksums
69de2b95ef86c281ea38ca00de1328b3b94e83110a58bcdd1e73285924b30700
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 24, 2026.

Transparency log

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

Download URL langchain_webextract-0.1.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c012f40add471e00ae51ab6d6765c86f08a31c3ee97030cb558154d606d9f2b
BLAKE2b-256 checksum
How to use checksums
fc0547e0fd0139f3ca4d447e8103ed72e8642b608604dfd32db3786407417b7e
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 24, 2026.

Transparency log

Security for langchain-webextract 0.1.1

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_webextract-0.1.1.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 24, 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.1 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