Loomal

Getting Started with AI Agent Wallets give your agent a budget.

An agent wallet is a funded account your agent can spend from without a human approving each transaction. Here is what one is, how it holds funds, and how to keep it on a leash.

An autonomous agent that can only consume free endpoints hits a wall fast: the best data, search, and compute behind paid APIs is invisible to it. An agent wallet removes that wall. It is a keypair that controls funds — typically USDC on Base — that the agent uses to pay for tool calls as it works.

The core design question is not 'how does the agent pay' (x402 makes that a single HTTP exchange) but 'how much is it allowed to pay, and for what.' This guide covers the mechanics first, then the guardrails.

What an agent wallet actually is

Strip away the branding and an agent wallet is a private key plus policy. The key signs payment authorizations; the policy decides which authorizations the agent is permitted to sign. There is no bank account, no card network, and usually no human checkout step.

Funds live on-chain — for x402 payments that means USDC on Base, where settlement clears in about two seconds and there are no chargebacks. The wallet is non-custodial: whoever holds the key controls the money, which is exactly why limits matter.

How the agent spends from it

With x402, the agent calls a paid endpoint normally. The server replies with HTTP 402 and a price. The agent's wallet signs a USDC payment authorization for that amount, retries the request with the signature attached, and the server verifies and settles before running the handler. The whole loop is two HTTP round trips — no signup, no API key, no invoice.

Because the agent pays before the handler runs, the seller never extends credit and the agent never pays for a call that was rejected up front.

Set spending limits before funding anything

Treat the wallet like a corporate card for an intern: small balance, hard caps, full logging. Three limits cover most failure modes — a per-call ceiling so one mispriced endpoint cannot drain you, a per-session or daily budget so a retry loop burns cents instead of dollars, and an allowlist of domains or listings the agent may pay at all.

The cheapest guardrail is the balance itself. Fund the wallet with what you would happily lose to a bug — $5 of USDC pays for hundreds of calls at typical per-call prices, which start at $0.01 on Loomal.

agent-wallet.ts
import { privateKeyToAccount } from "viem/accounts";
import { wrapFetchWithPayment } from "x402-fetch";

const account = privateKeyToAccount(process.env.AGENT_KEY as `0x${string}`);

// Cap any single payment at $0.10 (USDC has 6 decimals)
const paidFetch = wrapFetchWithPayment(fetch, account, {
  maxValue: 100_000n,
});

const res = await paidFetch("https://api.example.com/v1/lookup?q=base");

Verify what you paid for

Every settled x402 call through Loomal produces an Ed25519-signed receipt: who was paid, how much, for which resource, and when. Log these alongside the agent's task trace. When a run costs more than expected, the receipts tell you exactly which tool calls did it — no reconciliation against a card statement.

Receipts also settle disputes in the other direction. If a seller claims you owe more, the signed record of what was authorized and settled is the ground truth.

Where to point the wallet

A funded wallet is only useful against endpoints that can charge it. The Loomal Index is queryable by agents: every listing carries a price and an x402-ready payment endpoint, so an agent can discover a tool, read its per-call price, and pay it in one pass. Start by browsing the marketplace yourself to see what your agent will see.

FAQ

Do I need blockchain experience to set up an agent wallet?

No. You generate a keypair, fund it with USDC on Base, and use an x402 client library to handle payments. The signing and settlement details are handled by the library and a facilitator; your code deals in HTTP requests and dollar amounts.

What happens if my agent gets stuck in a loop and keeps paying?

Each iteration costs the per-call price, so the damage is bounded by your budget caps and the wallet balance. This is why per-session limits and a small standing balance matter more than any single safeguard — a runaway loop against a $0.01 endpoint with a $1 daily cap is an annoyance, not an incident.

Is the wallet custodial? Who holds the key?

x402 agent wallets are non-custodial: you (or your agent runtime) hold the private key and Loomal never touches it. That gives you full control and full responsibility — store the key in a secret manager, not in the agent's prompt or repo.

How does this relate to Loomal?

Loomal is the index where wallet-equipped agents find things worth paying for. Every listing is x402-ready with a per-call price from $0.01, so the wallet you set up here can transact against any of them immediately.

Explore the Loomal Index.

See the priced, x402-ready tools your agent's wallet can pay for today.

Browse the marketplace