AgentFuse docs
AgentFuse lets an AI agent pay for APIs and compute on without holding your funds. You fund a vault, sign rules, and give the agent a key that can only request payments. Each request is checked against the rules before anything is signed and ends up as a receipt.
Quickstart
- Open the dashboard and connect the wallet that will own the vault.
- Create a fuse: name the agent, set the daily budget, per-call cap, call limit, expiry and allowlist, and make the first deposit in USD.
- Copy the agent key and put it in your agent environment as
AGENTFUSE_KEY. - Wrap paid calls with the SDK. Watch them land in Activity.
Agent SDK
npm i @agentfuse/sdk
pip install agentfusefuse.fetch() behaves like fetch. When the endpoint answers 402 Payment Required, the SDK sends the quote to the vault with a fresh intent ID, waits for the decision and retries the request with the payment proof.
import { Fuse, FuseDeclined } from "@agentfuse/sdk";
const fuse = new Fuse({ key: process.env.AGENTFUSE_KEY });
try {
const res = await fuse.fetch("https://api.lumensearch.io/v1/query", {
method: "POST",
body: JSON.stringify({ q: "x402 facilitators on solana" }),
intent: "task-1842/search-3", // optional: your own idempotency key
});
console.log(res.receipt.amount, res.receipt.signature);
} catch (e) {
if (e instanceof FuseDeclined) console.log(e.reason); // "budget_exceeded"
}Retrying with the same intent never pays twice: the vault returns the existing receipt. The same intent with a different payee or amount is refused.
Rules
| Rule | What it limits |
|---|---|
| Daily budget | Total USD the agent may spend per UTC day. Spent and reserved both count. |
| Per-call cap | Highest single quote the vault will pay. |
| Paid calls per day | Stops loops that make many small payments. |
| Allowlist | Exact HTTPS hosts and paths, matched after normalization. Redirects do not widen it. |
| Expiry | After this date the agent can pay nothing until you sign new rules. |
| Pause | Immediate stop for new payments. Signed payments still settle. |
Rules are versioned. Each update is signed by the owner wallet with a higher version number; older versions cannot be replayed. Updating rules never resets today's spent or reserved amounts.
Budget model
available = daily_budget − spent − reserved- An approved request reserves its amount before signing. Parallel requests are serialized per vault, so they can never overshoot together.
- Once settled, the reservation turns into spent. A reservation is released only when the payment provably cannot settle.
- Lowering the budget below today's spend just blocks new payments; available shows zero.
- The day rolls over at 00:00 UTC. History and receipts are kept.
Decline reasons
| Code | Shown as | Meaning |
|---|---|---|
not_allowlisted | Recipient not on the allowlist | Payee host or path is not on the allowlist, or the quote points to a different recipient. |
over_call_cap | Price above the per-call cap | The quoted price is above the per-call cap. |
budget_exceeded | Would exceed today's budget | Spent + reserved + this quote would go over today's budget. |
call_limit | Daily call limit reached | Today's paid-call limit is used up. |
vault_empty | Vault balance too low | The vault holds less than the quote. |
expired | Rules expired | The rules passed their expiry date. |
paused | Fuse is paused | The owner paused the fuse. |
revoked | Agent key revoked | The agent key was revoked. |
duplicate_intent | Intent already paid | This intent ID was already paid; the original receipt is returned instead. |
Receipts
Every request produces a receipt, paid or not: intent, rules version, quote, payee, amount, protocol fee, signature, timestamps and status. Payment status (reserved → settled) and API result (delivered / provider_error / timeout) are tracked separately, so a paid error is still visible as a spend. Export as CSV, or share a single receipt as a public link without agent details.
Security model
- The vault is a program account owned by your wallet. The agent key can request payments; it cannot withdraw, change rules or sign arbitrary transactions.
- Only plain USD transfers to allowlisted payees are built. Unknown instructions, extra transfers or account creation in a quote are declined.
- Keys and wallets you give an agent outside AgentFuse are outside this protection.
Fees
0.5% of each settled payment. Declined requests are free. All protocol fees buy back and burn $TOKEN — see the burn ledger. Network fees are paid by the vault in SOL and shown separately.