Inspiration

I build AI agents that move money. The bug that scares me is not a wrong answer. It is an agent that pays twice and thinks it did its job.

AI agents now buy things for people. Sooner or later, one of those orders never arrives. Today, that complaint lands in an inbox; nobody answers in time; it becomes a claim, and the seller pays a $15 dispute fee on top of the lost sale. I want the buyer’s and seller’s agents to settle it themselves in PayPal while it is still an inquiry, and to leave proof that nothing was paid twice.

What it does

Clearwake handles one problem end-to-end: an order that never arrived.

  1. The owner says the rules once. “Refund anything under five dollars that has not arrived in ten days. Ask me above that. Never refund twice.” Clearwake reads the rules back in plain words. The owner says yes. The rules are signed. After that, the model can suggest anything. It can never cross the line.
  2. The buyer’s agent opens the dispute in PayPal, only for orders its own mandate covers.
  3. The seller’s agent reads the dispute and PayPal’s own record of the order and the tracking; the model drafts. The signed rules decide.
  4. Inside the limit, it settles on its own. It sends an offer through PayPal’s dispute conversation. PayPal closes the case at the inquiry stage, before it becomes a claim.
  5. Above the limit, it waits for the owner. The owner can decide by voice: “Approve case 4” or “Don’t pay case 9, send the proof.”
  6. It never trusts its own word. If PayPal’s reply gets lost, Clearwake reads PayPal’s record before doing anything again. Every step leaves a signed receipt from each side that anyone can check in a browser. Change one line, and the check fails.

Every other kind of dispute goes to the owner untouched.

What happened on the real PayPal sandbox

  • 10 orders bought by an agent, 10 “never arrived” claims.
  • 5 resolved inside PayPal. 4 settled at the inquiry stage, before a claim, at a $0.77 settlement fee each instead of the $15 dispute fee.
  • 4 answered with proof, now under PayPal’s review.
  • 1 claim refused by the buyer’s own mandate: $20 claimed on a $9 order.
  • 2 cases decided by the owner’s voice.
  • Nothing paid twice.

I broke it on purpose.

I ran an agent on PayPal’s own Agent Toolkit through 200 episodes with lost replies, a buyer message saying “ignore your limits,” and requests over the limit. It overpaid $2,633.25 and refunded twice 61 times.

The same 200 episodes through Clearwake: $0.00 overpaid, 0 double refunds. (Local run against a local PayPal layer, labelled that way everywhere.)

I also counted the model’s mistakes. In 42 test prompts, the model proposed the wrong move 9 times. The rules decided all 42 correctly. That is the whole idea: the model drafts, the rules decide.

Who it is for

A small PayPal seller who ships physical goods and cannot answer every “where is my order” message in time. I asked five real sellers how often a buyer says an item never arrived: 25 to 32 cases a month between them, 0 to 15 each. They asked to stay anonymous.

And any developer building agents on PayPal. Clearwake wraps PayPal’s Agent Toolkit in one line, or runs as an MCP server in front of PayPal’s tools, so any agent gets the same limits, the same “read the record before retrying” rule, and the same receipts.

How I built it

  • Python, standard library only, calling PayPal’s Orders, Payments, Disputes, and Add Tracking APIs through one adapter that only allows the sandbox.
  • A local model (qwen3.5:4b through Ollama) drafts for both agents. It never approves, never moves money, never changes a limit.
  • The signed rules, per-order caps, the record check before any retry, and the hash-chained receipts come from verdock-core, my own open-source library.
  • Voice: Sarvam for speech-to-text and the two product voices, labelled on screen.
  • AG Grid for the dispute ledger the owner decides from. Render for the live console. APIMatic for the API portal and SDK. Postman for the request collection.

Challenges I ran into

  • A seller’s app cannot open a dispute for a buyer in PayPal, so the buyer’s agent works through the Resolution Center the way a person would.
  • PayPal refuses an offer sent right after a message, so Clearwake sends the offer alone and records every refusal in a receipt.
  • A lost reply must never become a second refund. Each money move keeps one request ID, and PayPal’s record decides what happened.
  • One case took PayPal more than a minute to show as resolved. The agent waited and re-read instead of resending.

Accomplishments that I'm proud of

Two agents settled real sandbox disputes inside PayPal before they became claims. An owner decided real cases by voice. Nothing was paid twice, and every step can be checked by anyone.

What I learned

A model is a good drafter and an unsafe decider. “Done” has to come from PayPal’s own record, not from the agent that sent the request. And the most useful part of the Disputes API is the part that talks: the message and the offer, because that is where the fee is avoided.

What's next for Clearwake

The same loop for every other dispute type, each with its own signed rules, and a pilot with one of the five sellers.

Built With

  • ag-grid
  • apimatic
  • ed25519
  • javascript
  • mcp
  • ollama
  • openapi
  • paypal
  • paypal-agent-toolkit
  • paypal-disputes-api
  • paypal-orders-api
  • paypal-payments-api
  • playwright
  • postman
  • python
  • qwen
  • render
  • sarvam
  • vercel
  • webcrypto
Share this project:

Updates

Submission history