Overview
Memori uses entity IDs and process IDs to segment memories across users and workflows. This ensures each user has isolated, personalized memories.Attribution Basics
- Python
- TypeScript
Multi-User Web Application
Here’s a complete example of a web application handling multiple users.- Python (Flask)
- TypeScript (Express)
Session Management
Memori uses session IDs to group related conversations. Each session represents a distinct conversation thread.- Python
- TypeScript
Multi-Tenant SaaS Application
For SaaS applications, use both entity and process IDs to segment memories by customer and tenant.Agent-Based Architecture
Use different process IDs for different agents or workflows.Key Concepts
Entity ID
Entity ID
The unique identifier for an end-user. This is typically:
- User UUID from your database
- Email address (hashed for privacy)
- Customer ID
Process ID
Process ID
The identifier for a workflow, application, or agent. This allows you to:
- Segment memories by use case (support vs sales)
- Maintain separate contexts for different agents
- Track memory usage by application
Session ID
Session ID
Represents a single conversation thread. Sessions are automatically generated but can be:
- Manually set to resume conversations
- Reset to start new threads
- Stored in your database for persistence
Best Practices
Always Set Entity ID
Never share entity IDs across users. Each user should have a unique identifier.
Use Meaningful Process IDs
Process IDs should describe the workflow (e.g., “onboarding”, “checkout-flow”).
Create Per-Request Instances
In web applications, create a new Memori instance for each request to avoid state leakage.
Store Session IDs
Save session IDs in your database to allow users to resume conversations.
Next Steps
Streaming Responses
Learn how to use Memori with streaming
Async Operations
Handle async memory operations