How I Built a Sales Agent That Never Forgets a Prospect's Objections
Every sales rep knows the feeling. You jump on a follow-up call, the prospect mentions something they brought up three weeks ago, and you have no idea what they're talking about. You scramble through your notes, apologize, and lose credibility in the process.
I built an agent to fix that.
The Problem
Sales agents forget. Not because reps are bad at their jobs — but because the tools don't remember. CRMs require manual entry. Call notes get buried. Context gets lost between sessions.
The result? Generic follow-up emails that ignore everything the prospect already told you. "Just checking in!" emails that make prospects feel like a number, not a person.
What I Built
A sales memory agent that:
- Listens to objections from every call
- Stores them in persistent memory using Hindsight
- Recalls them before every follow-up
- Drafts personalized emails that directly address each objection
The Stack
- Hindsight — agent memory that persists across sessions
- Groq — fast, free AI model inference
- Python 3
How It Works
The core idea is simple. After every sales call, objections get stored in Hindsight memory:
def save_objection(prospect_name, objection):
hindsight.retain(
bank_id=BANK_ID,
content=f"Prospect: {prospect_name} | Objection: {objection}",
metadata={"prospect": prospect_name, "type": "objection"}
)
Before writing a follow-up, the agent recalls everything it knows about that prospect:
def recall_objections(prospect_name):
results = hindsight.recall(
bank_id=BANK_ID,
query=f"What objections did {prospect_name} raise?"
)
return results
Then Groq drafts a personalized email:
def draft_followup(prospect_name, objections_text):
response = groq_client.chat.completions.create(
model="llama-3.3-70b-versatile",
messages=[
{
"role": "system",
"content": "You are an expert sales assistant. Write personalized follow-up emails that directly address past objections."
},
{
"role": "user",
"content": f"Write a follow-up email for {prospect_name} who had these objections:\n{objections_text}"
}
]
)
return response.choices[0].message.content
The Before and After
Without memory:
"Hi John, just checking in to see if you had any questions!"
With Hindsight memory:
"Hi John, I wanted to directly address the budget concerns you raised last quarter. We've actually introduced flexible payment terms that spread the cost over 12 months..."
That's the difference memory makes.
What Surprised Me
The most surprising thing was how simple the Hindsight integration was. Three lines to retain a memory, two lines to recall it. The hard part wasn't the memory — it was realizing how much context gets lost in normal sales workflows without it.
Every objection a prospect raises is a signal. They're telling you exactly what they need to hear. An agent that remembers those signals and uses them is genuinely more useful than one that starts from zero every time.
Lessons Learned
- Memory changes everything. The same AI model produces dramatically better output when it has context.
- Keep it focused. One workflow done well beats five workflows done poorly.
- Real data matters. Testing with realistic prospect names and objections reveals problems that toy data hides.
- Persistent memory is a superpower. Restarting the agent and having it still remember past calls felt genuinely magical the first time.
Try It Yourself
The full code is on GitHub: https://github.com/ronak0206/sales-memory-agent
Top comments (0)