x402Swarms is a network of autonomous AI agents that discover, purchase, and consume paid APIs over the x402 protocol — settling micropayments in USDC per request. No API keys. No accounts. No human in the loop.
Built on the open HTTP 402 standard from Coinbase & Cloudflare's x402 Foundation.
Every agent in the swarm runs the same four-step loop against any x402-enabled endpoint. The server names a price, the agent signs USDC, the facilitator settles on-chain, the data comes back.
Agents query the Bazaar discovery layer to find endpoints that match the task — price, network, and schema included.
→The resource server replies 402 Payment Required with payment instructions in the header. No account needed.
The agent signs a USDC payment payload from its own wallet and retries the request with proof attached.
→Facilitator settles on-chain in <2s. Server returns 200 OK with the data. The swarm chains the next call.
A single agent can buy an API call. A swarm divides a goal across dozens of agents, each funding its own slice of the work and reporting back to the hive.
Every agent carries its own wallet with policy-based spending limits. It pays per request and never needs you to approve a checkout. Caps, allowlists, and kill-switches keep it inside the lines.
Swarms read the x402 discovery extension to find the cheapest endpoint that satisfies the schema. If one provider is down or overpriced, the swarm routes around it.
A planner decomposes a goal into sub-tasks, spawns worker agents, and merges results. Each worker is disposable; the hive memory persists.
Settle on Base via EIP-3009 or Solana via SPL — same client, same loop. Pick the chain by fee, finality, or where the provider lives.
Every micropayment is an on-chain receipt. The swarm exposes a live ledger so you can see exactly what each agent bought, when, and for how much.
Wrap agents from LangChain, CrewAI, or your own runtime. If it speaks HTTP, it can join the swarm and start transacting.
USDC pays the APIs. $x402SWARMS coordinates the network: staking for priority routing, governance over the Bazaar registry, and rewards for agents that provide reliable services.
Evn2rdh7qgAX6kM4bnTfHThrBG6PfHHKPoydidcrswrm
Everything you need to install the runtime, fund an agent wallet, and run a swarm against live x402 endpoints.
x402Swarms is a runtime for spawning networks of autonomous agents that transact over the x402 protocol. Each agent can independently discover paid APIs, settle USDC micropayments per request, and consume the response — all without human-managed accounts or API keys.
The protocol is built on the long-reserved HTTP 402 Payment Required status code. When an agent hits a paid endpoint, the server returns a 402 with payment terms; the agent signs a payment and retries. The whole loop settles on-chain in under two seconds.
The runtime ships as a TypeScript package. Install x402swarms alongside the x402 SDK packages for the chains you want to settle on.
# core runtime + x402 packages npm install x402swarms @x402/core @x402/fetch # add the chains you'll settle on npm install @x402/evm # Base, Arbitrum, Polygon npm install @x402/svm # Solana
x402swarms package is shipping soon. The @x402/* packages are part of the live x402 SDK and available today.Spin up a single agent, give it a funded wallet, and let it buy a weather data call. The agent handles the 402 handshake automatically.
import { Agent } from "x402swarms"; const agent = new Agent({ wallet: process.env.AGENT_PRIVATE_KEY, network: "base", limits: { perCall: "0.05", daily: "5.00" } // USDC }); // agent hits a paid endpoint — 402 handled automatically const data = await agent.fetch("https://api.example.com/weather?"); console.log(data.json()); console.log(agent.receipts()); // on-chain payment trail
base-sepolia) while you experiment.An Agent is the atomic unit: one wallet, one set of spending limits, one HTTP client that understands x402. It exposes a fetch() drop-in that transparently pays for any 402 response within its limits.
agent.fetch(url, opts) — request a resource; auto-pays on 402.agent.receipts() — returns the on-chain payment ledger.agent.balance() — current USDC balance of the agent wallet.A Swarm coordinates many agents toward one goal. A planner splits the task, spawns workers, and merges their results. Workers are ephemeral; the swarm's shared memory persists across the run.
import { Swarm } from "x402swarms"; const swarm = new Swarm({ size: 8, // number of worker agents network: "solana", budget: "25.00", // total USDC cap for the run discovery: "bazaar" // auto-find cheapest endpoints }); const result = await swarm.run({ goal: "Compile a market report on SOL memecoins launched today" }); console.log(result.summary); console.log(swarm.spent()); // total USDC spent across all agents
Spending controls are enforced before any payment is signed. An agent that hits a cap stops and reports rather than overspending. This is the guardrail that makes autonomy safe.
| Limit | Description |
|---|---|
perCall | Max USDC the agent will pay for a single request. Requests priced above this are skipped. |
daily | Rolling 24-hour spend ceiling per agent. |
budget | Hard total cap for an entire swarm run. The swarm halts when reached. |
allowlist | Optional list of provider domains the agent is permitted to pay. |
Configure the runtime via the constructor or a swarm.config.json file at your project root.
| Key | Type | Default |
|---|---|---|
network | string | "base" |
facilitator | string (url) | CDP public facilitator |
discovery | "bazaar" | "manual" | "bazaar" |
size | number | 4 |
budget | string (USDC) | required |
No. That's the entire point of x402 — payment is the authentication. An agent pays per request and gets the resource, with no account or key.
Hard spending limits (perCall, daily, budget) are enforced in the runtime before any payment is signed. Fund the wallet with only what you're willing to spend.
Anywhere x402 settles — currently Base, Solana, Arbitrum, Polygon, and Ethereum. Base and Solana are the most common thanks to low fees and fast finality.
No. x402Swarms is an independent project built on the open x402 standard.
Give your agents a wallet and a goal. They'll find the data, pay for it, and bring it back — while you sleep.