Agent Treasury / Journal

Agent Payments Protocol (AP2): how it lets AI agents buy with your approval

What the agent payments protocol AP2 is, how mandates record what an AI agent may buy, where it stops, and what to check before an agent spends bitcoin.

5 min readAP2 · AI agents · mandates · A2Asha256 fc4a2e1ade4b…62b3

The agent payments protocol AP2 answers a narrow question: when an AI agent buys something, how can anyone later prove that the owner allowed it? Payments built for people assume a person clicks a button. An agent has no button to click, so the permission has to be written down in a form that a merchant, a payment provider and the owner can all check.

This article explains what AP2 does, what it leaves to other layers, and what to verify before an agent is allowed to spend. It is written for builders and for careful savers who want to understand the mechanism rather than the marketing.

What the Agent Payments Protocol (AP2) is

AP2 is an open protocol for agent-led purchases, published as a public specification and reference code. It does not move money. It defines signed messages that say who authorized what.

The core idea is the mandate: a signed statement of what an agent may do on the owner's behalf. A merchant that receives a mandate can check the signature and the stated limits. If a dispute comes up later, the mandate is the record of what the owner actually agreed to.

AP2 is designed to sit on top of an agent-to-agent layer. The A2A (Agent2Agent) protocol is how agents find each other and exchange tasks. AP2 adds the payment authorization to that conversation.

Mandates: how AP2 records what you allowed

Think of two situations.

In the first, the owner is present. The agent finds an item, the owner sees the exact cart and approves it. The approval is a signature over that specific purchase.

In the second, the owner is not present. The owner approves a mandate ahead of time: which merchants, what amount range, how many uses, and until when. The agent then buys inside those bounds without asking again.

The second case is the interesting one, because a mandate is only useful if its limits are narrow. A mandate that says "anything, anywhere, forever" is a blank cheque with a signature on it. Good mandates are short-lived, name the merchants, cap the amount and count the uses.

Each completed purchase should leave a receipt that ties the payment back to the mandate. That gives the owner an audit trail they can read without trusting the agent's own account of events.

Where AP2 stops and the payment rail starts

AP2 says who allowed a purchase. It does not enforce a spending limit on the wallet that pays. Those are two different layers, and mixing them up is the most common design mistake.

Layer Question it answers Example
Agent communication How do agents talk and hand off tasks? A2A
Authorization Did the owner allow this purchase? AP2 mandates
Payment request What exactly is being paid, and to whom? A BOLT 11 invoice, L402, LNURL-pay
Enforcement Can the money physically leave? Limits enforced where the keys live

A signed mandate is evidence. It does not stop a compromised agent or a buggy server from sending a payment. For that you need a limit that sits next to the keys and refuses to sign anything outside it.

On Lightning, one way to build that is with LND macaroons, which are credentials that can carry restrictions. A BOLT 11 invoice carries the amount and the payee, so a checker has something concrete to compare against the mandate before a payment goes out.

A checklist before you let an agent spend

Use this list for any agent that can trigger a payment, whatever protocol it speaks.

  1. Separate authorization from enforcement. Know which component records the owner's consent and which component can actually refuse a payment.
  2. Keep the keys with the owner. If a hosted service holds the funds, its failure or compromise is your loss. Prefer a design where the service holds no balance.
  3. Set a per-payment cap. Small purchases can run unattended. Larger ones should wait for a human.
  4. Set a rolling total. A per-payment cap alone does not stop many small payments adding up.
  5. Limit the payees. An allowlist of merchants turns a stolen agent credential into a much smaller problem.
  6. Cap the routing fee. On Lightning, the fee is part of what leaves your wallet.
  7. Give mandates an expiry and a use count. Short and countable beats long and open.
  8. Fail closed. If the enforcement component is down, payments should stop, not pass through unchecked.
  9. Read the receipts. A log nobody reads is not an audit.

Which payment methods fit an agent

AP2 is not tied to one payment method, so the same mandate model can sit in front of different rails. For bitcoin agents, the practical options are Lightning invoices, Nostr Wallet Connect for connecting a wallet to an app, L402 for paying for API access, and LNURL-pay for static payment addresses. Each has different trust properties, so check what a given integration lets the agent do before you grant it.

Note that AP2 is young. Details of the specification can change, so build against the current published version and avoid assuming that a field or flow will stay as it is.

How Agent Treasury approaches this

Agent Treasury is a working prototype on regtest, a private bitcoin test network. It is in development, it is not live on mainnet, and no real money moves. For agent-to-agent purchases it uses A2A 1.0 with AP2 mandates. The owner approves a mandate once, setting merchants, an amount range, a number of uses and an expiry. The defaults are 24 hours and up to 10 uses, with a maximum of 7 days, and each purchase returns a signed receipt.

Payments go out of the owner's own Lightning node, so there is no balance on our side. A small signed program that the owner runs next to the node, called the guard, enforces each agent's budget on the node itself, and if it is not running the node refuses those payments. Anything above the approval threshold waits for a passkey approval tied to that exact invoice, amount and payee. You can read the how Agent Treasury works section for the full picture, or join early access if you want to follow the project. This is not legal or financial advice.

Sources

  1. public specification and reference code
  2. A2A (Agent2Agent) protocol
  3. LND macaroons
  4. BOLT 11 invoice
  5. Nostr Wallet Connect

Questions

What is the Agent Payments Protocol (AP2)?

AP2 is an open protocol that defines signed mandates describing what an AI agent is allowed to buy on its owner's behalf. It records authorization so merchants and owners can verify a purchase later. It does not move the money itself.

What is a mandate in AP2?

A mandate is a signed statement of the limits an owner has approved, such as which merchants, what amount range, how many uses and until when. A merchant can check the signature and the limits before accepting the purchase.

How is AP2 different from A2A?

A2A is how agents discover each other and exchange tasks. AP2 adds payment authorization on top, so that a purchase made during that exchange can be tied to the owner's consent.

Does AP2 work with bitcoin and Lightning?

AP2 is designed to be independent of the payment method, so it can sit in front of different rails. Whether a given bitcoin or Lightning integration exists depends on the implementation, so check the specific software.

Is a signed mandate enough to keep an agent from overspending?

No. A mandate is evidence of what the owner allowed, but it does not stop a payment on its own. You also need a limit enforced where the keys or the node are, so that out-of-bounds payments are refused.

Agent Treasury is a prototype on a bitcoin test network: no real money moves yet, and it has not been independently audited. This article is general information, not legal, tax or investment advice.