Inspiration
In Kenya, chamas are how families save: rotating savings groups where everyone contributes each month and one member takes the whole pot. Today the members are on three continents. Diaspora members pay on PayPal, Nairobi members pay cash at the meeting, and one volunteer treasurer reconciles it all in an exercise book and a group chat. The money is small; the trust is everything. One wrong tick and the group falls apart.
What it does
ChamaPot runs a chama's whole money cycle on PayPal, with an AI treasurer that can help but can never move money.
- Constitution to rules. Officials upload the group's constitution (PDF, photo or text). Claude Sonnet 5.5 extracts the rules (contribution, due date, late fine, rotation, two-official approval) with the exact source quote and a confidence score. Vague clauses are flagged and start unticked until an official confirms them.
- Every contribution is a PayPal invoice. Diaspora members pay the invoice with PayPal. When a Nairobi member pays cash at the meeting, the treasurer records it against her PayPal invoice with PayPal's record-payment API, so the books reconcile in one place.
- Verified webhooks update the books live. INVOICING.INVOICE.PAID is signature-verified and de-duplicated, then pushed to an AG Studio 3.1 dashboard where the ledger cell flashes and the pot ring fills.
- The Treasurer agent. A Claude agent inside AG Studio answers "who's behind this cycle?", sends PayPal invoice reminders through the PayPal Agent Toolkit, builds dashboard widgets by delegating to AG Studio's built-in agents, and proposes the payout when the pot is full.
- Humans approve, PayPal pays. Two officials must approve and the recipient can never approve her own pot; then PayPal Payouts sends the pot. The server refuses any payout to someone not scheduled for the cycle (try "pay my cousin Jane"), and payout batch IDs are deterministic so a retry can never pay twice.
How we built it
Next.js 16 (App Router) + React 19 + TypeScript on Vercel, Supabase (Postgres + Realtime) and the PayPal sandbox: Invoicing v2 (create, send, remind, record payment), Payouts v1, Webhooks (self-verified signatures, idempotent), Orders v2 and Transaction Search through the APIMatic-generated PayPal Server SDK, the PayPal JS SDK v6 for fine payments, and the PayPal Agent Toolkit for reminders. AI: Claude Sonnet 5.5 through the Vercel AI SDK, for the constitution reader and the Treasurer agent. The dashboard is AG Studio 3.1 with three custom widgets (pot progress, rotation wheel, approval tracker) and the new Studio Agent Framework. We wrote the PayPal integration with APIMatic's PayPal Context Plugin in Claude Code and Codex (evidence in docs/apimatic/). 26 automated tests cover the money rules.
Challenges we ran into
AG Studio's agent framework ships with OpenAI examples only, so we wrote our own Claude adapter, including making Studio's tool schemas and streaming tool calls work with Claude. Cash payments had to live on the same ledger as PayPal payments, which led us to PayPal's record-payment API. Making a payout impossible to send twice, or to the wrong person, meant moving every money rule out of the prompt and into server code.
Accomplishments that we're proud of
The AI is genuinely useful and genuinely powerless over money: it reads, explains, reminds and proposes, but every payout needs two humans and passes rules enforced in code. And the product looks and feels like something a real chama treasurer would trust.
What we learned
Trust features (approvals, locked recipients, idempotent payouts, verified webhooks) are the product, not an add-on. And the newest tools (AG Studio 3.1, the Studio Agent Framework, PayPal's Agent Toolkit) fit together better than we expected once the money rules live on the server.
What's next
A pilot with real chamas in Nairobi and the diaspora, WhatsApp reminders, multi-currency contributions, and loans and welfare funds on the same rails. Built with: paypal, paypal-invoicing, paypal-payouts, paypal-webhooks, paypal-orders, paypal-agent-toolkit, paypal-server-sdk, paypal-js-sdk, claude, anthropic, claude-sonnet-5.5, vercel-ai-sdk, ag-grid, ag-studio, apimatic, next.js, react, typescript, tailwindcss, supabase, postgresql, vercel
Built With
- ag-grid
- ag-studio
- anthropic
- apimatic
- claude
- claude-sonnet-5.5
- delegation-to-ag-studio's-built-in-agents).-it-cannot-approve-or-send-money.-ag-studio-3.1-agent-framework:-built-in-data
- next.js
- page-and-widget-agents-that-the-treasurer-delegates-to.-paypal-agent-toolkit:-the-treasurer's-paypal-invoice-reminder-tool.-apimatic-paypal-context-plugin
- paypal
- paypal-agent-toolkit
- paypal-js-sdk
- paypal-orders
- paypal-payouts
- paypal-server-sdk
- paypal-webhooks
- planning
- postgresql
- react
- supabase
- tailwindcss
- typescript
- vercel-ai-sdk
- via-the-vercel-ai-sdk):-reads-the-chama-constitution-into-rules-with-quotes-and-confidence;-powers-the-treasurer-agent-inside-ag-studio-(tool-calls-to-paypal-and-the-chama-ledger