Inspiration
Every morning, people walk past the Yamuna in Delhi and see plastic caught on the ghat steps. Volunteers and waste pickers do clean it, but nobody is paid to clean that stretch at that moment, and donors rarely see what their money changed. We asked a simple question: what if the river could hire its own cleaners?
What it does
RiverMind gives a river its own AI agent and its own PayPal wallet.
- It notices. Photos and water-quality readings come in, and the AI flags waste or a sudden spike in turbidity.
- It posts a cleanup quest. The agent proposes a bounty, and code enforces the budget, so the AI never decides how much money moves.
- Someone cleans it. A worker claims the quest and uploads before-and-after photos.
- It checks the work. The AI verifies that it is the same place, that the waste actually dropped, and that the photos are not reused or edited.
- It pays. The worker is paid through PayPal Payouts. Larger payouts wait for council approval.
- Everyone can see it. Donations, payouts and the river's health live on a public dashboard.
How we built it
- Frontend: Next.js and TypeScript, with a live dashboard of the river's health, treasury and quests.
- Backend: FastAPI with SQLAlchemy and Alembic, running a strict state machine for every bounty.
- PayPal:
- Orders API: donations.
- Payouts API: worker rewards.
- Webhooks: real-time status.
- Agent Toolkit: fundraising invoices drafted by the river's agent.
- AI:
- Detection: a YOLO11n detector we trained to spot and count waste, running on ONNX.
- Verification: a vision model on Groq.
- Agent: bounty proposals and a daily river diary.
A cleanup only passes when every independent check agrees:
$$ \text{pass} = \text{geo} \land \text{time} \land \lnot\,\text{duplicate} \land \text{scene} \land \text{drop} \land \text{vote} \land \lnot\,\text{manipulated} $$
where the waste must fall by at least 60%:
$$ \text{after} \le 0.4 \times \text{before} $$
Challenges we ran into
- Trusting photos with money. A single model shouldn't release a payment. We split verification into independent checks (perceptual hashing, feature matching, object counts and a vision-model vote) so no single signal can be gamed.
- Never paying twice. Payouts had to survive retries, double clicks and crashes. Idempotency keys and webhook reconciliation made every payout happen exactly once.
- Keeping AI in its lane. We drew a hard line: the AI proposes and scores; plain code decides every amount and every payment.
What we learned
- Agentic AI becomes trustworthy when it is boxed in by code, not when it is given more freedom.
- PayPal's sandbox let us test the whole money loop (donate, reserve, verify, pay) end to end before touching real funds.
- Transparency is a feature: showing donors exactly where each dollar went changed how we designed every screen.
What's next
We want to pilot RiverMind with a local cleanup group on the Yamuna, add more rivers, and partner with a local payout provider so workers in India can be paid in rupees.
Built With
- computer-vision
- fastapi
- github
- groq
- leaflet.js
- machine-learning
- nextjs
- onnx
- opencv
- paypal
- paypal-orders-api
- paypal-payouts
- paypal-sandbox
- paypal-webhooks
- playwright
- postgresql
- pytest
- python
- qwen
- react
- recharts
- sqlalchemy
- tailwindcss
- typescript
- yolo