Skip to main content

langchain-clawfetch

LangChain tools for ClawFetch, a pay-per-call web intelligence API for AI agents. Each call is paid with an x402 micropayment in USDC on Base.

Install

pip install langchain-clawfetch

Wallet

You need a Base wallet private key that holds USDC. There is no API key and no signup. Payments are gasless EIP-3009 transfers signed locally by the clawfetch SDK, so the wallet does not need ETH. Use a dedicated wallet with a small balance.

export CLAWFETCH_PRIVATE_KEY=0x...

Quickstart

from langchain_clawfetch import ClawFetchToolkit

tools = ClawFetchToolkit().get_tools()  # reads CLAWFETCH_PRIVATE_KEY
# or: ClawFetchToolkit(private_key="0x...", max_chars=8000)

fetch = tools[0]
print(fetch.invoke({"url": "https://example.com"}))

To use the tools with an agent:

from langchain.agents import create_agent

agent = create_agent(llm, tools=tools)  # llm: any LangChain chat model
agent.invoke({"messages": [{"role": "user", "content": "What's new on news.ycombinator.com?"}]})

You can also create a single tool, or pass an existing client:

from clawfetch import ClawFetch, AsyncClawFetch
from langchain_clawfetch import ClawFetchResearch

research = ClawFetchResearch(client=ClawFetch(private_key="0x..."), async_client=AsyncClawFetch(private_key="0x..."))

Every tool supports invoke and ainvoke. Async calls use AsyncClawFetch.

Tools

Tool Name Price per call What it does
ClawFetchFetch clawfetch_fetch $0.001 URL to readable text (no JavaScript)
ClawFetchRender clawfetch_render $0.005 JavaScript-rendered page to text
ClawFetchExtract clawfetch_extract $0.008 Typed JSON from 17 supported sites
ClawFetchResearch clawfetch_research $0.02 Web search plus source texts for citations
ClawFetchParse clawfetch_parse $0.005 Office document or PDF at a URL to Markdown (no OCR)
ClawFetchDomainsCheck clawfetch_domains_check $0.003 Domain availability
ClawFetchDomainsSuggest clawfetch_domains_suggest $0.003 Generate and check domain names from keywords

Supported clawfetch_extract sites: twitter, coingecko, github, news, npm, pypi, crates, hackernews, youtube, wikipedia, producthunt, imdb, amazon, crunchbase, sec-edgar, zillow, redfin.

Output and errors

Tools return a string. Fetch and render return the page title, URL and text. Parse returns Markdown. The other tools return the API response as JSON. Output is cut at max_chars (default 10,000).

SDK errors (PaymentError, RateLimitError, ApiError, NetworkError) are raised as ToolException. To hand the message to the model instead of raising, pass handle_tool_error=True when you create a tool.

License

MIT

Metadata

Release files for langchain-clawfetch 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-clawfetch 0.1.0
File Size Uploaded Provenance
langchain_clawfetch-0.1.0.tar.gz 7.4 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 14.4 kB

Release files / langchain_clawfetch-0.1.0.tar.gz

Download URL langchain_clawfetch-0.1.0.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
abe0f58297564ddb01dcd5e8c65dd8f62622e07c315d92132e170deaeb01c9c1
BLAKE2b-256 checksum
How to use checksums
637f20ca5404cc716441b004d376094b0ceefa2c982e25df624888aaa78802b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

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

Download URL langchain_clawfetch-0.1.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a906b75322849b2ddd2653fccd6a55c23cc601c03074ed4a57009604ad7f9888
BLAKE2b-256 checksum
How to use checksums
e7dbc563a5d53b9fda98d7c2751057ca371ab5046d72c807b0fe8f954fa832f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

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

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