DEV Community

Cover image for I Built a Squad of AI Agents to Chase Invoices for Me
fracabu
fracabu

Posted on • Originally published at github.com

I Built a Squad of AI Agents to Chase Invoices for Me

Chasing clients for money is the absolute worst part of freelancing and small business management. It's awkward, it consumes hours of mental energy, and quite frankly, I'd rather be coding than writing "friendly reminders" for the tenth time.

But as a self-taught dev who used to work in a warehouse, I know that if a task is repetitive and rule-based, it can be automated.

So, instead of hiring a virtual assistant, I built a team of AI agents to do the dirty work for me.

๐Ÿ› ๏ธ The Problem

Before building this tool, my process was a mess. I had a spreadsheet full of invoice dates. Every Monday, I had to:

  1. Check who hadn't paid.
  2. Calculate how many days they were overdue.
  3. Decide the tone of the email (Friendly? Firm? Legal threat?).
  4. Draft the email manually to avoid sounding like a robot.
  5. Handle the replies ("I sent it yesterday!" or "Can I pay next week?").

It wasn't just about the time; it was the context switching. Stopping deep work to play debt collector destroys productivity.

๐Ÿš€ The Solution: PayMind

I built PayMind, an autonomous system where three specialized AI agents collaborate to manage the entire payment lifecycle.

I didn't just want a script that blasts generic templates. I needed intelligence. I used Next.js 16 for the dashboard, TypeScript for safety, and Claude Code to orchestrate the agents.

Crucially, I integrated OpenRouter to access 18+ models, meaning I can run the heavy lifting on free models (like Gemini 2.0 Flash) and save the premium compute (Claude Sonnet 4) for complex negotiations.

GitHub logo fracabu / Agent-PayMind

PayMind is an AI payment reminder system that autonomously analyzes invoices, generates personalized messages, and handles customer responses using Claude AI agents.

PayMind

๐Ÿ’ฐ PayMind

AI-Powered Payment Reminder System

Italiano โ€ข English

Claude Next.js TypeScript Tailwind License

Stars Forks



image
image
image
image

๐Ÿ‡ฎ๐Ÿ‡น Italiano

Panoramica

PayMind รจ un sistema intelligente di gestione automatica dei solleciti di pagamento basato su Agenti AI Claude Code. Utilizza tre agenti specializzati che lavorano in team per analizzare fatture, generare messaggi personalizzati e gestire le risposte dei clienti.

โœจ Caratteristiche














































Funzionalitร  Descrizione
๐Ÿค– 3 Agenti AI Specializzati
Team di agenti che collaborano per gestire l'intero workflow
๐Ÿ“Š Analisi Intelligente
Identifica fatture scadute, calcola prioritร  e segmenta clienti
๐Ÿ“ง Multi-Canale
Genera messaggi per Email, SMS e WhatsApp
๐Ÿ’ฌ NLP Avanzato
Analizza risposte con intent recognition e sentiment analysis
๐ŸŽจ Dashboard Moderna
Interfaccia Next.js per visualizzare workflow in tempo reale
๐Ÿ”Œ Multi-Provider AI
Supporta Anthropic, OpenAI, OpenRouter e Google Gemini
๐Ÿ—„๏ธ Database SQLite
Persistenza dati con Prisma ORM
๐ŸŒ™ Dark/Light Mode
Toggle tra tema scuro e chiaro
๐ŸŒ Bilingue
Supporto completo Italiano e Inglese

๐Ÿค– Gli Agenti

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚
โ€ฆ

โš™๏ธ How It Works

The architecture relies on agent specialization. One massive prompt never works as well as three focused ones.

1. The Payment Monitor (The Analyst)

This agent scans the CSV/Database. It identifies overdue invoices, calculates priority scores (based on amount and days overdue), and segments clients. It doesn't write emails; it just serves data.

2. The Reminder Generator (The Copywriter)

This agent takes the data and context. If the client is 3 days late, it drafts a polite nudge. If they are 60 days late, it drafts a formal notice. It adapts to the preferred channel (Email, SMS, WhatsApp).

3. The Response Handler (The Negotiator)

This is the coolest part. When a client replies, this agent analyzes the intent using NLP.

  • Client says: "The bank transfer is scheduled for tomorrow."
  • Agent detects intent: PAYMENT_PROMISED
  • Agent action: Pauses further reminders for 48h.

All of this is visualized in a modern Next.js dashboard with a dark mode (because we're developers, obviously).

๐Ÿ“Š My Results

Here is the breakdown of managing 50 active invoices per month manually versus using PayMind.

Metric Manual Approach PayMind Automation
Time Spent ~5 hours/month ~10 minutes/month
Context Switching High (Daily interruptions) Zero (Batch processing)
Tone Consistency Variable (Depends on my mood) Perfect (Always professional)
Cost My hourly rate x 5 ~$0.10 (API Costs) or FREE
Stress Level High Non-existent

๐Ÿ’ก Pro Tips

If you fork this repo to build your own agent system, keep these in mind:

  1. Model Routing is Key: You don't need GPT-4 or Claude 3.5 Sonnet to parse a CSV date. I configured PayMind to use Gemini 2.0 Flash (Free) via OpenRouter for the analysis phase. Only use the expensive models for generating the actual human-like text. This cuts costs by 90%.

  2. Human-in-the-Loop: Always start with a "Draft Mode." PayMind generates the emails but waits for a final approval click on the dashboard before sending. AI is great, but you don't want it hallucinating a legal threat to your best client because of a CSV typo.

Conclusion

I didn't go to a bootcamp to learn this. I used curiosity and AI assistants to build an AI assistant. It's meta, but it works.

Automating the boring stuff is the best way to free up time to learn more cool stuff. Check out the code, star the repo, and stop chasing invoices manually.


๐Ÿ‘ค Francesco Capurso (@fracabu)
Self-taught dev | AI agents & Fastify plugins

๐Ÿ”— GitHub | npm

โญ Found this useful? Star the repo!

Top comments (0)