DEV Community

Sahithya Kajipuram
Sahithya Kajipuram

Posted on

SupportMind: A support agent that remembers every customer

Every time I contact customer support, I have to repeat my problem from scratch. The agent has no idea what happened last time. That is a memory problem, not an AI problem, so I built SupportMind, a support agent with long-term memory using Hindsight.

I'm Sahithya Kajipuram, and this was built with Code.in.

What it does

SupportMind is a Flask app where every customer has their own memory bank. Before replying, the agent recalls that customer's past issues. After replying, it saves the new conversation for next time.

The app is built with Flask, Groq (gpt-oss-120b) for the replies, and Hindsight for memory.

Same question, two different answers

A new customer says "my internet keeps dropping" and gets a generic checklist: restart the router, check the cables.

A returning customer, Priya, says the exact same thing. The agent already knows her router kept disconnecting in the evenings because of outdated firmware, and that updating it fixed the problem. It skips the basics and goes straight to what worked before.

Same model, same prompt. The only difference is memory.

Every customer has their own memory

The demo has three sample customers:

  • Priya Sharma: router disconnecting (fixed by a firmware update) and slow WiFi (fixed with a WiFi extender)
  • Ramesh Kumar: his smart TV kept losing connection to the app. The fix was clearing the app cache and reinstalling. When he says "my TV app won't connect," the agent recalls this and suggests it first.
  • Ananya Reddy: billed twice for her subscription (refund issued) and a plan downgrade question

Nothing gets mixed up between customers because each one has a separate memory bank.

How it works

  1. One memory bank per customer, using the customer ID.
  2. Recall before every reply: past memories are fetched and added to the prompt.
  3. Retain after every reply: the new conversation is saved.
  4. Reflect for briefings: one click gives a 3-bullet summary of the customer.

Here is the simplified chat route:

@app.route("/chat", methods=["POST"])
def chat():
    customer_id = request.json.get("customer_id")
    message = request.json.get("message")

    # 1. Recall this customer's past history from Hindsight
    recall_result = hindsight.recall(bank_id=customer_id, query=message)
    past_memories = [r.text for r in recall_result.results]

    # 2. Put the memories into the prompt
    if past_memories:
        memory_context = "Past history with this customer:\n" + "\n".join(past_memories)
    else:
        memory_context = "This is a new customer with no past history."

    # 3. Generate the reply with the LLM
    response = groq_client.chat.completions.create(
        model="openai/gpt-oss-120b",
        messages=[
            {"role": "system", "content": f"You are a helpful support agent.\n{memory_context}"},
            {"role": "user", "content": message}
        ]
    )
    reply = response.choices[0].message.content

    # 4. Retain this conversation for next time
    hindsight.retain(
        bank_id=customer_id,
        content=f"Customer said: {message}. Agent replied: {reply}"
    )
    return jsonify({"reply": reply, "recalled_memories": past_memories})
Enter fullscreen mode Exit fullscreen mode

Customer briefing

A support rep shouldn't have to read old notes. One click calls Hindsight's reflect and returns a short summary:

r = hindsight.reflect(
    bank_id=customer_id,
    query="Write a briefing for a support agent about this customer: past issues, what fixed them, and how best to help next. Use 3 short bullet points."
)
Enter fullscreen mode Exit fullscreen mode

Features

  • Customer selector (stands in for login in this prototype)
  • Compare button: new vs returning customer side by side
  • Memory panel showing exactly what was recalled
  • Live counter of memories recalled
  • Customer briefing using Hindsight's reflect

What I learned

  • Show the recalled memories in the UI. It makes the agent's behavior easy to understand.
  • Test the empty-memory case first.
  • Per-customer memory beats stuffing the full chat history into every prompt.

Limits and next steps

The customers and tickets are sample data, and the agent only gives advice. It can't look up real accounts or issue refunds. Next steps are a real login, a real ticket system, and letting the agent take actions.

Code: https://github.com/Sahithya1211/customer-support-agent

Built with Code.in and Hindsight

Top comments (1)