The payment rail for autonomous AI agents.
x402 and MPP, unified under one API. Every transaction settled on Solana, on-chain, in under 400ms.
AI agents are spending money. They call APIs, rent compute, and pay other agents for services. Two protocols are competing to become the standard for how those payments work: x402 (Coinbase) and MPP (Stripe + Tempo). Services are adopting one, the other, or both.
RailProtocol is the integration layer. It detects which protocol a service requires, handles the full payment handshake, and settles every transaction on Solana with a public transaction hash. One method call. Any protocol. The chain is the ledger.
import { RailProtocol } from "@railprotocol/sdk";
const rail = new RailProtocol({
agentId: "research-agent",
apiKey: process.env.RAIL_API_KEY,
});
const result = await rail.pay({
endpoint: "https://api.dune.com/v1/query/1234/results",
method: "GET",
});
console.log(result.protocol); // "x402" | "mpp" — detected automatically
console.log(result.amountPaid); // { usdc: 0.002 }
console.log(result.txHash); // Solana transaction hash
console.log(result.data); // the actual API response| Repo | Description |
|---|---|
| railprotocol/sdk | TypeScript SDK |
| railprotocol/sdk-python | Python SDK |
| railprotocol/cli | rail CLI |
| railprotocol/program | Solana on-chain program (Rust + Anchor) |
| railprotocol/docs | Documentation source |
Agent wallets. Each agent gets a non-custodial Solana wallet provisioned in one line. Program-derived addresses owned by the agent's keypair. RailProtocol cannot move funds without a signed instruction from the agent.
Spend policies. Daily budget caps, per-call limits, domain allowlists, and rate limits enforced at the gateway before any transaction is submitted. A call that exceeds the daily budget is rejected before funds leave the wallet.
On-chain settlement. Every payment, regardless of protocol, is recorded on Solana with a public transaction hash. The ledger is independently queryable via Solana RPC. No separate reporting layer required.
Multi-agent payment chains. When orchestrating agents delegate to sub-agents, each payment in the chain is linked to the parent transaction on-chain. The full cost of any workflow is traceable from a single root hash.
npm install -g @railprotocol/cli
rail auth login
rail wallet create --agent my-agent
rail policies set my-agent --daily-budget 25 --per-call-limit 1.00Full quickstart: docs.railprotocol.org/getting-started/quickstart
- Website: railprotocol.org
- Documentation: docs.railprotocol.org
- X: @RailProtocolOrg
- Contact: hello@railprotocol.org