DEV Community

Megana Kotanaka
Megana Kotanaka

Posted on

The Collections Agent Stopped Guessing Once It Remembered

The Collections Agent Stopped Guessing Once It Remembered

A wide banner shot: split-screen of the PayEcho dashboard on one side and a WhatsApp reminder thread on the other. This is the image most readers will see first in their feed, so make it look like a real product, not a slide.
Priya runs collections for a mid-sized B2B services company. Her job, most days, is opening an overdue invoice, staring at a wall of past emails and call notes, and deciding: email again, call, escalate, or wait. The morning I put PayEcho in front of her, she pulled up a customer with a ₹50,000 invoice sitting 12 days overdue, and instead of a blank "send reminder" button, the screen told her something specific: this customer ignores emails, replies to WhatsApp, and pays within three days of a follow-up call. "Okay," she said, "who told it that?"
Nobody did. It remembered.
TL;DR: PayEcho is a payment-recovery and credit-decision agent. It uses Hindsight to remember what actually worked on a specific customer last time, and turns that into a specific, evidence-backed recommendation instead of a generic reminder. A human still clicks the button.

The problem with "send a reminder"
Every payment-recovery tool I'd used before treats every overdue invoice the same way: rules-based escalation, generic templates, a spreadsheet of days-past-due. The actual knowledge of what works on this specific customer lives in someone's head, or scattered across email threads and call logs nobody re-reads before the next attempt. A collections team relearns the same lesson about the same customer every single cycle, because nothing in the system carries that lesson forward.
I built PayEcho to fix that specific gap: a payment-recovery and credit-decision assistant that treats a customer's history of what was tried and what happened as the input to its next recommendation, not just a log you can scroll through. The mechanism that makes this possible is Hindsight, a memory layer for AI agents that stores, retrieves, and reasons over past experience instead of starting cold every time.

What Priya actually sees
PayEcho's interface is built around the way a collections or credit employee already thinks: a revenue dashboard up top (outstanding, overdue, recovered), a customer list underneath sorted by risk, and a customer detail page that opens into three panels side by side — the invoice and payment timeline, a Hindsight Memory panel, and an AI Agent panel.

— The revenue dashboard: outstanding / overdue / recovered totals up top, customer list below sorted by risk. Crop tightly, no browser chrome.
The memory panel is deliberately not a raw activity log. It shows distilled statements: "Responds to WhatsApp, not email." "Last three invoices paid after a 3-day follow-up call." "Requested extended credit twice in the last quarter." These are the things a good collections rep would eventually notice by hand — except now the agent surfaces them the moment the customer's page loads, before Priya has read a single note.

— Close-up of the Hindsight Memory panel on a customer's detail page, showing 3–4 of those distilled memory statements. This is arguably the single most important image in the article — it's the visual proof that memory is real, not a marketing claim.
The agent panel sits right next to it and answers three questions every time: what it remembers about this customer, what it recommends doing next, and why. Then there are action buttons — Send WhatsApp, Send Email, Schedule Follow-up — so the recommendation turns into an action in one click instead of a copy-paste into another tool.

— The AI Agent panel next to the memory panel: "What it remembers → Recommendation → Reason" stacked vertically, with the action buttons visible underneath.

Wiring memory into the recovery loop
The core loop in PayEcho is small on purpose: problem → decision → action → customer response → outcome → memory → better next decision. Here's roughly how that loop is wired using Hindsight's retain and recall calls.

— A simple horizontal box diagram of the loop above: Problem → Decision → Action → Customer Response → Outcome → Hindsight (retain) → Future Situation → Hindsight (recall) → Better Recommendation. Keep it to boxes and arrows; this is the diagram that shows readers where Hindsight actually sits in the stack.
Every time an action produces an outcome — a reminder gets ignored, a WhatsApp message gets a reply, a payment lands — PayEcho retains a compact, meaningful summary, not a raw transcript:
await hindsight.retain(
bank_id=customer.bank_id,
content=(
f"{customer.name}: {action.channel} reminder sent for invoice "
f"{invoice.id} (₹{invoice.amount}). Customer response: "
f"{response.summary}. Outcome: {outcome.status} after "
f"{outcome.days_to_resolve} days."
),
metadata={
"customer_id": customer.id,
"channel": action.channel,
"outcome": outcome.status,
"invoice_amount": invoice.amount,
},
)
Before the agent renders a recommendation, it recalls what's relevant to this customer and this situation, not the whole company's history:
memories = await hindsight.recall(
bank_id=customer.bank_id,
query=f"{customer.name} payment recovery attempts and outcomes",
limit=6,
)

recommendation = await llm.generate(
system_prompt=build_recovery_prompt(memories, customer, invoice),
)

— A terminal or logging view showing a real retain() call firing and a real recall() response coming back for a test customer. Real request/response text, not lorem ipsum — this is the "show me the retain/recall happening" proof.
That's genuinely most of the mechanism. The intelligence isn't a clever prompt trick — it's that the prompt has the right, customer-specific evidence in it before the model ever has to guess.
The credit-decision path uses the same recall call with a different query — "past credit requests and repayment delays for this customer" — and the output is framed strictly as a recommendation with the supporting history attached, never an automatic approval or denial. A repayment-delay pattern is exactly the kind of thing that should slow a human down, not something an agent should quietly act on.

Before memory, after memory
The clearest way I found to demonstrate this to Priya was to run the exact same overdue invoice through PayEcho twice: once with an empty memory
— Two agent-panel screenshots stacked or side by side: the generic "no memory" recommendation on the left, the specific "with memory" recommendation on the right, same customer and invoice. This is the single best image for the article — it's the whole pitch in one frame. Consider using this as the LinkedIn post image later, too.
Without memory, the recommendation reads like every tool she's already used:
"Invoice is 12 days overdue. Recommend sending a payment reminder email."
With memory recalled from three prior cycles, the same customer, same invoice size, produces:
"This customer has ignored email reminders in the last two cycles but responded to WhatsApp within a day both times, and paid in full after a follow-up call 3 days later. Recommend WhatsApp reminder now, with a follow-up call scheduled for day 3. Based on 2 prior recoveries using this sequence."
Same invoice, same customer, completely different — and specific — advice. That gap is the entire pitch of the project. It's also, not coincidentally, why the memory panel needed to be visible in the interface rather than hidden behind the recommendation: showing the evidence next to the advice is what makes an employee trust it enough to act on it instead of double-checking the customer's file anyway.

What I'd tell anyone building on this
A few things I learned putting this together that would have saved me time if I'd known them going in:
Summarize before you retain. My first pass stored raw message threads and CRM export rows. Recall got noisy fast, and the model started padding recommendations with irrelevant detail. Retaining one clean sentence per outcome — channel, response, result, timing — gave recall results that were actually usable in a prompt.
Query by intent, not by keyword. "ABC Corp invoices" as a recall query returns everything. "ABC Corp payment recovery attempts and what worked" returns the handful of memories that actually matter to the decision at hand. The query is doing more work than the retrieval algorithm.
Keep the human decision human. It was tempting to let the agent auto-send the "best" channel or auto-approve credit once the pattern looked confident. I deliberately kept every financial action behind a person clicking a button. Memory should make the recommendation sharper, not remove the person who's accountable for the outcome.
Test after several cycles, not one. A single interaction with an empty memory bank looks exactly like every other tool. The value only shows up once there's a second or third overdue cycle for the same customer to recall against — that's when the recommendation stops being generic.
Show the "why," not just the "what." Early versions of the agent panel just showed the recommended action. Adding the one line of reasoning — "based on 2 prior recoveries using this sequence" — was what actually got Priya to trust the button enough to click it in front of me.

Where this goes
The interesting part of PayEcho isn't the dashboard or the WhatsApp integration — those are plumbing. It's that a collections employee opens a customer's page and the system already knows, in plain language, what has and hasn't worked with that specific person, and turns that into one clear next step instead of a generic template. That's the difference between a tool that logs history and one that actually uses it.
If you're building anything where the same customer, patient, or account comes back more than once — support, credit, retention, recovery — the pattern is the same one PayEcho leans on: retain the outcome, recall it before the next decision, and let the evidence sit next to the recommendation instead of behind it. The Hindsight documentation covers the retain/recall/reflect primitives in more depth, and Vectorize has a good write-up on what agent memory actually means in practice, beyond just "storing chat history."

— A candid shot of you/your team at a screen mid-build, or Priya's screen showing the agent panel. Adds personality; skip it if you don't have one.
Priya's takeaway, after that first demo, was less technical than mine: "It's the first tool that didn't make me explain the customer to it again."

Resources
● Hindsight on GitHub
● Hindsight Documentation
● Agent Memory — Vectorize

Top comments (0)