-
Notifications
You must be signed in to change notification settings - Fork 1
x402 Index and Router
Agent402 is not only a seller of ~1,100 tools — it's also a routing layer for the whole x402 ecosystem. It crawls public x402 sellers, tracks their health, and lets a buyer ask "find me the cheapest healthy tool that does X" across every seller it knows about.
Three surfaces, all free (mounted outside the paywall — discovery primitives
shouldn't cost money, by the same logic as /api/find):
| Surface | What it returns |
|---|---|
GET /index |
HTML dashboard: every seller indexed, tool count, network, last-fetched time, rolling health, discovery sources |
GET /api/index |
JSON snapshot of the same data: per-seller health, routable, rolling history, totals |
POST /api/route |
Smart Order Router: { query, top } → top-N matching tools across sellers, ranked by match score, then health, then price |
- Local catalog — the Agent402 server's own tools are always present (no network).
-
Operator seeds — origins listed in the
X402_INDEX_SEEDSenv (comma-separated) get crawled every 5 minutes. - Auto-discovery — every hour, the indexer pulls public x402 registries (currently the Coinbase CDP Bazaar) and adds new origins to the crawl set, capped at 200 sellers so a misbehaving registry can't blow up memory.
Each crawl fetches <origin>/.well-known/x402 plus the seller's openapi.json
when present, runs every request through the SSRF guard (safeFetch), caps
response sizes, and records the outcome in a rolling 5-entry history per
seller.
A buyer routed to a dead seller wastes money. The router takes that seriously:
-
Excluded: a seller whose last
HEALTH_WINDOW(5) crawl outcomes include any errors is not routable and is skipped by/api/route. - Brand new: sellers with no history yet are routable — benefit of the doubt for newcomers.
- Ranked: at equal match score, healthier sellers rank first. Then cheaper wins.
-
Snapshot:
GET /api/indexexposes every seller'shealth(0..1),routableflag, and rollinghistoryso an operator can audit the decisions.
The unit tests for these guarantees live in scripts/test-router-health.js
(six scenarios, offline — they seed the in-memory cache directly via a test
escape hatch).
curl -X POST https://agent402.tools/api/route \
-H 'content-type: application/json' \
-d '{"query":"ocr image to text","top":5}'Returns an array of { seller, route, slug, name, price, health, score } entries.
seller is "self" for the local catalog or the origin URL for remote sellers,
so a buyer can address the right seller directly.
-
One integration, the whole ecosystem. A buyer that integrates Agent402's
agent402-clientSDK or the hosted/mcpconnector already has access to ~1,100 local tools and can route across every other x402 seller without per-seller wiring. - Discoverability that compounds. Sellers don't have to register with Agent402 — appearing in any public x402 registry is enough. The Index pulls them in automatically.
-
Trust signals are checkable. Health scores are derived from real crawl outcomes, not self-reports. The full
historyis in/api/indexfor anyone to verify.
- Architecture — where the indexer sits in the request flow
- Operations — 3-rail attribution (USDC / PoW / Heartbeat) on the operator dashboard
-
/api/find— local-only resolver (older, simpler)
agent402.tools · synced from wiki/ in the main repo — edit there, not here.
Using it (for agents / buyers)
- Getting Started
- Paying with x402
- Paying with Compute
- MCP Connector
- Adapters
- AWS Bedrock AgentCore
- Tool Catalog
- x402 Index and Router
- x402 Leaderboard
- Payments and x402
- Memory and Coordination
Tollbooth (for site owners)
- Pay-per-crawl — what it is, install, modes
- Pay-per-crawl Walkthrough — 5-min hands-on
- Tollbooth for Agencies — many-site playbook
- Try Tollbooth Cloud (managed)
Under the hood