Two stores, two purposes
Lola Send uses Redis for two distinct concerns, each with its own store and configuration:Conversation state
The state store holds working context for each active conversation — such as which step the sender is on in a multi-step flow, temporary data collected during the conversation, and agent-specific flags. Agents read and write state through a context manager:Conversation history
The history store maintains an ordered record of messages exchanged in each session. The AI model uses this history as its context window —core_history_window_length in MacawSettings controls how many turns the model sees. History can be cleared programmatically (e.g., when a session resets via the /new command).
Stateless application design
The application itself is stateless:- Session state lives in Redis, not in application memory
- Sender identity lives in the backend identity service, injected per-request by middleware
- Conversation history lives in Redis, accessed asynchronously
- Configuration comes from environment variables (managed by Doppler)
- Horizontal scaling — add instances to handle load without coordination
- Zero-downtime deployments — replace instances without losing state
- Fault tolerance — if an instance fails, other instances continue processing
Redis configuration
State and history use separate Redis configurations for isolation:
Separate configurations allow the bank to:
- Deploy state and history to different Redis instances for performance isolation
- Apply different persistence, eviction, and backup policies per store
- Monitor and scale each store independently
Session scoping
Redis keys are scoped by session ID, which is derived from the sender’s phone number and channel. This ensures:- Conversations from different senders are isolated
- The same sender on different channels has separate sessions
- No cross-contamination of state between conversations
Singleton pattern
Both stores are implemented as singletons — created once at application startup and shared across all agents:Security considerations
- No sensitive data in state: Card numbers, full PII, and other sensitive data are never persisted in conversation state or history. Sensitive operations are handled through external encrypted widgets.
- VPC deployment: Redis instances deploy within the virtual private cloud, not exposed to the public internet.
- Ephemeral data: Conversation state has a natural lifecycle tied to the session. State does not accumulate indefinitely.
- No credentials in state: Authentication tokens and secrets are managed by Doppler, not stored in Redis.