How ramanpreetx/langgraph-memory-chatbot works
This is a Streamlit chat application with LangGraph-managed short-term conversation summaries and cross-conversation long-term user memories. A browser user sends messages through the app; the graph summarizes when needed, retrieves relevant memories, generates a reply, and hands eligible messages to background LTM processing. That pipeline extracts candidate facts, retrieves similar stored memories, resolves each candidate, and applies the decision. README documents thread history, titles, memory management, and PostgreSQL persistence. Some details are documented but their implementation is not sampled, so those links cite the README.
Main entry points: app.py Streamlit chat UI · chatbot.py Reply generation · memory.py Similar-memory retrieval · prompt.py Prompt templates
Components 18
Chat interface
- Streamlit chat UI
app.py
Conversation graph
- LangGraph runtime
chatbot.py - STM summarizer
chatbot.py - Reply generation
chatbot.py - LTM trigger
chatbot.py - Prompt templates
prompt.py
Long-term memory
- LTM pipeline
memory.py - Batch selection
memory.py - Memory extraction
memory.py - Similar-memory retrieval
memory.py - Memory resolution
memory.py - Memory management
memory.py
Persistence and identity
- User identity
identity.py - Thread and titles
utils.py - PostgreSQL
Other components
- Browser user
- Groq models
- Sentence embeddings
Connections 29
- Browser user → Streamlit chat UI: sends messages
README.md - Streamlit chat UI → User identity: gets user ID
app.py - Streamlit chat UI → LangGraph runtime: streams graph
README.md - Streamlit chat UI → Thread and titles: manages threads
app.py - Streamlit chat UI → Memory management: manages memories
app.py - LangGraph runtime → STM summarizer: runs first
chatbot.py - STM summarizer → Reply generation: then runs
chatbot.py - Reply generation → LTM trigger: then runs
chatbot.py - STM summarizer → Prompt templates: uses templates
chatbot.py - Reply generation → Prompt templates: uses templates
chatbot.py - STM summarizer → Groq models: generates summary
chatbot.py - Reply generation → Similar-memory retrieval: looks up memories
chatbot.py - Reply generation → Groq models: generates reply
chatbot.py - LTM trigger → LTM pipeline: dispatches background work
chatbot.py - LTM pipeline → Batch selection: selects messages
memory.py - LTM pipeline → Memory extraction: extracts candidates
memory.py - Memory extraction → Prompt templates: uses template
memory.py - Memory extraction → Groq models: extracts facts
memory.py - LTM pipeline → Similar-memory retrieval: searches candidates
memory.py - Similar-memory retrieval → Memory resolution: supplies matches
memory.py - Memory resolution → Prompt templates: uses template
memory.py - Memory resolution → Groq models: chooses operation
- Memory resolution → PostgreSQL: applies decisions
memory.py - Similar-memory retrieval → PostgreSQL: searches memories
memory.py - Memory management → PostgreSQL: deletes memories
- User identity → Streamlit chat UI: provides identity
app.py - Thread and titles → PostgreSQL: persists threads
README.md - LangGraph runtime → PostgreSQL: saves thread state
chatbot.py - Similar-memory retrieval → Sentence embeddings: indexes queries