
Every small business has the same quiet leak. You do the work, send the invoice, and wait. But late payment is not a rare edge case. According to the 2026 QuickBooks Small Business Late Payments Report, 59% of small businesses surveyed have invoices more than 30 days overdue, and businesses waiting on unpaid invoices are owed $17.7K on average.
The problem reaches far beyond a single survey or market. Research cited by the UK Government estimates that late payments cost the UK economy almost £11 billion a year, affect more than 1.5 million businesses, and consume an average of 86 hours of staff time per affected business each year among businesses that spend time chasing overdue payments.
The Federal Reserve’s 2024 Report on Payments tells the same story from another angle: roughly four in five small firms face challenges related to customer payments. Firms that collect payment after delivering their work are also more likely to struggle with slow-paying customers.
Some customers pay on time. Many do not. Chasing the ones who fall behind is rarely anyone’s favorite job, so it gets pushed aside. A week becomes a month. And for a small studio, clinic, agency, or service business, that missing cash is not just a number on a dashboard. It can be payroll, rent, operating cash, or the confidence to take on the next job.
I built Arrearly to close that gap. It is an autonomous AI receivables agent designed to help recover overdue invoices from start to finish. Not a better reminder template. Not a faster way to schedule follow-ups. Arrearly reviews each overdue account, decides the most appropriate action to take that day, drafts the message, adapts when the customer responds, knows when to hold back, and escalates genuinely difficult cases to a person.
The idea is simple: automate the judgment, not just the sending.
This is the story of how Arrearly works, why I built it this way, and the engineering decision that turns it from a prompt into an agent capable of making real operational decisions while staying inside deterministic guardrails.
The Problem#
Collections is a responsibility almost every small business has, yet very few have someone dedicated to managing it. The problem is not simply that invoices become overdue. It is that every overdue account creates another judgment call: whether to follow up today, how firmly to push, what the customer has already said, whether a promise to pay is still valid, and whether continuing to press could damage a relationship worth keeping.
That is why the payment data matters. The Federal Reserve found that customer payments are the primary source of cash available to small businesses, while payment-related challenges affect roughly four out of five small firms. For businesses that get paid after the work is delivered, slow-paying customers are especially likely to become a problem.
The work itself is repetitive, time-sensitive, and slightly uncomfortable, which makes it easy to postpone. There is rarely a person whose actual job is to notice that invoice 1042 is now nineteen days overdue, remember that this particular customer usually pays a week after a gentle reminder, understand what has already been said, and decide what should happen next.
As a result, one of two things usually happens. Either the owner handles collections late at night, under pressure, and risks sounding too harsh or too soft for the relationship, or a rigid system takes over and sends the same sequence of reminders to everyone.
A loyal customer with a temporary cash-flow problem gets treated like a chronic late payer. A customer who has already promised to pay gets chased again. A disputed invoice receives another automated reminder when it should have gone to a person. The automation technically works, but the judgment is missing.
The first approach does not scale. The second scales the wrong thing.
The hard part was never writing the reminder. The hard part was the judgment behind it: whether to contact the customer today, how firmly to follow up, which channel to use, when to wait, when to negotiate, and when pushing harder could cost more goodwill than it recovers.
That is the part I wanted Arrearly to own.
The hardest part of collections was never writing the message. It was deciding whether to send one today, how firm it should be, and when pushing harder could cost more than it recovers.
The Solution#
Arrearly treats collections as a sequence of decisions and automates the decision-making, not just the sending. Once a day, for every overdue invoice, the agent runs the same kind of loop a thoughtful collections manager would follow, only with greater consistency and without getting distracted, overloaded, or too busy to act.

It reads the full account history: how far overdue the invoice is, how reliably the customer has paid in the past, what the latest message in the thread said, and what the payment prediction model expects. It then decides which rung of the escalation ladder is appropriate, writes the message in a tone and channel that fit the relationship, and checks that decision against a set of hard guardrails before anything is sent. If every condition is satisfied, the message goes out. If a promise to pay is still active, the agent deliberately holds back and records that restraint as a decision in its own right.
What Makes It Different#
The simplest way to put it is this: most tools in this space automate sending. Arrearly automates decision-making. And that distinction shapes everything that follows.


How It Works, Under the Hood#
The engineering decision I’ve been most deliberate about is the separation of powers between the model and the rules. It’s what allows the agent to operate autonomously without becoming reckless.
The Model Proposes. The Policy Engine Decides.#
For each invoice, the agent sends Gemini a structured prompt containing the account context, payment history, escalation policy, and payment prediction. Gemini returns a structured recommendation covering the action, tone, channel, message draft, confidence score, and next review date. That recommendation is never accepted at face value: a deterministic policy engine, implemented in conventional code, checks it against the escalation ladder and operating constraints, then overrides or scales back anything that violates a rule. The model reasons. The rules set the boundaries.
The Architecture#
Arrearly is a single product built around a clear separation of responsibilities. One web application handles the interface, API, real-time risk scoring, and agent loop. Around it sit two optional services and one external model provider, with dependencies flowing in one deliberate direction: the agent never touches the data store directly, the store does not need to know that a model exists, and the policy engine depends on neither. The agent proposes, the policy engine decides, and the store records only what makes it through both.

In production, the web app runs on Vercel and connects to Gemini through the Gemini Developer API. In local development, it connects through Vertex AI on Google Cloud. The payment-prediction service and batch risk engine run separately on Google Cloud Run: the Python predictor is live and serving predictions, while the Rust engine runs as a scheduled job that reads production data and re-scores the entire portfolio. If either optional service is disabled, the app keeps running. It simply falls back to its built-in risk scoring, while the agent continues operating without the additional model input.
The Three Languages#
The web app is written in TypeScript, while the components that sit outside the web layer use the language best suited to the job. This is not architectural decoration. Each language earns its place by handling work the application layer should not.
- TypeScript, the product. It powers the entire web application: the interface, API routes, agent loop, and real-time per-invoice risk scoring. It provides end-to-end type safety across the same runtime Vercel deploys with virtually no additional configuration.
- Rust, the engine. It powers the batch risk engine. The nightly re-scoring job is CPU-bound and runs across the entire portfolio, making a compiled language with predictable performance and precise arithmetic a natural fit. It uses the same scoring formula as the live scorer, with both implementations kept in lockstep.
- Python, the model. It powers the payment-prediction layer, where the data-science tooling and scikit-learn ecosystem belong. The model estimates both the probability that an invoice will be paid and roughly when that payment is likely to arrive. It can also retrain on its own schedule without touching the core application.
The point of the split is simple: each part has a specific job. The model is one component. The system is the product.
The Model Proposes, the Policy Engine Disposes#
Back to the decision itself, because it sits at the heart of the design. Before anything happens, every model proposal passes through a deterministic policy engine, and that engine has the final say. Grace periods, contact cooldowns, confidence thresholds, and handoff limits are all enforced in code, so model drift, overconfidence, or prompt injection cannot cause the system to send a message that violates those boundaries.
The Escalation Ladder#
The escalation ladder is a true progression, and the product treats it that way. A customer who is four days overdue should never receive the same message as one who is ninety days overdue, no matter how confident the model is. Two rules govern every transition: the account can move only one rung at a time, and a promise to pay takes precedence over escalation until the promised date has passed.
- Rung 0, Watch. The agent monitors the invoice but stays quiet while it remains within the grace period.
- Rung 1, Nudge. A warm, friendly reminder that assumes the invoice was simply overlooked.
- Rung 2, Press. A firmer message that states the outstanding amount and asks for a clear payment date.
- Rung 3, Negotiate. An offer to split the outstanding balance into a payment plan when the customer appears to be under financial strain.
- Rung 4, Final Notice. A formal final notice before the account is handed off for human review.

A Live Prediction Model, Not a Static Number#
Every invoice also carries a live payment prediction: the probability that it will be recovered and the expected number of days until payment. This is a real model evaluated on every view, not a decorative score. It also surfaces the factors pushing the prediction up or down, so the result can always be explained: a strong payment history raises the likelihood of recovery, while a larger balance and longer delay pull it in the opposite direction. The agent treats this prediction as one signal among many, never as an instruction.

Built to Keep Working#
Autonomy means little if the system falls apart the moment something fails. If Gemini becomes unavailable or returns an unparseable response, an offline policy engine takes over and keeps the portfolio moving, with those runs clearly flagged. The batch risk-scoring engine and payment-prediction model operate as separate services while following the same core logic as the live path, so Arrearly is built as a set of resilient, cooperating components, not a single prompt wrapped in a polished interface.
Getting Paid, and Payment Tracking#
Recovery only matters when the money actually arrives, so Arrearly treats settlement as a first-class part of the product. Every payment is processed through PayPal, and each invoice shows the receipts tied to that account, including the amount, payment date in both the customer’s and operator’s time zones, transaction ID, and, for installment-based invoices, the specific installment each payment covers. If an invoice is paid in three parts, Arrearly shows three separate receipts. A payment schedule sits alongside them, with every installment’s due time displayed in both the customer’s local time zone and the operator’s, making it immediately clear when a payment is actually due for the person on the other end.

Adding Your Own Accounts#
A collections agent has to earn trust on a real portfolio before it earns the right to serve a second customer, so Arrearly starts with one real business and makes it easy to connect real receivables. An Add Data screen lets a business enter its own customers and invoices, which the agent then scores and works just like any other account. The product is also transparent about where it is today: the data store currently lives in memory, so entries persist only for the active session. Durable, per-business storage is the next step on the roadmap.
Who It’s For#
Arrearly is built for small and mid-sized businesses that invoice clients and then wait to get paid: design studios, agencies, clinics, trades, consultancies, and other businesses with receivables but no dedicated collections team. Its first pilot user is Heytugas.com, a services business that invoices clients for design and data work. The second is Kardi Putera Motor, a car-service and bus-rental business that had been tracking receivables manually. Both are existing relationships, and they are presented honestly as pilot users rather than independent market traction. The pricing follows the same principle: Arrearly charges a success-based fee on recovered payments, so businesses pay only when the money actually comes in.


The Bet#
At the heart of the product is a simple bet: the parts of collections that once seemed to require a person, deciding whether to follow up, how firmly to push, which channel to use, and when to stop, are exactly the parts an agent can now handle, as long as its judgment is bounded by clear rules and every decision remains auditable. Get that right, and a small business should never have to write off money simply because chasing it was nobody’s job.
Judgment from the model, rules that keep it honest, and an audit trail that proves it. That’s the whole idea.
Want to Try Arrearly?#
Arrearly is still actively evolving, and I’m continuing to build, test, and refine it. You can explore the current version of Arrearly, watch the app demo below to see how it makes decisions, adapts to new customer context, applies guardrails, and records each action in an auditable trail, or visit the project page on Devpost for a closer look at what I built. If you’re interested in trying Arrearly with your own receivables, have feedback, or simply want to talk about what I’m building, feel free to reach out to me on X at @wiqi_lee. I’d be glad to hear from you.
I publish every article on Medium too. Follow me there to get new posts in your feed, or leave a clap if this one helped.
