Getting Started / Introduction
Introduction
What is Ledger and why it exists
Ledger is an open-source audit and compliance SDK for the x402 payments protocol. When AI agents make micropayments over HTTP via x402, Ledger wraps those payment calls to enforce budgets, produce tamper-evident audit logs, and give operators real-time visibility into agent spend.
Why Ledger?
The x402 protocol enables seamless machine-to-machine payments by embedding payment negotiation directly into HTTP. An AI agent can access any x402-enabled API and pay for it automatically — no API keys, no subscriptions, just a wallet and a fetch call.
This is powerful, but it introduces a new class of operational risk. A single misconfigured agent can drain a wallet in minutes. A fleet of agents making thousands of micropayments per hour creates an audit surface that is impossible to manage manually. Compliance teams need structured logs, exportable reports, and enforceable spending policies.
Ledger solves all of this with a single function call.
Key Features
- Budget enforcement — Set hourly, daily, and monthly spending limits per agent. Transactions that exceed a policy are rejected before they reach the network.
- Tamper-evident audit trail — Every payment is logged with a cryptographic hash chain. Logs can be exported as PDF or JSON for compliance review.
- Real-time alerts — Receive webhook notifications when agents approach budget thresholds or exhibit anomalous spending patterns.
- Dashboard — A web UI for monitoring payments, managing agents, and configuring policies without writing code.
- Zero-change integration — Ledger wraps your existing fetch function. Your payment logic stays identical. One line of code to add full audit coverage.
- Pluggable storage — Store audit logs in memory (for development), Supabase, PostgreSQL, or any custom backend.
Who Is It For?
- AI agent operators — Teams running autonomous agents that make x402 payments and need spend controls.
- Enterprise compliance — Organizations that require structured audit trails for every financial transaction.
- Platform builders — Developers building multi-tenant platforms where each tenant runs agents with independent budgets.
- Solo developers — Anyone who wants to avoid accidentally spending more than intended during development and testing.