DEV Community

K S ANIRUDH
K S ANIRUDH

Posted on

From ignored reminders to a Tuesday 3 pm call via Hindsight

Traditional AI assistants often forget interactions once a task is complete. PayRecall explores how persistent memory can improve decision-making in B2B accounts receivable by allowing an AI agent to learn from customer interactions.

PayRecall is a prototype collections assistant that recommends the action for a single overdue invoice, including who to contact, which channel to use what tone to adopt, when to reach out and how to approach the customer. The system does not send messages. Modify accounting systems. Its main innovation is the memory system behind the recommendation.

PayRecall uses Hindsight to store and retrieve customer- experiences. This allows the agent to recall interactions identify patterns generate customer-specific playbooks and adapt future recommendations using accumulated knowledge.

Why Collections Is a Memory Problem

Important collections knowledge is often scattered across emails call notes and employee experience. One customer may respond after a phone call while another may ignore repeated emails. When employees leave this knowledge can be lost.

A normal LLM prompt cannot solve this problem. If the model receives an invoice and contact information it can generate a reasonable reminder but cannot know that previous attempts failed or that a particular contact has left the organization.

PayRecall therefore compares two paths: memory off and memory on.

How the System Works

The system contains four components: a Streamlit interface, a decision agent that calls Groq for inference a memory module that manages Hindsight and a JSON dataset containing five customers, six overdue invoices and 35 narrative interaction records.

With memory disabled the agent receives the invoice and a basic customer profile. Historical notes and learned payment behavior are deliberately excluded to create a baseline.

With memory enabled the agent retrieves three types of information from Hindsight: customer memories, a generated customer playbook and a reflection containing evidence-based reasoning. These are provided to the language model together with the invoice.

The interaction records are written as narratives because real collections records are often paragraphs than structured tables. Hindsight extracts facts from these narratives. Customer isolation is maintained using tags for customer, channel, actor, invoice and outcome.

The system also separates agent actions from customer responses. This helps the agent learn relationships between actions and outcomes such as when a particular communication strategy produced a dispute or a payment promise.

Demonstration: Meridian Retail

The demonstration customer is Meridian Retail, with invoice INV-2041, ₹4 lakh in value and 38 days overdue.

With memory disabled the agent recommends sending an email to the accounts-payable contact and requesting payment within a few days. Confidence remains limited because the system has no evidence.

With memory enabled the recommendation changes. The system recommends calling Kavita Menon using a relationship-focused approach on a Tuesday or Thursday after 3 pm.

This recommendation is supported by stored history. Previous emails to the shared accounts inbox were repeatedly ignored. Calls to the AP head, Ramesh Iyer had produced payment promises that were honored. Ramesh later left the company. The new AP head, Kavita Menon indicated that she preferred email for records did not use WhatsApp for vendor matters and accepted calls on Tuesdays and Thursdays after 3 pm.

Hindsights observations layer can identify these changes. Resolve conflicting historical information allowing the generated playbook to remove obsolete contact information.

Learning From New Outcomes

PayRecall also supports learning. After a memory-enabled recommendation the user can record the customers response, resolution and date.

The system stores the agents action and customer response separately refreshes the memory and playbook and generates an updated recommendation. Testing showed that recording a payment promise could change the recommendations timing, approach and confidence.

An important lesson was that anything stored in memory becomes evidence for recommendations. Incorrect test data can therefore influence outputs and must be cleaned up.

Challenges and References

Two implementation issues occurred. The involved Hindsight reflection failing because tag scopes did not match the source memories. Removing a tag resolved the issue. The second involved an event-loop error during repeated Hindsight calls, from Streamlit. The solution was to use a background event loop owned by the memory module.

PayRecall demonstrates that persistent memory can transform an AI agent from generating generic responses into one that learns from organizational experience. Although the prototype focuses on accounts the same approach can extend to customer support, account management and other enterprise workflows where historical context influences future decisions.

Hindsight GitHub:
documentation:
Vectorize agent memory:

The project ultimately shows that an intelligent agent becomes more useful when it can remember, learn and adapt from experience.





Top comments (0)