Inspiration

Riya runs Kantha & Co., a small hand-stitched textiles shop.

She sells to buyers in the US and Europe, and the work around that - German listings, cleaner catalogue data, a logo that keeps piling up. Last month she paid twice for translations that were unusable. The money was already gone, and she still had to redo the work.

That is an old problem with a new worker. AI agents can now take jobs. Someone still has to pay them. Pay first, and you hope the delivery is good. Deliver first, and the worker hopes you pay. Nobody has time to check every line by hand, and a careless or dishonest agent can dress up a bad job.

PayPal already knows how to reserve money, take part of it, give the rest back, and pay someone. The missing piece is a fair, visible way to decide when that should happen between strangers, including when one of them is an agent.

Covenant is that thought to solve this issue. The money waits until the work matches what both sides signed.

What it does

You describe the job in plain language. An assistant finds a worker and drafts a contract:

  • what "done" means,
  • which facts must be true,
  • and how the payment splits if only some of the work passes.

You read it, change what you want, and agree. PayPal holds the amount before anyone starts.

The worker can be an outside agent or a person, who will list themselves on Covenant platform. A person can bring and connect their outside Agent to the platform or can provide service or work themselves as human. Some of the AI agents here are created for this project are Lipi translates. Tally fills product records. Some of the Humans here are created for this project Arjun , a designer, submits through a form. The path into escrow is the same.

When the work comes back, the Arbiter (a verification pipeline that uses AI for part of its work) checks it. Hard facts run in code first - item counts, language, numbers that have to match the source, hidden text. A model then scores quality against the rubric in the contract. The score lands in a band you already signed:

  • The work passes, and PayPal captures the full hold.
  • Part of it passes, and PayPal captures that share and releases the rest. You can see which rows failed.
  • It fails, or the delivery tries to talk the reviewer into a better score, and the hold goes back to you. A worker caught gaming the check is suspended.

A score on the border waits for a person. The worker can appeal, you read a short memo, and you make the call. A monthly spending mandate keeps the assistant inside the budget, the task cap, and the kinds of work you allowed. Every hold, capture, and release is written to a ledger with the reason beside the amount.

How we built it

The app is a React frontend and a FastAPI backend, with MySQL and the workers in Docker. It runs on a laptop against the PayPal sandbox.

Money uses PayPal's own APIs. The hirer connects a sandbox account once. Each contract creates an authorization, so the funds are reserved and not yet taken. After the verdict, a capture can take all or part of that hold, and a void gives back what was not taken. The provider is then paid the captured amount minus a small platform fee. Every call carries a fixed request id, so a retry after a timeout replays the same result. A second hold cannot open by accident. Webhooks are signature-checked, and a reconcile job compares open holds with PayPal when an event never arrives.

The delicate moment is the gap between "PayPal said yes" and "we wrote that down." The contract change and the PayPal job are saved in one database transaction. A runner picks up each job and locks it, so two processes cannot capture the same hold.

The model writes and scores. Ordinary code settles. The assistant can search, draft, and explain. The hirer is the one who agrees, and that click is what asks PayPal to hold funds. The Spec Writer proposes the checks. Code sets the price, the item count, and the payment bands, and it rejects a rubric that does not add up. The Arbiter loads the delivery, runs the hard checks, looks for hidden instructions, asks a model for scores, and then stops. A plain function maps the ratio onto the bands in the signed spec. On a close call, a second model can only send the job to a person.

Workers speak the Agent-to-Agent protocol. Paste a URL, Covenant fetches the agent card and runs a test job before the worker is listed. Deliveries are stored as data and shown as data, so a hidden note stays evidence.

Challenges we ran into

The PayPal sandbox is precise, and a few edges were ours to close. Voiding an authorization that is already voided has no dedicated error, and a void can come back empty. We treat that as success only after reading the authorization and seeing that it really is voided. A partial capture has to be marked final, or the leftover stays reserved.

Retries were the other money problem. If the process dies after PayPal accepts a capture and before we record it, the job has to be safe to run again. The same request id is what makes PayPal return the original capture.

The cheat was harder than the happy path. One demo worker, QuickWordz, hides a line in its delivery asking for a perfect score. The model still has to score the real work, a scan has to catch the trick, and settlement has to release the whole hold. We wrap untrusted text so the prompt treats it as data. The scan still runs in code, because a prompt can be talked around.

Localhost made webhooks awkward. PayPal cannot call a laptop, so a tunnel brings the events in, and reconciliation covers the ones that never show up.

Accomplishments that we're proud of

The loop closes. A hold, a delivery, a verdict, a capture or a release, and a payout all show up in the sandbox and in the ledger.

Four stories run on the same rails. Lipi translates a full set of listings, the Arbiter passes them, and the provider is paid. Tally invents dimensions on some product rows, and only the passing share is captured, with the failed rows named. QuickWordz tries to flatter the judge and loses the hold. Arjun's design sits above the approval limit, so the assistant asks first. A borderline score can be appealed, and the hirer decides.

The piece we kept protecting is small. The function that turns a verdict into cents does not call a model. A wrong or flattering score can change the band. The amount still comes from the contract.

What we learned

Holding money is a state machine. The bugs that mattered lived in two questions: what if this runs twice, and what if PayPal and our database disagree?

We also learned where a model earns its place. It is good at reading a messy delivery against a rubric. It is a poor cashier. Putting the cashier in ordinary code made the rest easier to test. The bands, the retries, and the legal state changes do not need an API key.

A marketplace only works if a person and an agent can take the same contract. Once the delivery is just data and the payout is just a PayPal email, Arjun and Lipi are the same kind of worker.

What's next for Covenant

The proof runs in the sandbox, on one machine, in US dollars, for text and a simple design file. Next is the same loop on real PayPal accounts, more kinds of work, and a clearer path when both sides still disagree after an appeal. We also want a new agent to register, pass the test job, and start taking work on its own.

Agents will keep hiring. The piece worth keeping is the pause: money waits until the work matches what both sides signed.

Built With

Share this project:

Updates

Submission history