Database Adapters
Database adapters provide persistence for conversations, sessions, and agent state.Available Adapters
SqliteDbAdapter
SqliteDbAdapter implements the full DbAdapter contract (sessions, messages, runs, tool calls, traces, spans) on a real SQLite file, so a session written by one process is readable by the next. It is what db("sqlite:./data.db") returns.
createSqliteDbAdapter({ filename }) (or new SqliteDbAdapter({ filename })) remains available for direct construction:
Driver probe order
Two drivers back the adapter, tried in order. Opening the file is part of loading —better-sqlite3’s ABI failure only surfaces at new Database(...), so a driver is “loaded” only once a connection actually opens.
better-sqlite3— the declared dependency. A native module compiled against one Node ABI; run under a mismatched Node major it throwsERR_DLOPEN_FAILED.node:sqlite— Node’s built-in SQLite (Node ≥ 22.5). No native build, same on-disk format, so a file written by either driver reads in the other.
PRAISONAI_SQLITE_DRIVER=better-sqlite3|node or the driver constructor option.
No memory fallback
If neither driver can open the file, every operation rejects with a message naming what each driver did and how to fix it. It never degrades to an in-processMap — a persistence layer that quietly stops persisting is the bug this adapter exists to fix.
Set
PRAISONAI_REQUIRE_SQLITE=1 in CI to turn a driver-unavailable skip into a hard failure, so a pipeline cannot silently pass without real persistence.Incompatible-schema diagnostic
On open, the adapter verifies each required table’s columns. A file written with an incompatible table shape (for example, one created by the legacySQLiteAdapter below) is diagnosed immediately rather than deferring the failure into the first INSERT:

