Most AI finance tools predict cash flow using invoice due dates. But due dates are promises, not payments.
I wanted to build something smarter.
Imagine your dashboard says you'll have ₹9.91 lakh remaining after paying your biggest supplier. Everything looks safe. But what if your customers don't actually pay on time?
That's the problem I wanted to solve with Cashwise — an AI-powered cash-flow agent that learns how customers really pay, remembers past business events, and helps business owners make better financial decisions.
In one scenario, a traditional due-date forecast showed ₹9.91 lakh remaining. Cashwise predicted a ₹1.94 lakh cash shortage.
Same business. Same invoices. Different understanding of reality.
The Problem: Expected Cash Isn't Actual Cash
Small businesses often sell products and services on credit. While waiting for customer payments, they still need to manage supplier bills, salaries, rent, and other expenses.
Most traditional cash-flow tools calculate future balances based on invoice due dates.
*But here's the problem:
*
- One customer consistently pays on time.
- Another customer is usually 15 days late.
- Someone else pays in multiple instalments.
- A previously reliable customer suddenly starts delaying payments.
A system that treats every customer equally can give business owners a false sense of financial security.
Cashwise follows a different approach: predict cash flow using actual payment behaviour, not just expected payment dates.
Introducing Cashwise
Cashwise is an AI-powered financial assistant designed to help small businesses understand their future cash position.
Instead of simply displaying financial records, it combines deterministic financial calculations, customer payment behaviour, and long-term business memory.
The goal is simple: help business owners understand not only how much money they might have, but also why they might face a shortage and what they can do about it.
The Cashwise landing page introduces the platform and its core capabilities.
How We Built Cashwise
We designed Cashwise using four major components:
- Financial Database: Stores invoices, customer payments, expenses, supplier bills, and business records.
- Python Financial Engine: Handles cash-flow forecasting, financial calculations, alerts, and what-if scenarios.
- Hindsight Memory: Stores and retrieves important business history, customer behaviour, and previous decisions.
- Groq AI Agent: Understands user questions, selects the appropriate tools, and communicates financial insights.
The frontend is built with React, while FastAPI powers the backend.
The AI agent uses Groq for tool calling and Hindsight for persistent business memory.
One important architectural decision we made was to keep financial calculations outside the language model.
Python calculates the numbers. The AI agent retrieves the required information and explains the results.
This makes the financial logic more transparent, predictable, and testable.
Making Cash-Flow Forecasting More Realistic
One of the core features of Cashwise is customer-specific payment prediction.
Instead of assuming every customer pays on their invoice due date, we analyse their recent payment history.
For each customer, the system considers up to their eight most recent paid invoices.
We generate three forecasting scenarios:
HISTORY_WINDOW = 8
SCENARIOS = {
"best": 0.2,
"likely": 0.5,
"worst": 0.9,
}
These represent:
- Best Case: 20th percentile of historical payment delays.
- Likely Case: Median historical payment delay.
- Worst Case: 90th percentile of historical payment delays.
The financial engine also handles overdue invoices, partial payments, supplier bills, recurring expenses, and what-if scenarios.
For example, a business owner can ask:
"What happens if Mehta Traders pays 15 days late?"
Cashwise recalculates the projected cash position based on that change.
Importantly, this is a statistical projection based on historical payment behaviour, not a guarantee or a trained machine-learning model. Customers with limited payment history naturally have less reliable estimates.
Giving AI a Memory with Hindsight
A financial database can tell us what happened.
But it doesn't always explain why it happened.
For example:
- A customer started paying faster after collection calls.
- Another customer repeatedly disputed invoices.
- A supplier changed payment terms.
- A business owner decided to delay a particular expense.
These events can influence future financial decisions.
That's where Hindsight, an open-source agent memory system, becomes important.
Cashwise uses Hindsight to store and retrieve business-specific experiences, including customer behaviour, supplier terms, collection outcomes, and owner decisions.
Here's an example of how business events are stored:
client.retain(
bank_id="malabar-electronics",
content=f"{e['description']} Outcome: {e['outcome']}",
context=f"{e['entity_type']}:{e['entity_id']} {e['event_type']}",
timestamp=f"{e['date']}T10:00:00Z",
)
When a business owner asks a question, Cashwise retrieves relevant memories before generating its response.
Each business has its own memory bank, keeping its historical context separate from other businesses.
This means the agent doesn't depend only on the current conversation. It can also use relevant experiences from the business's past.

Hindsight helps Cashwise recall previous business events and customer behaviour.
Tools, Not Guesswork
Memory provides context, but the agent also needs accurate financial data.
We integrated Groq tool calling with a set of dedicated backend functions:
- "cash_forecast" – Returns best, likely, and worst cash-flow scenarios.
- "what_if" – Compares forecasts after a proposed financial change.
- "customer_profile" – Retrieves customer payment behaviour.
- "upcoming_bills" – Checks supplier bills and payment terms.
- "recall_memory" – Retrieves relevant business history from Hindsight.
For example, when an owner asks:
"Can I pay Vertex on Friday?"
Cashwise can:
- Check upcoming supplier bills.
- Recall relevant information about Vertex.
- Generate the current cash-flow forecast.
- Run a what-if scenario.
- Explain whether the proposed payment could create a cash shortage.
Python handles the financial calculations, while Groq coordinates the tools and communicates the results.
The Dashboard: Financial Insights at a Glance
We wanted Cashwise to make complex financial information easy to understand.
The dashboard brings important business information together, helping owners monitor their financial position without going through multiple spreadsheets.
It provides an overview of financial performance, cash-flow projections, upcoming payments, and important business insights.

The dashboard gives business owners a clear view of their financial position.
We also focused on making the platform practical rather than overwhelming. The aim is to turn financial data into information that business owners can actually use.
Before and After: A Realistic Business Scenario
To demonstrate Cashwise, we created a sample business called Malabar Electronics Distributors.
Its customers have different payment patterns:
- Mehta Traders: Frequently pays late, with collection-call effectiveness changing over time.
- Sreeram Retail Chain: Has gradually started delaying payments.
- Fortune Appliances: Usually pays in two instalments.
- Kerala Digital Store: Has a reliable payment history.
Now consider a major supplier payment.
The business needs to pay ₹15 lakh to Vertex on 13 November.
A traditional due-date-based forecast assumes that expected customer payments will arrive on schedule.
It reports:
₹9.91 lakh remaining.
But Cashwise considers the customers' actual payment behaviour and historical delays.
Its likely forecast reports:
₹1.94 lakh cash shortfall.
That's a significant difference.
Now the owner asks:
"What if Mehta pays 15 days late?"
Cashwise runs the what-if scenario and recalls that Mehta has consistently paid 13–15 days late.
Instead of simply displaying a warning, it can recommend practical actions such as contacting Mehta immediately and following up in writing.
The important difference is that the recommendation is supported by financial calculations and relevant business history.
What We Learned While Building Cashwise
Building Cashwise also helped us understand some limitations of AI-powered financial systems.
- New customers have limited history
A new customer has no established payment pattern. Predictions become more useful as payment records accumulate.
- Unexpected expenses can change everything
An unplanned expense can affect the entire cash-flow projection. Forecasts must be updated as new financial information becomes available.
- Memory quality matters
If incorrect events are stored or irrelevant memories are retrieved, recommendations can become less reliable.
- Background scheduling is challenging
Our scheduled reports run inside the web server environment. Since servers can sleep, we implemented a five-minute scheduler check that generates a missed report once the server wakes up instead of replaying every missed execution.
These challenges reminded us that building an AI agent is not just about connecting an LLM to an API. Reliability, data quality, and system design matter just as much.

What We Would Carry Into Our Next AI Project
There are a few important lessons we learned:
- Keep calculations outside the LLM. Financial numbers should come from deterministic code, not generated responses.
- Databases and memory serve different purposes. Databases store structured records, while memory stores meaningful context and experiences.
- Retrieve relevant memories. More context isn't always better. The agent should recall information related to the user's question.
- Make uncertainty visible. Historical payment behaviour can improve forecasts, but it cannot guarantee future payments.
- Remember outcomes, not just decisions. Understanding what the business owner did and what happened afterward makes future recommendations more useful.
Final Thoughts
Cashwise started with a simple observation: knowing when an invoice is due is not the same as knowing when the money will arrive.
By combining deterministic Python calculations, Groq-powered tool calling, and Hindsight memory, we built an agent that goes beyond traditional due-date forecasting.
It doesn't claim to predict the future perfectly.
Instead, it helps business owners make better decisions using their financial data and business history.
Because better financial decisions start with understanding what actually happens, not just what is expected to happen.
Explore Cashwise
- GitHub: "View the Cashwise source code" (YOUR_GITHUB_REPOSITORY_URL)
- Live Demo: https://cashwise-5c6z.onrender.com
Built with React, FastAPI, Python, Groq, and Hindsight.


Top comments (0)