<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hariom</title>
    <description>The latest articles on DEV Community by Hariom (@hariom_2007).</description>
    <link>https://dev.to/hariom_2007</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4150582%2Ff9d741bf-2aa9-4321-935d-50627d8a2386.png</url>
      <title>DEV Community: Hariom</title>
      <link>https://dev.to/hariom_2007</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hariom_2007"/>
    <language>en</language>
    <item>
      <title>How I Built an AI Sales Agent That Learns Across Deals</title>
      <dc:creator>Hariom</dc:creator>
      <pubDate>Tue, 29 Sep 2026 17:24:52 +0000</pubDate>
      <link>https://dev.to/hariom_2007/how-i-built-an-ai-sales-agent-that-learns-across-deals-2703</link>
      <guid>https://dev.to/hariom_2007/how-i-built-an-ai-sales-agent-that-learns-across-deals-2703</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fts7qytotkzq8vp9dn5h7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fts7qytotkzq8vp9dn5h7.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/..." class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/..." alt="Uploading image" width="800" height="400"&gt;&lt;/a&gt;Most AI sales agents can remember what happened with a customer.&lt;/p&gt;

&lt;p&gt;I wanted to build something different: an agent that could learn from one deal and apply that knowledge to a completely different deal.&lt;/p&gt;

&lt;p&gt;That sounds simple until you try to define what the agent should actually remember.&lt;/p&gt;

&lt;p&gt;A useful sales memory isn't just a transcript. It's an objection, a competitor, a successful response, or a tactic that worked in a particular situation. More importantly, that knowledge should remain useful after the original deal is finished.&lt;/p&gt;

&lt;p&gt;That became the central idea behind my Deal Intelligence Agent.&lt;/p&gt;

&lt;p&gt;The problem with treating memory as chat history&lt;/p&gt;

&lt;p&gt;Consider a sales representative working on Deal A.&lt;/p&gt;

&lt;p&gt;During a call, the prospect raises an objection about pricing. The representative handles it successfully, and the deal eventually closes.&lt;/p&gt;

&lt;p&gt;Now imagine another representative starting Deal B several weeks later.&lt;/p&gt;

&lt;p&gt;The second representative has never spoken to the first prospect.&lt;/p&gt;

&lt;p&gt;Traditional conversational memory doesn't help much here because the relevant information belongs to another conversation.&lt;/p&gt;

&lt;p&gt;I wanted the agent to recognize that the successful tactic from Deal A might be useful for Deal B.&lt;/p&gt;

&lt;p&gt;So instead of thinking about memory as:&lt;/p&gt;

&lt;p&gt;User → Conversation → Memory&lt;/p&gt;

&lt;p&gt;I designed the system around:&lt;/p&gt;

&lt;p&gt;Company&lt;br&gt;
   ↓&lt;br&gt;
Collective Memory&lt;br&gt;
   ↓&lt;br&gt;
Calls + Objections + Competitors + Winning Tactics&lt;br&gt;
   ↓&lt;br&gt;
New Deal&lt;br&gt;
   ↓&lt;br&gt;
Relevant Knowledge&lt;br&gt;
   ↓&lt;br&gt;
Generated Brief&lt;/p&gt;

&lt;p&gt;This is where Hindsight became an important part of the architecture.&lt;/p&gt;

&lt;p&gt;What the agent actually remembers&lt;/p&gt;

&lt;p&gt;The application has two different kinds of information.&lt;/p&gt;

&lt;p&gt;The first is ordinary application data: deals, people, calls, and other structured information needed by the UI.&lt;/p&gt;

&lt;p&gt;The second is long-term agent memory.&lt;/p&gt;

&lt;p&gt;Every important call is written into Hindsight using retain().&lt;/p&gt;

&lt;p&gt;Winning deals also produce reusable tactics that are retained separately.&lt;/p&gt;

&lt;p&gt;That distinction matters.&lt;/p&gt;

&lt;p&gt;A raw call transcript tells the agent what happened.&lt;/p&gt;

&lt;p&gt;A retained tactic can tell the agent what was learned.&lt;/p&gt;

&lt;p&gt;The flow looks roughly like this:&lt;/p&gt;

&lt;p&gt;Sales call&lt;br&gt;
    ↓&lt;br&gt;
Speech-to-text&lt;br&gt;
    ↓&lt;br&gt;
Structured extraction&lt;br&gt;
    ↓&lt;br&gt;
Call + objections + competitors&lt;br&gt;
    ↓&lt;br&gt;
Hindsight retain()&lt;/p&gt;

&lt;p&gt;When a deal is won, the system extracts a more general lesson from that outcome.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;Specific:&lt;br&gt;
"Acme rejected the annual contract because of budget concerns."&lt;/p&gt;

&lt;p&gt;Reusable:&lt;br&gt;
"When a prospect has budget concerns, positioning the contract&lt;br&gt;
around measurable cost savings can help address the objection."&lt;/p&gt;

&lt;p&gt;The second piece is much more valuable as long-term memory.&lt;/p&gt;

&lt;p&gt;The interesting part happens on a new deal&lt;/p&gt;

&lt;p&gt;The most interesting behavior happens when a completely new deal arrives.&lt;/p&gt;

&lt;p&gt;Suppose Deal B has its first call.&lt;/p&gt;

&lt;p&gt;The agent doesn't have a history with this prospect.&lt;/p&gt;

&lt;p&gt;Normally, that means there is very little context available.&lt;/p&gt;

&lt;p&gt;Instead, the application asks Hindsight to reflect across the company's memory.&lt;/p&gt;

&lt;p&gt;New Deal B&lt;br&gt;
    ↓&lt;br&gt;
reflect()&lt;br&gt;
    ↓&lt;br&gt;
Search company memory&lt;br&gt;
    ↓&lt;br&gt;
Relevant past calls + tactics&lt;br&gt;
    ↓&lt;br&gt;
Generate preparation brief&lt;/p&gt;

&lt;p&gt;This is different from simply retrieving the previous conversation.&lt;/p&gt;

&lt;p&gt;The agent can discover that something learned from Deal A is relevant to Deal B.&lt;/p&gt;

&lt;p&gt;The generated brief also exposes where the information came from, so the recommendation isn't just a mysterious LLM output.&lt;/p&gt;

&lt;p&gt;That was an important design decision for me.&lt;/p&gt;

&lt;p&gt;Making memory explainable&lt;/p&gt;

&lt;p&gt;One problem with AI-generated sales advice is trust.&lt;/p&gt;

&lt;p&gt;If an agent says:&lt;/p&gt;

&lt;p&gt;"You should address pricing concerns by emphasizing ROI."&lt;/p&gt;

&lt;p&gt;the natural question is:&lt;/p&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;p&gt;The application uses Hindsight's returned source information to surface the origin of the knowledge behind the generated brief.&lt;/p&gt;

&lt;p&gt;Instead of hiding the retrieval process, the UI can show something like:&lt;/p&gt;

&lt;p&gt;Based on:&lt;br&gt;
FashionHub Retail — Call 4&lt;/p&gt;

&lt;p&gt;That makes the generated recommendation much easier to investigate.&lt;/p&gt;

&lt;p&gt;The agent isn't simply saying:&lt;/p&gt;

&lt;p&gt;"Trust me."&lt;/p&gt;

&lt;p&gt;It can show:&lt;/p&gt;

&lt;p&gt;"This came from something your company previously learned."&lt;br&gt;
The technical pipeline&lt;/p&gt;

&lt;p&gt;The application is built with Next.js and TypeScript.&lt;/p&gt;

&lt;p&gt;For extraction and generation, I use Groq models, while Groq Whisper handles speech-to-text.&lt;/p&gt;

&lt;p&gt;The main pipeline looks like this:&lt;/p&gt;

&lt;p&gt;Audio / Transcript&lt;br&gt;
       ↓&lt;br&gt;
Groq Whisper&lt;br&gt;
       ↓&lt;br&gt;
Call extraction&lt;br&gt;
       ↓&lt;br&gt;
Structured call data&lt;br&gt;
       ↓&lt;br&gt;
Hindsight retain()&lt;br&gt;
       ↓&lt;br&gt;
Company memory&lt;br&gt;
       ↓&lt;br&gt;
Hindsight reflect()&lt;br&gt;
       ↓&lt;br&gt;
Brief / Follow-up email&lt;/p&gt;

&lt;p&gt;The application separates structured CRUD data from agent memory.&lt;/p&gt;

&lt;p&gt;The local database contains things such as:&lt;/p&gt;

&lt;p&gt;Deals&lt;br&gt;
People&lt;br&gt;
Calls&lt;br&gt;
Workspaces&lt;/p&gt;

&lt;p&gt;Hindsight handles the longer-lived knowledge that the agent needs to reason across those records.&lt;/p&gt;

&lt;p&gt;This separation keeps the responsibilities relatively clear.&lt;/p&gt;

&lt;p&gt;Why I chose Hindsight for the memory layer&lt;/p&gt;

&lt;p&gt;I didn't want to build another vector-search layer and call it "memory."&lt;/p&gt;

&lt;p&gt;The interesting requirement was not simply:&lt;/p&gt;

&lt;p&gt;Find something similar to this text.&lt;/p&gt;

&lt;p&gt;It was:&lt;/p&gt;

&lt;p&gt;Find something from the company's past that could change what the agent recommends now.&lt;/p&gt;

&lt;p&gt;That's a much more useful definition of agent memory.&lt;/p&gt;

&lt;p&gt;Hindsight provides the retain() and reflect() primitives that fit this workflow well.&lt;/p&gt;

&lt;p&gt;I use retain() when information becomes part of the company's long-term memory.&lt;/p&gt;

&lt;p&gt;I use reflect() when the agent needs to reason over that accumulated memory.&lt;/p&gt;

&lt;p&gt;The Hindsight documentation goes deeper into how this memory model works.&lt;/p&gt;

&lt;p&gt;Before and after&lt;/p&gt;

&lt;p&gt;The behavioral difference is easiest to see with a simple example.&lt;/p&gt;

&lt;p&gt;Before memory&lt;/p&gt;

&lt;p&gt;A new representative opens a new deal.&lt;/p&gt;

&lt;p&gt;Agent:&lt;br&gt;
"I don't have enough information about this prospect yet."&lt;/p&gt;

&lt;p&gt;The representative has to manually search through previous calls, CRM notes, and old deals.&lt;/p&gt;

&lt;p&gt;After collective memory&lt;/p&gt;

&lt;p&gt;The same representative opens a new deal.&lt;/p&gt;

&lt;p&gt;Agent:&lt;br&gt;
"A similar objection was successfully handled in another deal.&lt;br&gt;
Here's the tactic that worked and the previous call it came from."&lt;/p&gt;

&lt;p&gt;The prospect is new.&lt;/p&gt;

&lt;p&gt;The deal is new.&lt;/p&gt;

&lt;p&gt;The knowledge isn't.&lt;/p&gt;

&lt;p&gt;That is the behavior I wanted to build around.&lt;/p&gt;

&lt;p&gt;What I learned&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Memory should store lessons, not just conversations&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Keeping every transcript isn't automatically useful.&lt;/p&gt;

&lt;p&gt;The valuable part is extracting information that can influence future decisions.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Cross-context memory is more interesting than personal memory&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Remembering the current user is useful.&lt;/p&gt;

&lt;p&gt;Learning from completely different deals is where the system starts behaving more like organizational memory.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Retrieval should have a visible source&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Generated recommendations become much easier to trust when users can inspect where they came from.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Structured data and agent memory have different jobs&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The application database answers questions about the application.&lt;/p&gt;

&lt;p&gt;The memory layer answers questions about what the company has learned.&lt;/p&gt;

&lt;p&gt;Keeping those responsibilities separate made the architecture easier to reason about.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The real test of agent memory is changed behavior&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A memory system shouldn't be judged only by whether it can retrieve an old fact.&lt;/p&gt;

&lt;p&gt;The more useful question is:&lt;/p&gt;

&lt;p&gt;Did something the agent remembered actually change what it did next?&lt;/p&gt;

&lt;p&gt;For this project, the answer is visible when knowledge from one closed deal influences preparation for an unrelated deal.&lt;/p&gt;

&lt;p&gt;That's the behavior I was ultimately trying to build.&lt;/p&gt;

&lt;p&gt;What's next&lt;/p&gt;

&lt;p&gt;The natural direction is making the memory increasingly useful without making it intrusive.&lt;/p&gt;

&lt;p&gt;The agent should learn from more interactions, identify reusable patterns more reliably, and provide increasingly relevant context while still showing why a recommendation was made.&lt;/p&gt;

&lt;p&gt;The core architecture stays simple:&lt;/p&gt;

&lt;p&gt;Experience&lt;br&gt;
    ↓&lt;br&gt;
Retain&lt;br&gt;
    ↓&lt;br&gt;
Collective memory&lt;br&gt;
    ↓&lt;br&gt;
Reflect&lt;br&gt;
    ↓&lt;br&gt;
Better decisions&lt;/p&gt;

&lt;p&gt;That's the part I find most interesting about building agents with persistent memory.&lt;/p&gt;

&lt;p&gt;The goal isn't to make an agent remember everything.&lt;/p&gt;

&lt;p&gt;The goal is to make sure it remembers the right things, and that those memories actually change what it does next.&lt;/p&gt;

&lt;p&gt;If you're interested in the memory layer, check out the Hindsight GitHub repository and Vectorize's overview of agent memory.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
