Building Chatbots with Memory
Memori transforms stateless chatbots into intelligent conversational agents that remember user preferences, past interactions, and context across sessions. No more “What’s your account number?” every time — your chatbot recalls everything automatically.Why Memory Matters for Chatbots
Traditional chatbots lose context between sessions. Users must repeat themselves, and the experience feels frustrating and impersonal. Memori solves this by:- Remembering user preferences — favorite products, communication style, accessibility needs
- Recalling past conversations — previous issues, solutions, and outcomes
- Building user profiles — automatically extracting facts, preferences, and context over time
- Providing continuity — seamless experience across days, weeks, or months
Core Pattern: Entity + Process Attribution
Every chatbot conversation needs two IDs:- Entity ID — The user interacting with your bot (e.g.,
user_456orcustomer_jane_doe) - Process ID — Your chatbot’s identity (e.g.,
support_botorsales_assistant)
Use Case 1: Customer Support Chatbot
Build a support bot that remembers customer history, preferences, and past issues.Use Case 2: E-commerce Shopping Assistant
Create a shopping assistant that learns user preferences and recommends products based on past interactions.Use Case 3: Conversational Chatbot with Agno
Build an Agno-powered chatbot with persistent memory across conversations.Advanced: Session Management
Group related conversations into sessions for better context organization.Web Framework Integration
FastAPI
Flask
Best Practices
Always Set Attribution
Always Set Attribution
Without
entity_id and process_id, Memori cannot create or recall memories. Always call mem.attribution() before making LLM calls.Use Descriptive IDs
Use Descriptive IDs
Choose meaningful entity and process IDs:
- Entity:
user_{id},customer_{email},session_{uuid} - Process:
support_bot,sales_assistant,onboarding_agent
Handle Memory Processing in Scripts
Handle Memory Processing in Scripts
Memory augmentation runs asynchronously. In short-lived CLI scripts, call In long-running web servers, this is not needed — augmentation happens in the background.
mem.augmentation.wait() to ensure processing completes before exit.Use Sessions for Conversation Grouping
Use Sessions for Conversation Grouping
Group related interactions into sessions:
What Memori Remembers
Memori’s Advanced Augmentation automatically extracts and stores:| Memory Type | Scope | Example |
|---|---|---|
| Facts | Per entity, shared across processes | ”Uses PostgreSQL for database” |
| Preferences | Per entity | ”Prefers dark mode”, “Likes sci-fi” |
| Attributes | Per process | ”Support bot handles login issues” |
| Skills | Per entity | ”Python developer”, “FastAPI expert” |
| Relationships | Per entity | ”Works at Acme Corp”, “Reports to Jane” |
Next Steps
AI Agents
Build autonomous agents with persistent memory
Multi-Agent Systems
Coordinate multiple agents with shared memory
Dashboard
Explore memories in the Graph Explorer
Advanced Augmentation
Learn how memory extraction works