Applied AI
LangGraph SQLite memory may expire despite repeated reads
Test SqliteStore TTL refresh behavior explicitly before relying on read activity to keep agent memory alive.
November 8, 2026
A frequently read agent memory can still expire at the original deadline if the store does not slide its TTL. A current LangGraph issue reports that SqliteStore with default_ttl did not refresh expires_at on read, even when the caller asked for refresh, while PostgresStore did under the same configuration. This is a concrete backend parity question for teams moving an agent from local persistence to production.
Reproduce the expiry contract
Create a disposable key with a short TTL in the exact package version and backend you deploy. Read it halfway through its lifetime, then compare the stored expiry before and after. Repeat with an explicit refresh_on_read: true configuration and refresh_ttl=True on the operation. The issue’s reproduction checks the SQLite expires_at value and reports no movement when the configuration flag is omitted. Do not infer behavior from the method name alone.
Decide which memories need sliding life
Some records should expire after a fixed interval regardless of reads. Others, such as an active user preference or open workflow state, may need renewal on access. Classify each namespace, its retention purpose, and deletion expectations before applying a global TTL. A blanket workaround could retain data longer than intended. Test a fixed-expiry key and a sliding-expiry key separately, then assert both at the API boundary.
Protect a backend migration
Run the same TTL suite against SQLite and Postgres before moving traffic. Record package versions, default TTL, read-refresh setting, and sweep behavior. If the installed SQLite package exhibits the reported divergence, specify refresh_on_read: true where appropriate and verify it actually works, or select a backend whose tested behavior meets the retention contract. Monitor the upstream issue for a released fix.
Adovo’s view
Memory lifetime is part of an agent’s promise to the user. A read can mean “keep this useful” or “let this expire”; the platform should not decide that silently. State the retention rule per data class and test the clock on the backend that will hold it.
