trash-canDelete Memories

Deletes multiple memories based on the provided parameters. You can delete memories by specifying an identifier (user_id or agent_id) and optionally memory_ids.

  • If no memory_ids are provided, all memories associated with the given user_id or agent_id will be deleted.

  • If scopes or metadata are included, the deletion will respect these filters — only memories matching the specified scopes and metadata will be removed.

  • When memory_ids are provided, any IDs that do not belong to the specified user_id or agent_id will be ignored; only valid and related memories will be deleted.

Parameters

  • memory_ids (list[str], optional) — List of memory ID.

  • user_id (str, optional) — User identifier for the memory.

  • agent_id (str, optional) — Agent identifier for the memory.

  • scopes (set[MemoryScope], optional) — Specifies the target for memory management, either for a specific participant or for combined access (USER or ASSISTANT). Default is [USER, ASSISTANT].

    • USER: Writes and retrieves memories targeting messages from user.

    • ASSISTANT: Writes and retrieves memories targeting messages from assistant.

    • USER, ASSISTANT: Writes and retrieves memories targeting messages from both the user and assistant.

  • metadata (dict[str, str], optional) — Extra metadata linked to the memory, which can be used to store any supplementary details or context related to it. Default is None.

Note: At least one of user_id or agent_id must be provided.

Returns

list[Chunk] — A list of deleted memory chunks. Each Chunk follows the GL SDK format and includes an id, content, metadata, and score.

Example

or

Expected Output

Last updated