Thread Persistence
Store and resume conversations
Attachments
Handle files in conversations
Why Conversation Persistence Matters
Without persistence, every interaction starts from scratch:- No context from previous messages
- Can’t remember user preferences
- Can’t track ongoing tasks
- Poor user experience
- Stores conversation history
- Maintains context across sessions
- Can resume interrupted tasks
- Provides contextual responses
Quick Start with Persistence
Storage Backends
Narrator supports multiple storage backends:SQLite (Development)
Perfect for local development and single-user applications:PostgreSQL (Production)
Scalable for multi-user applications:Quick PostgreSQL Setup with Docker
Narrator includes built-in Docker commands for easy PostgreSQL setup:In-Memory (Testing)
For unit tests and temporary storage:Thread Management
Threads are containers for conversations. Each thread has a unique ID and contains messages.Creating Threads
Saving and Loading Threads
Message History
Messages in threads maintain full conversation context:Conversation Patterns
Pattern 1: User-Specific Threads
Pattern 2: Topic-Based Threads
Pattern 3: Session Management
File Attachments
FileStore handles attachments in conversations:Advanced Persistence Patterns
Conversation Summarization
Context Injection
Persistence Management Tips
1. Thread Naming Conventions
2. Metadata Usage
3. Cleanup Strategies
Real-World Example: Customer Support Agent
Database Setup and Configuration
Environment Variables
When using PostgreSQL, you can configure the connection via environment variables:Connection Pooling
For production applications, Narrator automatically configures connection pooling:Performance Considerations
1. Message Limits
Keep threads manageable:2. Batch Operations
3. Caching
Next steps
Using Narrator
Deep dive into Narrator features
Testing Agents
Test agents with conversation persistence
Slack Integration
Build Slack agents with persistence
Advanced Patterns
Complex persistence patterns