agentbatch

x402 batch settlement on Stellar

Pay per request. Settle in batches.

AgentBatch gives AI agents one escrowed USDC deposit and a signed voucher for every call. Sellers answer instantly and claim many buyers at once, in a single Stellar transaction.

every request · a signed voucher, off-chainone claim for all buyers · on-chain

01The problem

Agent fleets pay dozens of services, thousands of times a day.

Inference, search, data, compute, other agents: every call is a small usage-based payment. Settling each one on-chain, or funding a separate channel for every agent–provider pair, does not scale.

01

Fragmented funding

Each provider channel needs its own funding allocation. Balances end up scattered across independent payment relationships.

02

Operational overhead

Channel creation, signer management, funding, settlement, monitoring and reconciliation, repeated for every provider.

03

Repeated settlement

Independent providers redeem their channels one by one. Combining claims into one transaction needs dedicated infrastructure.

04

Delegated spending risk

Agents need bounded payment authority, without unrestricted access to the organization's treasury.

one channel per relationship
channel contracts3
separate deposits3
settlement transactions3
agentbatchshared treasury
treasury contract1
deposit1
batch transaction1

Three providers, one agent fleet. AgentBatch keeps one channel record per provider, each with its own reserved collateral, inside one funded treasury.

02How it works

One deposit. Many channels. One claim.

Channels are records inside a shared treasury, each with its own reserved collateral. Agents pay with signed vouchers off-chain; providers settle together on-chain.

  1. Worked example from the design doc, in USDC. The Testnet PoC ran these exact numbers with synthetic AUSD. Hover to pause, click a step to jump.
treasurydeposit(100)
Contract balance100.00USDC
available
100.00
reserved
0.00
paid
0.00
reserved per channel available paid out signed, not yet redeemed
ch#1AI Inference API0.00/ 40
ch#2AI Search API0.00/ 35
ch#3Data Retrieval API0.00/ 15
paid requests0
tx during requests0
settlement tx0
live simulation

03What's different

Off-chain vouchers exist. The shared treasury is new.

AgentBatch does not reinvent cumulative payment channels. It combines shared liquidity, independently collateralized virtual channels, delegated vouchers and bounded multi-provider settlement in one Soroban layer.

Shared multi-provider funding

One organization-funded treasury backs many virtual payment channels across independent providers.

Virtual channels, no extra deployments

Channels are records inside one Soroban contract, not separately deployed and funded channel contracts.

Independent collateral

Each channel reserves its maximum liability. The same funds can never guarantee two providers.

Multi-provider settlement

Claims from independent providers settle in one atomic batch. Recipients come from storage, never from the caller.

1–4 channels per batch in the PoC

Bounded delegated spending

Agents sign with delegated keys capped by their channel allocation. They never control the treasury.

Reusable settlement layer

Facilitators, AI platforms and wallets integrate one collateral and settlement primitive instead of bespoke escrow.

SDK and x402 adapter planned

04Proof

Running on Stellar Testnet today.

One 100 AUSD deposit backed three channels of 40 / 35 / 15. Agents completed 11 paid requests without a single transaction, then one batch settled all three providers.

run of 24 Oct 2026
0

transactions submitted during 11 paid requests

1

batch paid three providers 12 / 8 / 5 AUSD

22

archived Testnet transactions, 19 successful and 3 intentionally failed

17,001

bytes of optimized contract WASM

Settlement fee · three-provider workload−32.23%
fee charged on Testnet, one batch vs. three separate redemptions
3 separate redemptions32,898 stroops
1 redeem_batch, 3 vouchers22,294 stroops

Measures redemption fees only. Deployment, channel rent and other lifecycle costs are separate. See benchmarks

Proof of concept, not production. The current code is a limited Stellar Testnet PoC using synthetic AUSD, not USDC. It has internal review and regression tests but no independent external security audit. Do not use it with assets of value. Security assumptions

05For developers

Sign, verify, serve. No network needed.

The voucher library encodes, signs and verifies cumulative Ed25519 vouchers. Providers check every increment locally before serving, and duplicates are rejected.

  • deposit(amount) · owner funds the treasury
  • open_channel(provider, signer_key, allocation)
  • redeem_batch(vouchers) · anyone settles 1–4 channels
  • withdraw_available(amount) · unallocated funds only

@agentbatch/voucher is a private workspace package today. The production TypeScript SDK is planned work.

examples/offline-payments/src/index.tsexcerpt
import {
  AgentSigner, ChannelSpender, MemoryVoucherStore, ProviderVerifier,
} from "@agentbatch/voucher";

const agent = AgentSigner.random();
// Illustrative channel metadata. A real provider must pin code and asset and
// obtain this record from its trusted deployment before accepting requests.
const channel = {
  channelId: 1n, owner, provider, signer: agent.publicKey,
  allocation: 100_000_000n, redeemed: 0n,
};
const spender = new ChannelSpender(agent, context, channel.allocation);
const verifier = new ProviderVerifier(
  { ...scope, provider },
  new MemoryVoucherStore(scope),
);

for (const price of [10_000_000n, 20_000_000n, 5_000_000n]) {
  const voucher = spender.pay(price);
  assert.equal(verifier.accept(channel, voucher, price).ok, true);
}
terminaloffline · 0 transactions

$

06Accounting invariants

Every claim is backed by its own collateral.

Shared custody never means shared promises. One accounting invariant holds across every state change, with checked arithmetic throughout.

Invariant I1

total_deposited
−total_paid
−total_withdrawn
=
available
+total_reserved

Per-channel ceilings

0 ≤ redeemed ≤ allocation. A compromised agent key cannot pay beyond its channel.

No double allocation

Opening a channel moves funds from available into that channel's reservation only.

Reserved funds stay put

Owner withdrawals are bounded by unallocated funds. Collateral backing claims cannot leave.

No repeated payout

Payout is the voucher amount minus what was already redeemed. Replays fail on-chain.

Domain-separated vouchers

Each signature binds network, contract, channel, owner, provider, signer and cumulative amount.

Atomic batches

If any voucher in a batch is invalid, the whole transaction reverts. Recipients come from storage.

07Use cases

Built for machine-to-machine commerce.

Wherever agents buy small units of work from many independent services, thousands of times a day.

High-frequency inference

Every model call carries an incremental voucher. The provider verifies instantly and settles periodically.

One agent, many APIs

Inference, search, structured data and compute, each on its own channel with independent limits.

Enterprise agent fleets

Research, analytics and automation agents get bounded authority. Finance sees exposure in one treasury.

Agent-to-agent payments

A coordinator pays specialist agents for retrieval, reasoning and tools, then their claims settle together.

AI tool marketplaces

Many independently operated tools and APIs share collateral and settlement infrastructure.

Designed to plug into · adapters are planned work

x402 facilitatorsStellar MPPAgent frameworksWalletsAI platformsTreasury tooling

08Roadmap

From proof of concept to Mainnet.

Each stage needs explicit acceptance criteria, security review and reproducible validation before release.

  1. Proof of conceptshipped · Testnet

    The core settlement architecture, on Testnet

    • One treasury, independently reserved channels
    • Real Ed25519 cumulative vouchers
    • Provider-side verification and durable stores
    • Atomic settlement of 1–4 channels
    • Incremental redemption and replay protection
    • Owner withdrawal of unallocated funds
  2. Stage 1next

    Production treasury and channel infrastructure

    • Multi-tenant treasury management
    • Channel lifecycle with protected closure
    • Safe collateral allocation and reallocation
    • Secure signer rotation and revocation
  3. Stage 2planned

    Scalable settlement and integration

    • Multi-provider settlement coordination
    • Keeper mechanisms with bounded incentives
    • Complete TypeScript SDK
    • MPP and x402 integration adapters
  4. Stage 3planned

    Mainnet readiness and adoption

    • Treasury Console and settlement monitoring
    • Independent security review
    • Real AI-service integration pilots
    • Mainnet deployment

Open source · Apache-2.0

One treasury. Many providers. Settled in batches.

Off-chain micropayments with coordinated on-chain settlement, built to make Stellar the network of choice for high-volume agent commerce.