Every support chatbot I've ever used has the same problem: it forgets you the moment the conversation ends.
You report a bug on Monday. You come back Wednesday. It asks your name again. Your order number again. Your problem again. You're not a new customer — you're an angry returning one — and the bot treats you like a stranger every single time.
I got tired of this and built something different: a support agent that actually remembers who you are.
What I Built
A Python-based AI customer support agent that retains memory across sessions using Hindsight — an agent memory system built by Vectorize. The agent runs on Groq for fast, free LLM inference.
The core idea is simple: when a user reports an issue, the agent saves it to Hindsight's memory bank. Next time that user comes back — even days later, even in a completely new session — the agent recalls their history and responds accordingly.
No more "please describe your issue again."
The Before and After
This is the moment that made it click for me.
Session 1:
You: My order #1234 hasn't arrived yet and I'm really frustrated
Agent: I'm sorry to hear that! Could you share your order date and tracking number?
[Memory saved]
Session 2 (new terminal session, fresh start):
You: Hi, I'm back
Agent: Hi Yaswanth, welcome back! I completely understand your frustration
regarding the delay of order #1234 — it's been on my mind. I've escalated
the issue with our logistics team...
The user said two words. The agent remembered everything.
How It Works
The architecture is straightforward: Groq handles the LLM calls, Hindsight handles memory. Three things happen on every message:
- Recall — pull relevant past memories for this user
- Respond — build a system prompt with that context, call Groq
- Retain — save this exchange back to Hindsight
def get_reply(user_id: str, user_message: str) -> str:
# 1. Recall past memories for this user
past = recall_memories(user_id, user_message)
# 2. Build system prompt with memory context
if past:
system = f"""You are a helpful customer support agent.
You already know the following about this user from past conversations:
{past}
Use this context to give a personalized, informed response.
Do not ask for information you already know."""
else:
system = """You are a helpful customer support agent.
This is your first interaction with this user. Be friendly."""
# 3. Call Groq
response = groq_client.chat.completions.create(
model="qwen/qwen3-32b",
messages=[
{"role": "system", "content": system},
{"role": "user", "content": user_message}
]
)
reply = response.choices[0].message.content
# 4. Save this exchange to memory
save_memory(user_id, f"User: {user_message}\nAgent: {reply}")
return reply
Hindsight: Not Just a Vector Store
What surprised me about Hindsight is that it doesn't store raw text. When you call retain(), it runs an LLM over the content to extract structured facts — entities, relationships, timestamps — and builds a knowledge graph from them.
So when the agent recalled "order #1234" in session 2, it wasn't doing a dumb string match. It was retrieving a structured fact: this user has a delayed order, they are frustrated, the order number is 1234.
hindsight.retain(
bank_id=HINDSIGHT_BANK_ID,
content=f"User: {user_message}\nAgent: {reply}",
context=f"support session for user {user_id}",
metadata={"user_id": user_id}
)
Recall works the same way — semantic similarity plus graph traversal, not just nearest-neighbor vector search:
results = hindsight.recall(
bank_id=HINDSIGHT_BANK_ID,
query=user_message,
tags=[f"user:{user_id}"]
)
What I Learned
Memory changes the entire dynamic. Without it, every session starts from zero and the user carries all the cognitive load. With it, the agent carries the load instead. That's what good support feels like.
Structured memory beats raw storage. Storing full conversation transcripts and doing similarity search on them is fragile. Hindsight's fact extraction means the agent understands what happened, not just what was said.
User isolation matters. Using tags and metadata with user_id ensures one user's memories never bleed into another's. This is critical for any real deployment.
Groq + Hindsight is a strong free stack. Groq's free tier is fast enough for real-time chat. Hindsight Cloud gives you $50 in free credits. You can build and demo this entire thing at zero cost.
Try It Yourself
The full code is on GitHub: yaswanth0068/support-agent
If you want to add persistent memory to your own agent, Hindsight is the fastest way I've found to do it. Check out the Hindsight docs and the agent memory overview to get started.
Two lines of code. Your agent remembers everything.
Top comments (0)