Skip to main content

x402 Agent Tools ⚡

Zero API-key, pay-per-call agent tools for LangChain, CrewAI, and ElizaOS.
Powered by open x402 micropayments in USDC on Base mainnet.

Agents sign an EIP-3009 transfer authorization with their own EVM key for fractions of a cent per call. No credit cards, no monthly SaaS subscriptions.


Tools Included

Tool Endpoint Cost Description
Web Reader /v1/read $0.005 Strips ads and boilerplate, extracts clean Markdown + tokens
Web Search /v1/search $0.005 Live multi-engine search (TinyFish, DDGS, Jina)
JSON Extractor /v1/extract-json $0.015 Schema-driven structured data extraction
Stealth Fetch /v1/fetch-stealth $0.010 Browser TLS & headers impersonation for anti-bot bypass
CAPTCHA Solver /v1/solve-captcha $0.001–0.0025 Solves Turnstile, reCAPTCHA v2, Cloudflare

Installation

pip install x402-agent-tools
# or for LangChain / CrewAI:
pip install "x402-agent-tools[langchain]"
pip install "x402-agent-tools[crewai]"

Quickstart (Python SDK)

import os
from x402_agent_tools import X402Client

client = X402Client(private_key=os.getenv("EVM_PRIVATE_KEY"))

# 1. Read webpage into clean markdown ($0.005)
markdown = await client.read_web_page("https://news.ycombinator.com")
print(markdown["content"])

# 2. Live web search ($0.005)
results = await client.search_web("Base L2 ecosystem news")
for r in results["results"]:
    print(r["title"], "->", r["url"])

# 3. Extract structured JSON ($0.015)
product = await client.extract_json(
    url="https://example.com/product",
    schema={"fields": ["name", "price", "stock_status"]}
)
print(product["data"])

LangChain / LangGraph Integration

from langchain.agents import initialize_agent, AgentType
from langchain_openai import ChatOpenAI
from x402_agent_tools.langchain import X402WebReaderTool, X402WebSearchTool

llm = ChatOpenAI(model="gpt-4o-mini")
tools = [
    X402WebReaderTool(private_key="0x..."),
    X402WebSearchTool(private_key="0x...")
]

agent = initialize_agent(tools, llm, agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION)
agent.run("What are the latest developer updates on Base blockchain?")

CrewAI Integration

from crewai import Agent, Task, Crew
from x402_agent_tools.crewai import CrewWebReaderTool, CrewWebSearchTool

researcher = Agent(
    role="Web Researcher",
    goal="Gather live web intel without needing third-party API keys",
    tools=[CrewWebSearchTool(), CrewWebReaderTool()],
    verbose=True
)

ElizaOS Plugin (TypeScript)

For ElizaOS agents, use the included plugin:

npm install @drain54/plugin-x402-tools

In character.json:

{
  "name": "ResearchBot",
  "plugins": ["@drain54/plugin-x402-tools"],
  "settings": {
    "secrets": {
      "EVM_PRIVATE_KEY": "0x..."
    }
  }
}

Architecture & Settlement

  1. Agent sends request to https://verify.drain54.my.id/v1/...
  2. Server returns 402 Payment Required with exact USDC amount and EIP-712 domain.
  3. Client signs standard EIP-3009 TransferWithAuthorization.
  4. PayAI facilitator verifies signature and broadcasts gasless Multicall3 settlement on Base.
  5. Server fulfills request with fresh data.

License

MIT

Release files for x402-agent-tools 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 x402-agent-tools 0.1.0
File Size Uploaded
x402_agent_tools-0.1.0.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for x402-agent-tools 0.1.0
File Interpreter ABI Platform
x402_agent_tools-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / x402_agent_tools-0.1.0.tar.gz

Download URL x402_agent_tools-0.1.0.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3f7b304e317f868a70f0839133e0e62662e2f79701b0dc949dde4707b8826ae4
BLAKE2b-256 checksum
How to use checksums
8fe73da0bc51303843e2ad4f97a3b3fa9181c2ad32106fb3696ed2861b30f7d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

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

Download URL x402_agent_tools-0.1.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba19535c773cc2537fb344cdcbe6dd96428e9bb64d4310868b0e2e805ef04793
BLAKE2b-256 checksum
How to use checksums
6007237509a38b3b633025d64c7761232508623acdfdd39daf1a31c15186ed87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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