AN OPEN PROTOCOL FOR AI AGENT CREWS
Give agents a budget, not a hot wallet.
AI agents that buy tools, data and compute pay per call over x402, the open HTTP payment standard. Foliant settles a whole crew's session in one transaction and enforces the crew's budget on-chain, where the code running the agents cannot bypass it. Contracts, an x402 scheme and an SDK, on the chains agents already use.
Try it in ten minutes See the codeTHE PROBLEM
Agents are becoming economic actors, and every rail treats them like a human with a card.
One transaction per call
An agent making thousands of API calls an hour signs and settles each one. Too slow, too expensive, and it fills the chain with dust.
A crew is bounded nowhere
A single agent can be bounded: wallet and card providers enforce per-agent limits, one or two levels deep, as a trusted operator. What nothing bounds is a crew — an orchestrator delegating to workers that delegate again, where the budget the owner signed has to hold across the whole tree.
Providers carry the risk
An API serving many agents has no way to batch what they owe, verify what they are, or cap what any one of them can run up.
WHAT FOLIANT DOES
The budget, the identity and the settlement live on the crew's accounts, not in its code.
Foliant is a protocol, not a chain: on-chain contracts, an x402 payment scheme and an SDK. First targets are Base and Avalanche; the same contracts run on any EVM chain.
Agent account
An on-chain account operated by a signer key that can live in an attested enclave. The owner rotates or revokes it in one transaction.
Crew budget
Per-transaction and per-window caps, allow and deny lists, expiry, an escalation co-signer. An orchestrator delegates sub-budgets to its workers and revokes them itself; every spend is checked against every level of the tree, so no branch can exceed any ancestor. Checked on-chain by the same rule the signer runs.
Channels and pools
A session of thousands of calls settles in one transaction. A provider serving a whole crew settles all of it in one, with each member bounded by its own budget. Every payer can exit alone.
x402 on the wire
Same headers, same 402 body. Any x402 client or middleware works unchanged; Foliant is a payment scheme to add, not a new stack to adopt.
Next to an agent wallet that enforces limits on your behalf, two things differ. The checks are in a contract rather than in an operator’s service, so the party being paid does not have to trust the party spending, which is what makes a crew that spans two organisations workable. And the tree is sixteen levels deep rather than two: tighten a parent and the children that already exist are bound at once, not at their next renewal.
HOW IT WORKS
Four steps touch no chain. The fifth settles a whole session.
Agent calls the API
Plain HTTP request.
API answers 402
Price, asset and channel or pool terms, in x402 format.
Agent signs an update
Inside the enclave, within policy. Refused if over budget.
API verifies and serves
Signature and balance checked locally; no chain round trip.
API settles in batch
Latest update on-chain, whenever it chooses. One transaction.
Steps 1 to 4 complete inside the latency of the API call. Step 5 amortises one on-chain fee across thousands of calls, so the per-call cost is far below a cent.
IT RUNS TODAY
Deployed on Avalanche Fuji, reviewed independently at every stage, and runnable by a stranger in ten minutes.
Paid API calls to on-chain transactions for one agent session, measured on Fuji
Calls to break even against paying per call, from measured gas rather than estimates
Over-budget payments, by any agent or any crew: the signer and the contract agree exactly
Tests across the Python reference and the Solidity contracts, including property-based invariants over random budget trees
Open source under Apache-2.0. The quickest way to judge it is to run it on Fuji: no wallet and no faucet, ten minutes, and every transaction links to the explorer. What the gas actually costs is measured and written up. To read rather than run: the whitepaper sets out the full network and the study covers feasibility; python demo/run_demo.py runs all five scenarios against an in-memory ledger in about a second. Live on Avalanche Fuji: contracts AgentAccounts, PaymentChannels, Pools, reviewed independently as it was built (three reports, 37 findings, all closed; no commissioned third-party audit yet). Packages: foliant-protocol and langchain-foliant on PyPI (langchain-foliant is a listed LangChain integration), foliant-client and elizaos-plugin-foliant on npm. Section 11a of the whitepaper records the prior art — Tempo, the x402 batch-settlement scheme, ERC-8427 Portable Spend Grants, Pactra and others — what Foliant adds to them, and the claims earlier versions of that section got wrong.
THE SPECIFICATION
The policy is written down, and the vectors tell you whether you have implemented it.
Every provider that caps what an agent may spend has invented its own field names and its own semantics, so two of them cannot read each other’s budgets. One other effort is converging on a written form rather than a product — ERC-8427 Portable Spend Grants, for a single delegate — and it makes the same argument for canonical encoding and golden vectors that this does. Foliant’s spending policy is specified separately from Foliant: a chain-agnostic document anyone can implement, whether or not they use these contracts.
A document, not an API page
Validity, the canonical encoding and policy id, the order checks run in and the reason code each one reports, the window bound, the delegation rules, and a binding to the x402 exact scheme. Independently reviewed, with the review rounds recorded.
Conformance vectors
Machine-readable vectors for policy validity, ids, checks, windows and trees, plus a JSON Schema for the wire form. An implementation that skips a vector must say why.
Three implementations that pass them
The Python reference, the Solidity contracts and the TypeScript client all run the vectors, from one file, with every departure stated. Agreement between an off-chain signer and an on-chain check is the property worth having, and it is tested rather than asserted.
Read the specification, the vectors and the schema. Draft 0.1 is open for comment; §8 records what is deliberately unfinished, including per-asset amounts.
DESIGN PARTNERS
We're looking for one agent framework or API to pilot the contracts on a testnet you already use.
No cost, no exclusivity, fees waived for the first year of mainnet, and a joint announcement when the integration is live. If you run an x402 endpoint or build agents that pay for tools, get in touch.