Session backends
A session needs a place to keep the conversation. See why an in-memory session loses a chat on restart, how a shared store lets two workers serve one chat, and how to write your own session class with four methods.
11 minPro
Checking your access…
Inside this lesson
- An animation you play, pause and step through, with each part saying what it is doing.
- The real code beside it, with the lines for each step lit up.
- Practice mode, where you route each message yourself, and a short quiz.
- About 11 minutes.
Written from the official documentation
In this module: Sessions and memory
- Choosing a memory strategyManual history, sessions or server managed conversations.Pro
- SessionsRemembering the conversation between runs.Pro
- Session backendsSQLite, Redis, SQLAlchemy, MongoDB, Dapr or your own class.Pro
- OpenAI hosted and compaction sessionsStore history on OpenAI and shrink long conversations.Pro
- Advanced SQLite and encrypted sessionsBranch a conversation, track usage and encrypt stored history.Pro