← All guides · SDK guides · Markdown: /guides/sdk/langchain-python.md
Lordevo tools for LangChain (Python)
Needs lordevo-x402 0.1.5 or later (on npm and PyPI; 0.1.3 has the LangChain tools but not trial=True).
Five web tools for a LangChain agent, paid per call with x402 (USDC on Base). No account and no API key. The tools come from the lordevo_x402.langchain module that ships inside the package; this folder adds the curated tool list and a runnable example.
| Tool | What it does | Price per call |
|---|---|---|
page_markdown | A web page as clean, LLM-ready Markdown | $0.003 |
can_fetch | robots.txt + AI-crawler permission check for a URL | $0.003 |
tech_stack | What a site is built with (CMS, frameworks, analytics) | $0.003 |
dns_lookup | DNS records (A, AAAA, CNAME, MX, TXT, NS, SOA, CAA) | $0.003 |
email_validate | Email syntax + domain + MX (no mailbox probing) | $0.003 |
Prices are from the shop's price table (checked 20 Nov 2026, after the price floor moved to $0.003; lordevo-x402 package READMEs before 0.1.7 show older prices). The live price is always the one in the HTTP 402 and in https://shop.lordevo.com/catalog.json.
Tool names in the table use underscores (page_markdown), as in MCP and the SDK; only= lists and catalogue slugs use hyphens (page-markdown).
Install
pip install "lordevo-x402[pay,langchain]>=0.1.5" langchain
pay brings x402[httpx,requests,evm] and eth-account; the EVM signer also needs web3, which x402[evm] installs. Without pay, only free trial calls work.
Use (5 lines)
import os
from langchain.agents import create_agent
from lordevo_x402 import LordevoSync
from lordevo_x402.langchain import langchain_tools
tools = langchain_tools(sync_client=LordevoSync.from_private_key(os.environ["AGENT_WALLET_KEY"], trial=True, max_price_usd=0.01), only=["page-markdown", "can-fetch", "tech-stack", "dns-lookup", "email-validate"])
agent = create_agent(os.environ["LANGCHAIN_MODEL"], tools=tools)
Then agent.invoke({"messages": [{"role": "user", "content": "Read https://example.com and summarise it."}]}). Leave out only= to get all tools.
Free trial
With trial=True the first calls of the day are free: 3 calls per IP per UTC day on tools priced up to $0.005 (all five tools here). After that the client pays. Without a wallet key, use LordevoSync(trial=True): free calls only; when they are used up a call raises LordevoError (status 402, .used_up_today), which LangChain's agent hands back to the model as the tool error.
How payment works
An unpaid request gets HTTP 402 with the price. The x402 requests session signs a USDC payment from your agent wallet on Base and retries; the shop's facilitator settles it, so the wallet needs USDC but no ETH for gas. max_price_usd refuses any tool priced above it before a request is made. Answers of 400 or higher are not charged. Use a separate agent wallet with a small balance; key in an environment variable, never in code. from_private_key pays on Base mainnet (eip155:8453) only.
Run the example
python example.py # free trial calls only
AGENT_WALLET_KEY=0x... python example.py # free first, then paid
It invokes each tool once without an LLM, plus one bad input, and prints what happened. make_client() in the example is from_private_key written out, so the network can be set for a test copy of the shop (LORDEVO_X402_NETWORK).
MIT licence, like lordevo-x402. LangChain is MIT-licensed; only its public StructuredTool API is used.
Files
All SDK guides: https://shop.lordevo.com/guides/sdk