Inspiration
In almost every small and mid-sized business, someone's week quietly disappears into chasing money the company has already earned. We watched this happen up close: a finance officer opening the aging report every Monday, hand-writing a gentle nudge to one customer, a firmer note to another, and puzzling over a bank transfer that's Rs. 4,750 short of the invoice. Rule-based reminder tools exist, but businesses switch them off because a blanket "PAY NOW" email to a valued customer damages a relationship worth far more than the invoice. The judgment layer — who to chase, how firmly, through which channel, and when to escalate — has never been automatable. That gap is exactly the shape of a problem an agent can solve, and for Sri Lankan SMEs running on thin cash buffers and expensive credit, it's a problem felt every single week.
What it does
InvoiceChaser is an autonomous accounts-receivable collection agent for SMEs. It runs a continuous sense–reason–act–observe loop over the receivables ledger with one standing goal: minimise overdue receivables without damaging customer relationships.
- Per-debtor reasoning, not templates. The same 21-day lateness produces different actions for different debtors: a loyal 8-year customer who habitually pays late gets a warm nudge; a new customer with two broken promises gets a firm notice with a payment link and an instalment offer; dispute language triggers an investigator sub-agent instead of any reminder at all. Tone, channel (email vs SMS), timing, and content are all decisions.
- Ambiguity as a first-class input. A Rs. 95,500 credit against a Rs. 100,000 invoice isn't force-matched — the agent hypothesises (bank fee? partial payment? withholding tax?), verifies against available data, and asks the customer or the human when confidence stays low. It never guesses silently.
- Human-in-the-loop where it matters. First friendly reminders, reconciliation, and CRM housekeeping run autonomously. Escalations, payment plans, discounts, dispute responses, and legal handoffs all stop at a finance manager's approval queue, where every proposed action arrives with the agent's reasoning attached. The manager can approve, edit, redirect, or override — and every decision is fed back into the agent's memory, so it learns the owner's preferences.
- Self-healing execution. Every tool call is wrapped in a recovery ladder: retry with backoff → fall back to an equivalent tool (SMS if email bounces, cached ledger if the accounting API is down) → degrade gracefully → escalate with a structured report. Failures are logged as rigorously as successes.
How we built it
Phase 1 is idea validation, so our "build" was the design work: pressure-testing the problem, the agent's reasoning logic, and the architecture before writing code.
- We mapped the real manual workflow of SME receivables collection — the aging-report scan, the judgment calls per debtor, the reconciliation puzzles — and identified where automation fails today and where agency is genuinely required.
- We designed a modular architecture: an LLM reasoning core (planner, debtor profiler, reconciler, dispute investigator, error & ambiguity handler) surrounded by replaceable tool adapters, a Postgres state and memory store that records every decision with its reasoning, and two output lanes — autonomous and human-gated — feeding a Next.js finance dashboard with live aging, a cash-flow forecast, and a full audit trail.
- We mapped five external tools into the reasoning loop (the brief requires a minimum of three): an accounting API (QuickBooks/Xero) as the ledger source of truth, an email API (Gmail/Outlook) for outbound reminders and inbound reply classification, a payment gateway (Stripe/PayHere) for payment links and settlement webhooks, a CRM (HubSpot/Zoho) for relationship context that conditions tone, and Calendar + SMS (Google Calendar / Twilio / Ideamart) for promise-to-pay follow-ups and the fallback channel. Tool selection is dynamic per sub-goal — the planner chooses which tools each case needs, not a fixed chain.
Challenges we ran into
- Drawing the autonomy boundary. Gating every action would just rebuild the manual bottleneck; gating nothing would make oversight cosmetic. We settled on gating exactly where commercial or legal consequence concentrates — escalations, offers, disputes, legal handoffs — and made the boundary configurable per business.
- Designing for ambiguity instead of around it. Early drafts treated fuzzy payments and vague replies ("we'll sort this out soon") as edge cases. We realised ambiguity is the normal case in collections and redesigned the loop around a hypothesise → verify → ask principle.
- Avoiding the "chatbot with a scheduler" trap. Making sure the design shows genuine branching decision-making — different strategies per debtor, learning from outcomes, abandoning strategies that fail twice — rather than a rigid linear script dressed up as an agent.
- Failure tolerance as structure, not decoration. We iterated the architecture until any single tool could fail or be swapped without touching the agent's logic.
Accomplishments that we're proud of
- A problem statement grounded in a real, weekly, painful B2B workflow — with ROI denominated in the buyer's own currency (shorter DSO, lower overdraft interest, recovered finance-officer hours).
- An agentic loop where the reasoning is genuinely per-debtor and the agent never guesses silently — it hypothesises, verifies, and asks.
- A HITL design that is a real control point (approve / edit / redirect / override) rather than a rubber stamp, and one the agent actually learns from.
- A modular, failure-tolerant architecture with five external tools dynamically selected in the reasoning loop, and an audit trail that gives judges a window into the agent's mind during the Phase 2 live demo.
What we learned
- Collections isn't a pipeline; it's a conversation with branching outcomes. That reframing shaped every design decision.
- The highest-value placement for human oversight is not "everywhere" or "at the end" — it's precisely where relationship and legal risk concentrate.
- Recording the reasoning behind every action, not just the action, is what turns automation into something a finance manager can trust — and what makes the system auditable and demonstrable.
- Designing error recovery as a ladder (retry → fallback → degrade → escalate) keeps the audit trail hole-free and the agent dependable even when tools aren't.
What's next for InvoiceChaser
- Phase 2 build sprint: implementing the live working product — the reasoning core with its sub-agents, the five tool integrations, the Postgres decision log, and the Next.js finance dashboard with the approval queue.
- Simulated debtor environment for the live demo: seeded ledgers, scripted and unscripted debtor replies (promises, disputes, partial payments, silence), so judges can watch the agent reason in real time.
- Learning loop hardening: persisting per-debtor strategy outcomes so the agent keeps what works and flags what doesn't.
- Configurable oversight: letting each business set its own autonomy boundary (e.g. gate everything for its top ten accounts).
- Beyond NeuroX: validating with real Sri Lankan SMEs and exploring localisation (LKR-native reconciliation heuristics, local payment gateways like PayHere, and Sinhala/Tamil communication support).
Built With
- ai-agent
- automation
- b2b
- fintech
- google-calendar
- google-gmail-oauth
- llm
- nextjs
- node.js
- postgresql
- saas
- stripe
- twilio
- typescript
Log in or sign up for Devpost to join the conversation.