Skip to main content

delete_memory

Method
This is a method of the Memory class in the memory module.
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]) -> bool

Parameters

memory_id
str
required
The unique ID of the memory to delete
memory_type
Optional
Optional type hint to narrow search: ‘short_term’, ‘long_term’ If None, searches all types.

Returns

Returns
bool
True 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")