The hot-path constraint
SaaS billing can be hours behind. A monthly invoice, reconciled later, is fine when humans drive the system. Agent billing lives in the hot path. Before every tool call, an agent needs to know:- How much credit is left?
- Does this plan allow this action?
- What’s the daily limit?
- Is the price quote still valid?
What OneShot provides
Latency budget
The 50 ms target sets the ceiling for everything in the request path:
Quotes are issued ahead of the call, validated on use, and removed from the cache once consumed. Balance checks are atomic single-statement updates, guarded so the check and the debit can’t disagree. Settlement happens on Base after the call returns; the agent never blocks on chain confirmation.
Why this is hard to build
Each piece is straightforward in isolation. The trouble is the seams:- Hold/refund races. Two parallel tool calls reserving against the same budget. Without an atomic guard, you double-book and over-spend a daily limit.
- Period-rollover edge cases. A subscription renews at 00:00 UTC, the renewal job fires at 00:05, but the agent calls a tool at 00:02. Was that period 1 or period 2? Idempotent renewals + a stable period-end check on every tool call answer it.
- Subscription state divergence. Stripe says active, your DB says expired (webhook lost). On-chain says paid, your DB says pending (block reorg). Both need a reconciliation step that doesn’t double-credit.
- Receipt taxonomy. “Spent $47 last week” is useless without categorization. Tagging at write time (instead of an offline analytics job) keeps the rollups fast and consistent.
When to use OneShot
Use OneShot when:- Your agents call tools tens of times per task.
- You need per-call budgets, daily limits, or per-tool spend visibility.
- You ship to multiple agent frameworks (LangChain, Virtuals, MCP) and want one billing surface.
- You want to settle in USDC on Base without writing the EIP-712 + x402 plumbing yourself.
- Your agent only makes a handful of paid calls per session.
- Monthly invoicing fits the customer relationship.
- You don’t need crypto rails.