Inspiration
Nowadays, the abilities of AI agents include conducting real-world transactions. However, granting them access to payment wallets results in great threats. The need to develop such a system, which would grant agents full autonomy without allowing humans to lose control over the budget, permissions, approval, and payments, was obvious.
What it does
Agent Leash is a zero-trust payment channel between AI agents and PayPal that verifies each purchase by its cryptographic proof of spending mandate. The policy engine verifies budgets, limits, categories, vendors, velocity, duplicity, and prompt injection.
Transactions can be automatically approved, escalated to a human for a review, or blocked before any money is transferred. Transactions that are approved employ PayPal authorization holds and are collected after the delivery confirmation. Every decision and status change of a transaction is logged using a tamper-evident SHA-256 chain.
How we built it
Agent Leash is a TypeScript pnpm monorepo that uses Turborepo. This project uses a Hono Gateway, Next.js Operator Cockpit, PostgreSQL with Drizzle ORM, Redis/BullMQ workflows, PayPal APIs, Ed25519 mandates signing, policy-engine layer, webhooks, and cryptographic ledger.
This architectural design divides policy evaluation, payment orchestration, delivery validation, human escalation, and audit logging.
Challenges we ran into
The most difficult aspects have been creating the transitions for payments which are secure, authorizations and captures coordination, protection against prompt injections, detection of duplicate payments, and reservation of budgets consistently during concurrency.
In addition, we needed to develop a system that would function in a reliable way with multiple services, asynchronous webhooks, database transactions, and local development environment.
Accomplishments that we're proud of
We created an end-to-end autonomous payment workflow with:
Cryptographically signed spending mandates Multi-layer policy evaluation Human-in-the-loop escalation PayPal two-phase authorization and capture Delivery-triggered settlement Duplicate and prompt-injection protection Tamper-evident hash-chain auditing Operator visibility through the Cockpit dashboard Safe denial with zero funds moved
What we learned
We learned that autonomous payments require more than authentication. They require authorization boundaries, transaction-level policy enforcement, reversibility, observability, and strong auditability.
We also learned that payment workflows must be designed around failure scenarios, including delivery failure, expired authorizations, duplicate requests, webhook retries, and service interruptions.
What's next for Agent Leash
Next, we plan to improve production readiness by adding stronger identity and authentication flows, richer merchant and delivery integrations, better semantic fraud detection, policy simulation tools, real-time monitoring, expanded PayPal payment scenarios, and support for multiple payment providers.
Our long-term goal is to make Agent Leash the standard safety layer for trustworthy autonomous commerce.
Built With
- ag-charts
- ag-grid
- blockchain
- bullmq
- channel3
- docker
- drizzle-orm
- ed25519
- hono
- mcp
- next.js
- node.js
- paypal-apis
- pnpm
- postgresql
- react
- redis
- render
- rest-api
- sha-256
- turborepo
- typescript
- vitest
- webhooks
- zod

