# Paying an AI agent for work it hasn't delivered yet: bonded jobs on Solana, tried locally

> Source: <https://dev.to/agent402dev/paying-an-ai-agent-for-work-it-hasnt-delivered-yet-bonded-jobs-on-solana-tried-locally-3ljn>
> Published: 2026-11-23 13:41:55+00:00

**Key takeaway:** Agent402 Bond settles long-running agent jobs by escrowing a seller bond of at most 20% of the price plus a buyer deposit, releasing funds only on dual signatures and the Solana clock, so a seller who never delivers forfeits the bond while a quality dispute just returns each side's money.

x402 handles the simple case well: an agent pays, and gets a response right away. Many useful jobs do not fit that shape. A report, an export or a batch of lookups takes minutes, and the buyer pays before it can see the result.

Agent402 Bond is a small Solana program for that gap. For one deal, the seller locks a bond and the buyer can lock a deposit. What happens to that money depends only on the two parties' signatures and the Solana clock. There is no arbiter and no operator who can move the funds.

This post shows how to try it with your own AI agent (Claude Code or any MCP client) on a local fork of Solana mainnet. It uses throwaway keys and fork-only USDC, so nothing real is spent. It takes about five minutes.

`open`. The seller's bond (at most 20% of the price) and the buyer's deposit go into a vault that belongs to that one deal.
The outcomes, from the [terms](https://github.com/agent402-dev/agent402-toolkit/blob/main/docs/bond/TERMS.md):

| At the deadline | Seller gets | Buyer gets | 
|---|---|---|
| Buyer confirmed and paid | Bond back + deposit | The work | 
| Seller marked delivery, buyer never confirmed | Bond back | Deposit back | 
| Nothing marked or confirmed | Nothing | Bond + deposit | 
| Both sign to cancel | Bond back | Deposit back | 

One design choice matters here. If the seller marks delivery and the buyer refuses to confirm, each side just gets its own money back. Neither side can profit from a false claim, but the program also does not judge quality. It protects the buyer against a seller who never delivers, not against a disagreement about how good the work is.

You need Node 20+, [Surfpool](https://github.com/txtx/surfpool) (a local Solana mainnet fork), and an MCP client such as Claude Code.

**1. Start a mainnet fork** in its own terminal:

```
surfpool start --network mainnet --no-tui
```

The fork pulls the deployed Bond program and USDC from mainnet when they are first used. Everything disappears when you stop it.

**2. Start the demo seller:**

```
git clone https://github.com/agent402-dev/agent402-toolkit
cd agent402-toolkit && npm install
cd packages/pay-mcp
npx tsx examples/bond-local/start.ts
```

The script creates a throwaway seller and buyer, gives each 2 SOL and 100 USDC on the fork, and starts a seller at `http://127.0.0.1:8790`. The job counts the words in a short text. The price is 2 USDC, with a 0.2 USDC seller bond and a 0.5 USDC buyer deposit. The script refuses to run against anything but a local RPC.

**3. Connect your agent.** The script prints the exact settings. For Claude Code they look like this:

```
claude mcp add agent402-bond-local \
  --env X402_KEYPAIR_PATH=… --env X402_RPC_URL=http://127.0.0.1:8899 \
  --env X402_ALLOWED_DOMAINS=127.0.0.1:8790 --env X402_BOND_SELLERS=<seller> \
  --env X402_BOND_MAX_USD=5 --env X402_MAX_USD_PER_DAY=10 \
  -- npx -y @agent402-dev/pay-mcp
```

These settings allow exactly one seller and one domain, at most 5 USDC per deal. With no settings at all, pay-mcp refuses every payment. That is also how it behaves on mainnet until you choose your own limits.

Try a prompt like this:

Use bond_job_quote on [http://127.0.0.1:8790](http://127.0.0.1:8790). If it is acceptable, buy the job with the text "hello bonded agents", show me the result, and pay only if the word count is right.

Here is what happens, tool by tool:

`bond_job_quote` reads the seller's terms and checks them against your limits.`bond_job_start` sends the text and receives an `bond_job_result` returns the work. Your agent should treat it as data, not instructions.`bond_confirm_and_pay` asks you again, then pays the 1.5 USDC balance. The seller settles and claims on its own, and the deal account closes.
If the word count is wrong, don't confirm. After the deadlines, settlement gives you your deposit back, and the seller gets its bond back.

Want to see the flow before wiring up an agent? Run the script with `--check`. A scripted buyer calls the same tools, and the script ends with `all checks passed`.

`bond_find_sellers` reads the public `@agent402-dev/bond-seller-mcp`` pay-server`. Then open a PR to add yourself to the directory.
The code is Apache-2.0 at [github.com/agent402-dev/agent402-toolkit](https://github.com/agent402-dev/agent402-toolkit). Feedback and issues are welcome, especially from anyone who tries the local flow and gets stuck.

*Not investment advice.*
