Commit Memory Batch • AI Agent SDK
commit_memory_batch: Persist a batch of staged memory writes.
commit_memory_batch
Method
</div>
Persist a batch of staged memory writes.
Mirrors `FileMemory.commit_memory_batch so the pre-compaction fact flush (compaction/memory_flush.py) durably commits extracted facts for sqlite/chroma/mongodb/mem0 backends instead of raising and being swallowed. Each staged tuple is (method_name, args, kwargs) produced by _StagedMemory; add_ names map to the store_` equivalents.
The `store_* methods serialize their own SQLite writes with _write_lock; this method therefore must NOT hold that lock while calling them (it is a non-reentrant threading.Lock and doing so would deadlock). Each write goes through commit_guard.commit so a write is skipped once the flush has been cancelled or the shared deadline` has passed, honoring the same atomic-commit contract as the file backend.
Signature
def commit_memory_batch(writes: List[tuple]) -> NoneParameters
List[tuple]No description available.
Uses
store
Source
View on GitHubpraisonaiagents/memory/memory.py at line 419