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)
ClawFetchCompany clawfetch_company $0.02 Company profile from a domain: socials, emails, phones, tech stack, key pages
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.2.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.2.0
File Size Uploaded Provenance Actions
langchain_clawfetch-0.2.0.tar.gz 7.7 kB Without provenance Details for langchain_clawfetch-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 15.0 kB

Release files / langchain_clawfetch-0.2.0.tar.gz

Download URL langchain_clawfetch-0.2.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
584e083d810105dc0bf38c3cd8aa3adb5dda2d5cff6ee9d7da883caac1216635
BLAKE2b-256 checksum
How to use checksums
e9764a88c95d78c90af5103e3ff53f00c201126c08478c49c0488920c418a89d
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.2.0-py3-none-any.whl

Download URL langchain_clawfetch-0.2.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad5e8382cc9b66a6cbf4aae98460370e19f760ba96dc8c7a8d34dbee486ee10b
BLAKE2b-256 checksum
How to use checksums
e23e5b95d8564dbfec36818f3a370aca88270b07a5a5df93b2ec750ced43d919
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.2.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.2.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