SmartSupport AI: An AI Customer Support Assistant with Long-Term Memory
Introduction
Customer support chatbots are everywhere, but most of them share one frustrating flaw: they forget. A customer explains their problem, gives their details, and the next time they return, the conversation starts from zero. SmartSupport AI is a customer support chatbot built to fix exactly that, using artificial intelligence combined with long-term memory to deliver personalized support.
Imagine a customer named Alex contacting support. In the first conversation, Alex shares three things:
- My name is Alex.
- My order number is 12345.
- I prefer email support.
Later, Alex returns and simply asks, "Can you help me with my order?" SmartSupport AI retrieves the stored information and uses it to give a more personalized response.
In simple words: our chatbot doesn't just answer questions; it can remember useful customer information for future conversations.
The Problem We Solve
Traditional support systems lose useful customer context between conversations. This forces customers to repeat themselves and makes the experience feel impersonal.
| Traditional chatbot | SmartSupport AI |
|---|---|
| Limited conversation memory | Long-term memory |
| Repeatedly asks customer details | Can recall stored details |
| Less personalized | Personalized responses |
| Limited customer context | Retrieves previous information |
Technologies Used
- Python (programming language): writes the application logic, connects APIs, processes messages and manages customer information.
- Streamlit (frontend and dashboard): builds the web interface using Python, without needing HTML, CSS or JavaScript for the basic application.
- Groq (AI response generation): provides access to the language model that understands customer questions and generates responses.
- Hindsight (long-term AI memory): stores customer conversation information and retrieves relevant memories when needed.
SQLite (optional local database) was discussed for persistent chat history, but I decided not to add it yet. It is not part of the working implementation.
Project Architecture
SmartSupport AI follows a memory-augmented AI chatbot design. A message travels through six stages:
- The customer enters a support question.
- The Streamlit application receives the message.
- Hindsight searches for relevant customer memories.
- Groq receives the question together with the retrieved memory context.
- Groq generates a personalized response, which is displayed to the customer.
- The conversation is saved to Hindsight, making useful information available for future retrieval.
Figure 1: Conceptual architecture. Human-agent escalation is a design idea, not yet implemented.
Understanding the Code
The main logic lives in app.py. Its key parts are below.
Importing libraries
import streamlit as st
import os
import asyncio
from dotenv import load_dotenv
from groq import Groq
from hindsight_client import Hindsight
| Library | Purpose |
|---|---|
| streamlit | Creates the user interface |
| os | Reads environment variables |
| asyncio | Runs asynchronous functions |
| dotenv | Loads API keys from .env |
| groq | Connects to Groq AI |
| hindsight_client | Connects to Hindsight |
Connecting Groq
The Groq client is initialized with an API key. The project currently uses the model openai/gpt-oss-120b.
groq_client = Groq(api_key=groq_key)
Retrieving memories
The app asks Hindsight to find useful information associated with the customer.
result = recall_memory(
f"Customer ID: {customer_id}. "
"Find previous support details and preferences."
)
Generating AI responses
The system instructions, conversation history and current question are sent to Groq.
response = groq_client.chat.completions.create(
model="openai/gpt-oss-120b",
messages=[
{"role": "system", "content": system_prompt},
*st.session_state.messages,
{"role": "user", "content": user_input}
]
)
Saving memories
The conversation is sent to Hindsight for use in future retrieval.
save_memory(
f"Customer ID: {customer_id}\n"
f"Customer message: {user_input}\n"
f"Assistant response: {answer}"
)
The Customer Dashboard
The dashboard is one of the most important parts of the project and has three major functions.
Figure 2: The Streamlit dashboard showing the customer profile extracted from stored memories.
A. Customer Profile
Displays information extracted from stored memories. For my test customer:
| Customer information | Value |
|---|---|
| Customer ID | customer-001 |
| Name | Alex |
| Order number | 12345 |
| Support preference |
B. Customer Memory
Retrieves stored information from Hindsight. In a successful test, the dashboard displayed 21 memories retrieved, each of which can be expanded to inspect its contents.
C. Automatic Profile Extraction
A Groq-powered extraction function takes the retrieved memories and extracts structured information: customer name, order number and preferred support method. JSON is used because it organizes information into predictable fields, making it easy to display with Streamlit metrics.
{
"name": "Alex",
"order_number": "12345",
"support_preference": "email"
}
Project Files
SmartSupport-AI/
├── venv/
├── .env
├── .gitignore
├── app.py
├── test_hindsight.py
└── README.md
| File | Purpose |
|---|---|
| app.py | Main application code |
| .env | Stores secret API credentials |
| .gitignore | Prevents selected files from being uploaded |
| test_hindsight.py | Tests Hindsight connectivity and functionality |
| README.md | Explains the project to other developers |
| venv/ | Python virtual environment containing dependencies |
Important: never upload
.envorvenvto GitHub. Also, the README mentions arequirements.txtfile that isn't in the project yet. It should be created before anyone else tries to install the project.
Project Progress
Working in tests:
- Python and VS Code setup
- Groq API integration and working AI chatbot
- Hindsight API integration
- Customer memory saving and retrieval
- Customer profile extraction
- Streamlit customer dashboard
- README documentation
Not implemented yet:
- Persistent chat history using SQLite
- Multi-user authentication
- Admin and support-agent roles
- Deployment to a public hosting service
- Automated customer analytics
Advantages
- Personalization: responses use relevant customer information.
- Long-term memory: can retrieve information from previous conversations.
- Reduced repetition: customers may not need to repeat previously stored details.
- Simple interface: Streamlit makes the application easy to use.
- Modular architecture: response generation and memory retrieval are handled by separate services.
- Expandable: additional features can be added in the future.
Limitations and Future Improvements
| Limitation | Possible future improvement |
|---|---|
| Depends on internet connectivity | Improve offline handling |
| Depends on external APIs | Add fallback mechanisms |
| No login system yet | Add authentication |
| No persistent chat history in SQLite | Add a database |
| Memory retrieval may not always find everything | Improve retrieval and memory testing |
Hindsight retrieval is not guaranteed to be perfect, so customer details should be verified before they are used for sensitive support actions.
Conclusion
SmartSupport AI shows how combining a fast language model (Groq) with a dedicated memory layer (Hindsight) can turn a forgetful chatbot into a more helpful, personalized assistant. By recalling details such as a customer's name, order number and contact preference, it reduces repetition and preserves context across conversations. With future additions like authentication, persistent history and deployment, it has a clear path to grow beyond its hackathon beginnings.
Feedback and ideas are welcome in the comments!
Top comments (0)