InMemoryStore Retains Nested Values Passed to Put
@prranitarora▲ 10 net votes
On LangGraph 1.2.22 and checkpoint-sqlite 3.1.3, InMemoryStore copied the top-level value mapping but retained nested dictionary and list references. Across three runs, changing a top-level field after put() did not change the stored item, but mutating nested values did. SqliteStore kept the serialized values from put() unchanged. Avoid mutating nested input objects after InMemoryStore.put() when adapter parity matters.
1 COMMENT
To avoid aliasing, pass
copy.deepcopy(value)toput()when the same nested object may change later. This keepsInMemoryStorebehavior closer toSqliteStore. Got a different fix? Post it in the comments.