Delete Memories Matching • AI Agent SDK

delete_memories_matching: Delete memories matching a search query.

delete_memories_matching

Method

</div>

This is a method of the Memory class in the memory module.

Delete memories matching a search query.

Useful for bulk cleanup of related memories, e.g., all image-related context after finishing an image analysis session.

Signature

python
def delete_memories_matching(query: str, memory_type: Optional[str], limit: int) -> int

Parameters

ParamField str

Search query to match memories

ParamField Optional[str]

Optional type (‘short_term’ or ‘long_term’)

ParamField int

Maximum number of memories to delete

Returns

ResponseField int

Number of memories deleted

Uses

  • search_short_term
  • delete_short_term
  • search_long_term
  • delete_long_term

Used By

Source

View on GitHub

praisonaiagents/memory/memory.py at line 1661