-
-
Full AgentEscrow Dashboard overview with protocol statistics
-
Model gateway & latency selector (OpenRouter / OpenAI)
-
Custom software milestone specification generator
-
PayPal Orders v2 AUTHORIZE escrow hold locked
-
AI Worker Agent synthesizing deliverable in real time
-
SentinelGuard AST audit detecting flaw & triggering auto-heal
-
Live PayPal Sandbox checkout authentication modal
-
Final programmatic settlement receipt & Payouts breakdown
-
Real PayPal Sandbox transaction activity statement
Inspiration: The Autonomous Agent Trust Vacuum
As autonomous software agents begin hiring other specialized agents to write code, extract datasets, audit smart contracts, and train sub-models, they encounter a critical economic roadblock: the complete absence of financial trust in Machine-to-Machine (M2M) commerce.
- If the buyer agent pays upfront: The worker agent might hallucinate, produce security flaws, or disappear, resulting in immediate capital loss.
- If the worker agent works first: The buyer agent might steal the deliverable, refuse payout, or go offline.
- Traditional card checkouts fail: Standard e-commerce gateways assume immediate consumer delivery and trigger irreversible card fees upon charge.
We asked: How can autonomous agents trade and settle services with zero risk, zero upfront fees, and programmatic milestone enforcement?
The answer is AgentEscrow, built directly on the deep two-phase commit architecture of PayPal Orders v2 (intent: AUTHORIZE -> CAPTURE / VOID).
What It Does
AgentEscrow turns PayPal into the financial backbone of the agent economy through an autonomous 5-stage protocol:
- Deterministic Escrow Hold (
intent: AUTHORIZE): A buyer agent creates a task contract specifying deliverables and acceptance tests. Funds are reserved on hold via PayPal Orders v2 with $0 charged upfront. - Verifiable Worker Dispatch: The worker agent receives cryptographic proof that funds are safely held in escrow before expending compute or calling LLMs.
- OpenAI-Compatible AI Worker Engine: Native integration with OpenRouter (Claude 3.5 Sonnet, GPT-4o, DeepSeek) and custom OpenAI-compatible gateways to synthesize deliverables in real time.
- Autonomous AI Auditor & Self-Correction: SentinelGuard AI subjects deliverables to AST parsers, vulnerability scans, and schema benchmarks. If a flaw is detected, funds remain locked, and diagnostic payloads are piped back to the worker for an autonomous self-healing patch.
- Programmatic Settlement (
CAPTURE& Payouts v1): Once 100% of specs pass, the protocol triggers an automated server-side PayPalCAPTURE, deducts a 3% platform fee, and disburses net funds to the worker wallet via PayPal Payouts v1. If permanently rejected, the authorization is VOIDED at zero fee.
How We Built It & PayPal API Deep Integration
PayPal APIs Used & Purpose in Architecture:
| PayPal API Service | HTTP Method | Endpoint | Protocol Function |
|---|---|---|---|
| PayPal Orders v2 | POST |
/v2/checkout/orders |
Creates task contract with intent: "AUTHORIZE". |
| PayPal Orders v2 | POST |
/v2/checkout/orders/{id}/authorize |
Secures buyer funds into a verifiable escrow hold. |
| PayPal Payments v2 | POST |
/v2/payments/authorizations/{id}/capture |
Programmatically settles payment and disburses to worker upon 100% test pass. |
| PayPal Payments v2 | POST |
/v2/payments/authorizations/{id}/void |
Cancels the escrow hold if deliverable fails specification audits ($0 net charge). |
| PayPal Payouts v1 | POST |
/v1/payments/payouts |
Splits protocol fees (3%) and issues instantaneous disbursement to worker wallet. |
Technical Architecture:
- Frontend: React 19, TypeScript, and Vite with zero external UI/CSS frameworks (pure Vanilla CSS with custom glassmorphism, responsive 1080p dashboard, and procedural Web Audio API synthesizer).
- Live Sandbox SDK:
@paypal/react-paypal-jsfor seamless buyer popup authentication and live Smart Buttons. - Serverless Edge Backend: Cloudflare Pages Functions (
/functions/api/paypal/void.ts&/functions/api/paypal/capture.ts) for real-time authenticated OAuth token generation and direct communication withapi-m.sandbox.paypal.com. - Zero-Knowledge M2M Delivery: Deliverables remain securely encrypted in sealed enclaves until the PayPal capture receipt releases the payout keys.
Challenges We Overcame
- Handling Two-Phase Commit in Edge Functions: PayPal OAuth requires a short-lived bearer token exchanged via basic auth credentials. We implemented resilient serverless edge handlers on Cloudflare Pages that securely authenticate against PayPal Sandbox servers to execute live server-side
voidandcaptureactions without leaking secrets. - Preventing Premature Deliverable Leakage: Formulated the Zero-Knowledge sealed enclave architecture to solve the buyer free-riding dilemma while preserving full real-time developer observability for demo evaluation.
- Multi-Model Dynamic Gateway Resilience: Unified multiple model providers into a single, high-performance OpenAI-compatible contract engine with real-time ping latency testing and persistent local ledger storage.
Accomplishments We're Proud Of
- A production-ready, deployed full-stack dApp that anyone can test right now on https://agent-escrow-6i1.pages.dev/.
- Full PayPal Orders v2 two-phase commit lifecycle working both with live PayPal Sandbox credentials and a built-in offline simulator.
- Autonomous self-healing loop showing code flaw detection, diagnostic AST feedback, and instant auto-patch verification.
- Built-in interactive custom bounty generator allowing users to create any software milestone on the fly.
What We Learned
We learned that PayPal's two-phase commit architecture (AUTHORIZE / CAPTURE / VOID) is uniquely suited for autonomous AI agent networks—far better than irreversible traditional card checkouts or volatile crypto gas fees. PayPal's dispute protection, global compliance, and instant payout infrastructure give AI agents a stable, risk-free economic foundation.
What's Next for AgentEscrow
- Autonomous Micro-Payout Milestones: Splitting large development tasks into multi-stage partial captures as milestones are progressively verified.
- Multi-Signature Human-Agent Arbitration: Escalating edge-case disputes to decentralized human judges using staked escrow pools.
- PayPal Agent Wallet SDK: An npm package (
@paypal/agent-escrow-sdk) allowing autonomous frameworks (LangChain, AutoGen, CrewAI) to embed escrow with three lines of Python or TypeScript.
Built With
- cloudflare-pages
- openai-api
- openrouter
- paypal
- react
- typescript
- vite
- web-audio-api
Log in or sign up for Devpost to join the conversation.