Inspiration

Paid trading signals are sold on trust. A paid group charges a monthly fee whether its calls are right or wrong. Sonar already publishes a public, walk-forward record of its prediction-market calls, so we wanted to put money behind it: if a call is wrong, the buyer gets refunded automatically. And because people increasingly hand research to AI agents, we wanted an agent that can buy these signals for you, inside a budget you set, without ever moving money on its own.

What it does

  • Signal Briefs, $1.99 through PayPal. Every open market where Sonar has a call sells a brief through the PayPal JS SDK v6 button. Buying freezes Sonar's call at that moment (side, score, price). An AI model then writes the brief from Sonar's own numbers only: the trade tape, the price path and other venues.
  • Accuracy guarantee. When the market resolves against the frozen call, or is cancelled, Sonar refunds the capture through the PayPal Refunds API automatically. The guarantee's record (right / refunded) is public on /desk.
  • Shopping agent. On /desk you set a mandate (budget, categories, least call strength) and chat. The agent searches Sonar's radar, opens a PayPal order for each brief that fits, and stops: every order waits for you to approve it in PayPal. The budget and limits are enforced in code on every purchase, not by the model, and a repeat purchase is refused by the server. It can then read and summarise the briefs you paid for.
  • Sonar Pro ($7.99 a month, PayPal Subscriptions): every brief included, no checkout per brief.
  • Webhooks, signature-verified: if you approve and close the tab, the webhook still captures your order and unlocks the brief; refunds and subscription changes update the record.

About the refund in the video. No market with a bought call resolves before judging (the markets that currently have a call close in 2027). So the video shows a labelled sandbox demo settlement: a secret-protected, sandbox-only route settles one brief as if its market resolved against the call. The outcome is simulated; the refund is real and runs the same guarantee code and the PayPal Refunds API. Demo settlements are listed separately on /desk and never counted in the public record.

How we built it

Next.js 14 on Render. PayPal: Orders v2 (create and capture), Refunds, Subscriptions (product, plan, subscription), Webhooks with signature verification, the JS SDK v6 one-time payment session, and the PayPal Agent Toolkit (@paypal/agent-toolkit/ai-sdk, read-only get_order) inside the agent. Every create, capture and refund carries a PayPal-Request-Id, so a retried sweep can never refund twice.

AI tools and how we used them:

  • Vercel AI SDK runs the shopping agent's tool-calling loop (find calls, open an order, check purchases, read a brief).
  • gpt-oss-120b on Groq is the model for the agent and for the brief writer. The writer gets only Sonar's own facts as JSON and must not invent numbers; a deterministic template takes over if the model is unavailable.
  • PayPal Agent Toolkit gives the agent read-only access to its orders.

Data: Sonar's existing radar of Panta prediction markets on Solana, read from the shared Upstash store. The Desk deployment runs read-only, so it can never write the radar.

What changed since 1 October

Sonar existed before the hackathon (the market radar and its track record). Everything PayPal and everything agentic is new and was built from 11 October: the brief checkout and writer, the accuracy guarantee and refund sweep, the shopping agent and its mandate gate, Sonar Pro, webhooks, the /desk pages, the sandbox demo settlement, and the read-only deployment mode. Branch paypal: about 3,700 lines across 38 files, 15 new tests (144 in total).

Challenges we ran into

  • Making an agent safe with money. The model never gets a tool that pays. It opens orders; a person approves in PayPal; our server captures only after approval. Budget and category checks live in src/lib/mandate.ts and run on every purchase.
  • Refunds must never happen twice. Idempotency keys on every PayPal write mean a retried sweep returns the first result.
  • v6 presentationMode: 'auto' fails in some tabs (Payment Request), so we use the popup and keep an approve-link fallback.
  • Groq retired the Llama model mid-build. We moved to gpt-oss-120b and made tool schemas accept null for optional fields.

Accomplishments that we're proud of

A refund guarantee that actually runs end to end in the PayPal sandbox, and an agent that shops but cannot spend.

What we learned

The safest agentic-commerce design keeps the model on the "propose" side: it can find, explain and open an order, while limits and money movement stay in code and with the person.

What's next for Sonar Desk

Partial refunds scaled to how wrong a call was; Pro members credited for missed calls; the agent running on a schedule against a standing mandate; going live with a PayPal business account.

Built With

  • groq
  • next.js
  • paypal
  • paypal-agent-toolkit
  • paypal-subscriptions
  • paypal-webhooks
  • render
  • solana
  • typescript
  • upstash
  • vercel-ai-sdk
Share this project:

Updates

Submission history