x402 Service Discovery: How Autonomous Agents Find and Pay for APIs at Runtime
Autonomous agents need to call paid APIs. The problem: there's no standard way to find them.
You don't want to hardcode 50 endpoint URLs into your agent. You want it to discover the best available service for any capability at runtime — like DNS for the agent economy.
That's what x402 Service Discovery does.
What is x402?
x402 is a protocol that lets HTTP servers charge for API calls using USDC stablecoin micropayments on Base. A client hits an endpoint, gets a 402 Payment Required response with a payment challenge, pays ~$0.001–$0.05 in USDC, then retries the request with a payment proof header. No API keys, no subscriptions, no billing dashboards.
The discovery problem
The x402 ecosystem is growing — there are services for research, data feeds, compute, AI agents — but there's no index. You have to know a URL exists before you can call it.
We built the missing piece: a service registry where x402-payable APIs can register themselves, and agents can query by capability.
How it works
Free: Browse the full catalog
curl https://x402-discovery-api.onrender.com/catalog
Gated: Query by capability (x402 payment required)
curl "https://x402-discovery-api.onrender.com/discover?q=research+API"
# → 402 Payment Required
# x-payment-required: {"payTo": "0xDBBe14C418466Bf5BF0ED7638B4E6849B852aFfA", "amount": "5000", ...}
Cost: $0.005 USDC per query. Payment handled automatically by x402-capable clients.
Python SDK
pip install x402discovery
Framework integrations
Now supporting 6 frameworks:
1. Coinbase AgentKit (NEW ✨)
The natural home for x402 — AgentKit agents already have a funded Base/USDC wallet. The x402_pay_and_call action closes the full loop: discover → pay → execute, all in one step.
pip install agentkit-x402-discovery
from agentkit_x402_discovery import x402_discovery_action_provider
from coinbase_agentkit import AgentKit, AgentKitConfig
agent_kit = AgentKit(AgentKitConfig(
wallet_provider=wallet_provider,
action_providers=[
x402_discovery_action_provider(),
# ... your other providers
]
))
# Your agent now has 4 new actions:
# x402_discover — Find services by keyword/capability
# x402_browse — List full catalog (free, no payment)
# x402_health — Check service uptime & latency
# x402_pay_and_call — Discover + pay + call in one shot
2. LangChain
pip install langchain-x402-discovery
from langchain_x402_discovery import X402DiscoveryTool
from langchain.agents import initialize_agent, AgentType
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o")
tools = [X402DiscoveryTool()]
agent = initialize_agent(tools, llm, agent=AgentType.OPENAI_FUNCTIONS)
agent.run("Find a research API under $0.05/call")
3. AutoGen
pip install autogen-x402-discovery
4. CrewAI
pip install crewai-x402-discovery
5. LlamaIndex
pip install llama-index-x402-discovery
6. Raw Python
from x402discovery import X402DiscoveryClient
client = X402DiscoveryClient()
results = client.discover(query="weather data", max_price_usd=0.10)
MCP (Model Context Protocol)
Available as an MCP server on Smithery with 5 tools: x402_discover, x402_browse, x402_health, x402_register, x402_trust.
Trust Layer: ERC-8004 Integration (NEW ✨)
Beyond quality signals (uptime, latency), we now surface on-chain trust identity for every registered service.
ERC-8004 is a new Ethereum standard (January 2026) that provides decentralized AI agent trust via three on-chain registries:
- Identity Registry — unique on-chain identifier for each agent/service
- Reputation Registry — verifiable scores from real interactions
- Validation Registry — third-party attestations from auditors and ecosystem partners
Every service in our catalog now returns trust fields alongside quality signals:
{
"name": "My x402 API",
"uptime_pct": 99.1,
"avg_latency_ms": 145,
"erc8004_verified": true,
"erc8004_reputation_score": 87,
"erc8004_attestations": 3,
"erc8004_source": "well-known"
}
New: /trust/{wallet} endpoint
Look up the ERC-8004 trust profile for any wallet address:
curl https://x402-discovery-api.onrender.com/trust/0xDBBe14C418466Bf5BF0ED7638B4E6849B852aFfA
Returns identity metadata, reputation score, and attestation count — sourced from the ERC-8004 on-chain registries and /.well-known/erc8004.json declarations.
New MCP tool: x402_trust
The MCP server now exposes 5 tools (up from 4):
| Tool | What it does | Cost |
|---|---|---|
x402_discover |
Search services by keyword/capability | $0.005 USDC |
x402_browse |
Browse full catalog by category | Free |
x402_health |
Check uptime & latency | Free |
x402_register |
Register your service | Free |
x402_trust |
Look up ERC-8004 trust profile for any wallet | Free |
The demo at rplryan.github.io/ouroboros/demo.html shows ERC-8004 verification badges on services that have declared on-chain identity.
Register your x402 service
import requests
requests.post("https://x402-discovery-api.onrender.com/register", json={
"id": "my-service",
"name": "My x402 API",
"url": "https://my-api.com/endpoint",
"price_usd": 0.01,
"description": "Does something useful",
"capability_tags": ["data", "research"],
"wallet_address": "0xYOUR_WALLET",
"network": "base"
})
Registration is free. Health monitoring is automatic. Once registered, your service gets ERC-8004 trust lookup automatically if your wallet has an on-chain identity.
What's next
The catalog grows as more x402 services register. Quality signals (uptime_pct, avg_latency_ms, health_status) plus ERC-8004 trust scores let agents prefer reliable, verified services — the full trust layer the x402 ecosystem needs.
Links:
- API: https://x402-discovery-api.onrender.com
- Smithery MCP: https://smithery.ai/servers/rplryan/x402-discovery
- AgentKit package: https://pypi.org/project/agentkit-x402-discovery/
- PyPI (all packages): https://pypi.org/project/x402discovery/
- Interactive Demo: https://rplryan.github.io/ouroboros/demo.html
- GitHub: https://github.com/rplryan/ouroboros
Top comments (0)