MemoryStore is the storage backend for Memory. Definable provides three built-in implementations, from ephemeral in-memory stores for testing to file-based and SQLite backends for persistence.
Available Backends
Backend Examples
InMemoryStore
Ephemeral store for testing. Data is lost when the process exits.memory=True on an Agent or when you omit the store parameter:
SQLiteStore
The default choice for local development. Usesaiosqlite (included as a core dependency). Tables are auto-created on first use.
str
default:"./memory.db"
Path to the SQLite database file. Created automatically if it does not exist.
FileStore
JSONL-based file storage. Each session gets its own.jsonl file in the specified directory.
str
Directory where JSONL session files are stored. Created automatically if it does not exist.
MemoryStore Protocol
All backends implement theMemoryStore protocol. You can create custom stores by implementing these methods:
Method Reference
MemoryEntry Data Type
Every store works withMemoryEntry objects:
Choosing a Backend
For most projects, start with
SQLiteStore during development. The store is a constructor parameter, so swapping backends requires changing a single line: