Inspiration

We asked an AI assistant to plan a trip on a ₹10,000 budget, and then realized how little we actually controlled. To get the job done, the assistant hires a travel agent and a hotel agent, and those agents can hire helpers of their own. Money ends up moving through a chain of agents we never met, and nobody can answer simple questions. Can the hotel agent overspend? Can a helper forge permission? Can we cut one agent off?

Payment protocols like AP2 cover the first hop, where a user trusts one agent. Agent-to-agent delegation is left outside the specification. We wanted to build the missing piece: delegating tasks is easy, delegating money without losing control isn't.

What it does

PayGuardian is a delegation layer that lets you give AI agents a budget instead of your wallet.

  • You create an environment (for example, a Goa trip), set a budget and expiry, and approve it once.
  • You get a main agent to chat with, and you can attach more agents from a library or connect your own through MCP.
  • The main agent splits the budget, and every agent receives a slice with its own limit, scope and expiry. A slice can only shrink as it passes down the chain.
  • Agents never hold payment credentials. They ask PayGuardian, which verifies the whole chain of permission before any payment goes to PayPal.
  • Overspending, forged permission, expired or revoked access, and out-of-scope requests are refused with a plain-language reason.
  • You can revoke any agent and its whole branch, and trace any payment back to your original approval.

How we built it

  • Delegation engine and worker (Python): verifies the delegation chain on every request, reserves budget atomically, and keeps an append-only audit log.
  • Agents (Python): a main agent and library agents that call the gateway for every protected action.
  • Gateway interface: exposed as an MCP server and an API, so Claude or any agent framework can connect without being rebuilt.
  • Frontend (Next.js): a workspace with a chat, sessions, memory and a live graph of the agent hierarchy, plus approvals, a payment trace and an audit table. All values come from the backend.
  • Payments: PayPal sandbox.

The core accounting rule is that delegation is an allocation, not a copy. For every mandate $M$ with limit $L(M)$:

$$\text{spent}(M) + \text{reserved}(M) + \text{allocated}(M) \le L(M)$$

Because a child's limit is deducted from its parent when it is delegated, the sum of everything in the tree can never exceed what the user approved.

Challenges we ran into

  • Children together, not just individually. A signed token can prove that a child is no bigger than its parent, but not that several children together stay inside the parent's budget. This needed a ledger that reserves budget at delegation time.
  • Concurrency. Two agents requesting the same remaining funds at once must not both succeed.
  • Uncertain payments. If a provider times out, the money can't be treated as spent or released until the outcome is confirmed.
  • Showing authority. Cryptographic checks are invisible, so we designed a graph where nodes with authority look solid and unfunded ones look dashed, and where gateway-verified facts are visually separate from what an agent says.
  • Keeping agents honest by design. A prompt-injected agent can ask for anything, so every limit is enforced outside the model.

What we learned

  • Authority is easier to reason about when it only narrows, and every feature became simpler once we held to that rule.
  • Identity says who an agent is, but a mandate says what it may do right now, and the two need to stay separate.
  • A security product has to be shown to be believed. The rejections and the revoked branch going dark did more than any explanation.

What's next

  • A written spec for agent-to-agent delegation as an AP2 extension.
  • Support for more payment providers, and human-signed mandates using passkeys.
  • A larger library of agents and ready-made environment templates.

Built With

Share this project:

Updates

Submission history