Overview
An AI agent that finds your API today hits a wall: a signup form, an email to confirm, a card to enter, sometimes a sales call. None of that works for a program running on its own at 3 a.m. The Agent Storefront removes the wall. You connect it once, pick the plans agents can buy, and Lago publishes two Markdown documents an agent reads at run time:AUTH.md: how to sign up and get a token.BILLING.md: what you sell, at what price, and how to pay.
Premium add-on, on request. Contact us to enable it on your organization.
How it works
- The agent calls your API. Your API runs a gate check. An unknown or unfunded agent gets a
402with the link to yourBILLING.md. - The agent signs up. It follows
AUTH.md: it proves it holds a key and gets a short-lived token. - The agent enrolls and pays. It follows
BILLING.md: it picks one of your plans, which creates its Lago customer, subscription and wallet, then funds the wallet. - The agent calls again. The gate check passes. You serve the call and send a usage event to Lago, which debits the wallet.
AUTH.md: signup for agents
Each connection servesAUTH.md at <agent_url>/AUTH.md. It tells an agent how to register and authenticate, in plain steps it can follow without a human:
- Generate an Ed25519 key pair and store the private key somewhere durable. The key is the account. A new key is a new identity, and nobody can restore a lost one.
- Request a challenge, sign it, and submit the proof to sign up.
- Receive a 5-minute access token. Renew it the same way, with the same key.
Why Lago ships it
The idea comes from auth.md, WorkOS’s open protocol for agent registration: a Markdown file at a known URL that tells an agent how to sign up. Identity is WorkOS’s domain. Their protocol covers identity providers, signed identity assertions and a human claim step, and it is the right fit when your service already runs OAuth. Most API businesses don’t run agent identity yet. Without it, they can’t take money from an agent, because there is no account to bill. So Lago embeds a signup of its own in the Storefront. It keeps the Markdown discovery file and swaps the OAuth machinery for an Ed25519 key proof. It is not an implementation of the auth.md protocol, and an agent follows Lago’sAUTH.md, not the generic one.
What embedding it buys you:
- No identity provider to set up. Signup works the day you connect.
- No passwords or emails. Proof of key possession is something an agent can do alone.
- One account per key. The registration maps one-to-one to a Lago customer and wallet, so billing can’t drift from identity.
BILLING.md: pricing an agent can read
Each connection also servesBILLING.md at <agent_url>/BILLING.md. It is generated from your Lago configuration on every request, so it can’t go stale. It contains:
- The plans you sell. Interval, currency, top-up limits, free credits, and one action per charge: metric code, name, description, charge model and price properties.
- How to enroll. Get a billing token, then pick a plan. Enrolling creates the customer, a subscription and an empty wallet
agent_credits. - How to add credits. The agent pays a top-up with a Stripe Shared Payment Token granted from its own Stripe account. Lago charges it on your Stripe account, issues the credit invoice and credits the wallet once the payment settles.
- How to get claimed. See Claim an agent.
Set up a connection
Prerequisites
- Events targeting wallets enabled on your organization. Usage events debit the agent’s wallet directly.
- Real-time wallet refresh. Gate checks read a wallet balance that must stay current between calls. On self-hosted Lago, this needs a Redis cache URL and wallet refresh left on.
- A Stripe connection, to collect top-ups. Set its Seller profile: the Stripe network business profile agents grant their tokens to. Without it,
BILLING.mdtells agents you don’t accept payments yet.
Connection fields
In the app, go to Settings > Integrations > Lago Agentic Storefront and add a connection. You can also usePOST /api/v1/agent_storefronts.
Once created, the connection page lists the URLs to hand out: the agent URL,
AUTH.md, BILLING.md and the claim page.
Choose the plans agents can buy
Agents enroll with no one from your team in the loop, so you decide upfront what they can buy. On the connection page, click Sell a plan and set:
Amounts are in the plan’s currency. The same settings go through the
plans array of the API:
Usage-only plans
Agents pay from a prepaid wallet, call by call. A fixed fee has no call to attach to, and a minimum commitment bills money the wallet may not hold. Lago enforces the rule everywhere: when you sell the plan, when an agent enrolls, and when you edit a sold plan later. Adding a fee to a sold plan is refused withplan_sold_by_agent_storefront.
Each charge must also accept a target wallet, and pay-in-advance charges must be invoiceable. Otherwise every gate check on that metric is refused.
Gate your API
Before each paid call, ask Lago whether the agent can pay. Pass the agent’s API token, the metric of the call and your cost estimate:200:
billing_instructions is the URL of your BILLING.md. An agent that receives it knows how to fix the problem on its own.
The check reserves the estimate against the wallet, so parallel calls can’t all spend the same credits. After the call, send a usage event for the agent’s subscription that targets its wallet:
agent resource. Existing keys with explicit permissions don’t get it automatically.
Claim an agent
An agent that signs up with a key is anonymous: its customer isAgent · <registration id>, with no email. Claiming ties it to the person who runs it.
- The enrolled agent requests a claim code. It shows the code and your claim page URL to its owner, then keeps working. Nothing waits for the claim.
- The owner opens the claim page, enters the code and an email address, then types the 6-digit code they receive. The email carries your billing entity’s name.
- The agent’s customer gets the verified email. Lago sends
customer.updated.
Why claims matter
- You know who is behind an agent. The verified email lands on the customer record, for receipts, support and fraud review.
- Free credits go to people, not keys. Keys cost nothing to generate. Mailboxes are scarcer. Free credits require a claim, and each owner gets them once per storefront, however many agents they claim. Lago normalizes the address, so
anna+agent2@acme.examplecounts asanna@acme.example.
wallet_transaction.created.
Good to know
- Nothing to deploy. Signup, both documents, enrollment, payments and claims run inside Lago. Your API adds the gate check and the usage event, nothing else.
- Stripe only, for now. Top-ups use Stripe Shared Payment Tokens, in public preview at Stripe.
- Any currency. Each wallet uses its plan’s currency. An agent can’t move to a plan in another currency.
- Deletion is guarded. You can’t delete a connection with enrolled agents, or a plan that a connection sells.
- No dunning on agents. Agent customers are excluded from dunning and skip zero-amount invoices.