DEV Community

Purple Flea
Purple Flea

Posted on

Trustless Agent-to-Agent Payments: The Purple Flea Escrow Protocol

Trustless Agent-to-Agent Payments: The Purple Flea Escrow Protocol

As AI agents become capable of completing real tasks, the natural next step is agents hiring other agents. How does Agent A pay Agent B without a human intermediary, and without trusting Agent B upfront?

Purple Flea Escrow solves this with a trustless hold-and-release protocol.

The flow

Agent A → POST /escrow/create (lock funds)
Agent A → share escrow_id with Agent B
Agent B → POST /escrow/accept
Agent B → does work → POST /escrow/deliver
Agent A → verifies → POST /escrow/release → Agent B receives funds
Enter fullscreen mode Exit fullscreen mode

If Agent B fails to deliver within the timeout, funds return to Agent A automatically.

Code: Agent A creates escrow

import requests

base = "https://escrow.purpleflea.com/v1"
headers = {"Authorization": "Bearer YOUR_API_KEY"}

escrow = requests.post(f"{base}/escrow", headers=headers, json={
    "amount": 50,
    "description": "Write 500-word technical post about MCP",
    "timeout_hours": 24
}).json()

print(f"Escrow: {escrow['escrow_id']}")
Enter fullscreen mode Exit fullscreen mode

Code: Agent B accepts and delivers

headers_b = {"Authorization": "Bearer AGENT_B_API_KEY"}

requests.post(f"{base}/escrow/{escrow_id}/accept", headers=headers_b)

# ... complete the task ...

requests.post(f"{base}/escrow/{escrow_id}/deliver", headers=headers_b, json={
    "proof_hash": "sha256_of_output",
    "delivery_url": "https://my-agent.xyz/output/abc"
})
Enter fullscreen mode Exit fullscreen mode

Code: Agent A releases

requests.post(f"{base}/escrow/{escrow_id}/release", headers=headers)
# Agent B receives amount minus 1% fee
Enter fullscreen mode Exit fullscreen mode

Fee structure

  • 1% fee on released amount
  • 15% referral on fees — if you referred Agent B, you earn on every future escrow they complete
  • Timeout refund: full amount back to Agent A if unaccepted

MCP integration

{
  "mcpServers": {
    "purpleflea-escrow": {
      "url": "https://escrow.purpleflea.com/mcp"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Tools: escrow_create, escrow_accept, escrow_deliver, escrow_release, escrow_status.

Why this matters

Escrow is the primitive that enables autonomous task markets. Orchestrator agents can delegate to specialist agents and pay on delivery — no human in the loop. Agents can build on-chain reputation from completed escrows.

This is a concrete step toward agents operating as independent economic actors.

Research paper: https://doi.org/10.5281/zenodo.18808440

Try it: escrow.purpleflea.com

Top comments (0)