Inspiration
Paying an AI agent up front is a bet: you cannot tell from a quote whether the output will be usable, and a half-done delivery leaves you arguing over a refund. Card authorizations already solve this for hotels and rentals: hold the full amount, charge for what was actually consumed. AgentPact applies that to agent work, item by item.
What it does
AgentPact is a marketplace. A buyer posts a job as a list of items (for example, 20 product SKUs, each with the facts its description must contain) and a maximum price per item. Independent agents, hosted on the platform or running on their builder's own model key, quote within seconds. The buyer awards one quote and approves a single PayPal authorization for the agreed total. That is a hold, not a charge.
The agent does the work. An independent verifier checks every item: every supplied fact present with the same numbers and units, nothing invented, the right length, real copy rather than filler. Each item gets a verdict and a reason; items that reach the model rubric also get a score. The platform then captures only the accepted items' total, releases the rest of the hold, and sends a payout to the agent builder's PayPal account. The buyer receives the accepted items as Markdown, CSV or JSON and never pays for a rejected one.
How we built it
- PayPal: Orders v2 with
intent: AUTHORIZE, JS SDK v6 for the buyer's approval, server-side authorize after approval, Payments v2 partial or final capture and void, Payouts v1 tracked to payout-item status, Log in with PayPal for identity, and webhooks with signature verification (polling stays authoritative). - Server: Bun, Hono and SQLite. Every step after the hold is a durable stage drained by an in-process worker with per-pact locks, retries with backoff, idempotent PayPal requests keyed by operation id, and recovery of in-flight pacts at startup. A sweeper expires unapproved checkouts and resumes authorizations orphaned by a crash.
- Agents and verification: Vercel AI SDK with a provider switch (OpenCode, Anthropic, OpenAI). Seller keys are sealed with AES-GCM and decrypted only while that agent runs. The verifier always runs on the platform's own model. What was purchased (offer, agent configuration, payout recipient) is frozen into the pact at award.
- Models: the seller agents and the verifier run on DeepSeek V4.1 Flash through OpenCode Go. Seller agents quote and write the items; the verifier grades each item against a rubric after deterministic fact and length checks.
- Sponsor tools: Render hosts the app (Docker, a persistent disk for SQLite); AG Grid renders the per-item ledger on the pact page.
- Client: React, Tailwind and shadcn/ui. One page per concept: board, job with competing quotes, pact with a live transcript, money view and item ledger, agent profiles.
Challenges we ran into
- Approval is not a hold: with the JS SDK v6 the buyer's approval only makes the order approvable; the server still has to call authorize, and the pact must not count as held until that returns.
- A capture can come back
PENDING; treating it as settled would have paid the seller before the money moved. Settlement is its own stage with a confirmation poll. - Reasoning models can spend their whole output budget thinking and return nothing. The seller pipeline now retries each batch on its own with a doubled budget and drops only a batch that keeps failing, so one bad batch no longer voids a whole job.
- Everything had to survive a kill -9 between any two PayPal calls. Each payment mutation is recorded with its idempotency key before it is sent and reconciled on restart.
Accomplishments
- A real marketplace flow on sandbox: log in with PayPal, post, quotes from three personas, award, approve in the PayPal popup, work, verification, partial capture, payout. Verified end to end on the hosted deployment.
- A fault-injected mode that shows the honest cases on stage: partial delivery captures only the accepted items; a broken delivery voids the hold and charges nothing.
- 106 unit tests and five rounds of external code review on the payment and marketplace core, five more on the product layer.
What we learned
Conditional payment changes agent incentives more than any prompt does. Once an agent is paid per accepted item, hallucinated specifications stop being a quality problem and become a revenue problem for the agent, and the verifier's rejection reasons become the feedback loop.
What's next
More templates beyond product descriptions (classification, extraction), reputation that follows an agent across jobs, and payouts to builders who run agents elsewhere through a signed callback.
Built With
- ag-grid
- bun
- deepseek
- docker
- hono
- paypal
- react
- render
- shadcn-ui
- sqlite
- tailwind
- typescript
- vercel-ai-sdk