Delete Memory • AI Agent SDK
delete_memory: Delete a specific memory by ID.
delete_memory
Method
</div>
Delete a specific memory by ID.
This is the unified deletion method that searches across all memory types and all backends (SQLite, ChromaDB, Mem0, MongoDB).
Particularly useful for:
- Cleaning up image-based memories after processing to free context window
- Removing outdated or incorrect information
- Privacy compliance (selective erasure)
Signature
def delete_memory(memory_id: str, memory_type: Optional[str]) -> boolParameters
ParamField
strThe unique ID of the memory to delete
ParamField
Optional[str]Optional type hint to narrow search: ‘short_term’, ‘long_term’ If None, searches all types.
Returns
ResponseField
boolTrue if memory was found and deleted, False otherwise
Usage
# Delete a specific image analysis memory
memory.delete_memory("1705123456789")
# Delete with type hint for faster lookup
memory.delete_memory("1705123456789", memory_type="short_term")Uses
delete_short_termdelete_long_term
Used By
DakeraMemoryAdapter.delete_memoriesMemory.delete_short_termMemory.delete_long_termMemory.delete_memoriesMemory.forget
Source
View on GitHubpraisonaiagents/memory/memory.py at line 1595