Skip to content

No way to delete memories from a MemoryService #6949

Closed
SabreKeyZ/adk-python
#1

Description

@Chenjigaram

Is your feature request related to a specific problem?

BaseSessionService has delete_session and BaseArtifactService has delete_artifact, but BaseMemoryService only has add_session_to_memory, add_events_to_memory, add_memory and search_memory. Once something is written to memory there is no way to remove it through ADK.

This comes up when a user asks for their data to be deleted. Sessions and artifacts I can handle. Whatever was extracted into long-term memory I cannot, so I end up going around ADK and deleting straight from the backing store.

Most of the pieces are already there. MemoryEntry has an id field, and the Vertex API has projects.locations.reasoningEngines.memories.delete. VertexAiMemoryBankService just doesn't wrap it. It only uses memories.create, memories.generate and memories.ingest_events.

Describe the Solution You'd Like

Two methods on BaseMemoryService:

async def delete_memory(self, *, app_name: str, user_id: str, memory_id: str) -> None
async def delete_memories(self, *, app_name: str, user_id: str) -> None

First one deletes a single entry, second one everything stored for a user.

For VertexAiMemoryBankService both map onto memories.delete. InMemoryMemoryService keeps a dict so it's easy. Implementations that can't support it could raise NotImplementedError.

Impact on your work

I'm building agents for users in the EU, where a deletion request has to be answered within a month. Right now the memory part of that is a manual step outside ADK, and it's the part I can't show was actually done.

Willingness to contribute

Yes, happy to open a PR if you're OK with the method names and signatures.

Describe Alternatives You've Considered

Deleting from the backing store directly. It works but it's different for every implementation and bypasses ADK completely. The other option is not using MemoryService at all.

Version

google-adk 2.8.0

Activity

  1. SabreKeyZ commented on Aug 31, 2026

    @SabreKeyZ

    I'd like to work on this.

    Plan: add delete_memory (and a matching search-by-id if needed) on BaseMemoryService, implement it for the in-memory/sqlite services and wrap Vertex memories.delete on VertexAiMemoryBankService. Tests for delete-missing, delete-then-search, and the Vertex client call.

    Please confirm the method signatures before I open a PR, per CONTRIBUTING.

  2. added
    services[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc
    on Aug 31, 2026
  3. added a commit that references this issue on Aug 31, 2026
    e36f365
  4. sanketpatil06 commented on Aug 31, 2026

    @sanketpatil06

    Hi @Chenjigaram , Thank you for your feature request. It is currently under review, and we will let you know if we need any further information. We appreciate your understanding.

  5. added
    needs review[Status] The PR/issue is awaiting review from the maintainer
    on Aug 31, 2026
  6. SabreKeyZ commented on Aug 31, 2026

    @SabreKeyZ

    There's a complete implementation in #6961 (CLA signed, checks green) if it's useful while this is under review. Happy to adjust the API to whatever the team prefers.

  7. uvsohith2004 commented on Oct 3, 2026

    @uvsohith2004

    Is your feature request related to a specific problem?

    BaseSessionService has delete_session and BaseArtifactService has delete_artifact, but BaseMemoryService only has add_session_to_memory, add_events_to_memory, add_memory and search_memory. Once something is written to memory there is no way to remove it through ADK.

    This comes up when a user asks for their data to be deleted. Sessions and artifacts I can handle. Whatever was extracted into long-term memory I cannot, so I end up going around ADK and deleting straight from the backing store.

    Most of the pieces are already there. MemoryEntry has an id field, and the Vertex API has projects.locations.reasoningEngines.memories.delete. VertexAiMemoryBankService just doesn't wrap it. It only uses memories.create, memories.generate and memories.ingest_events.

    Describe the Solution You'd Like

    Two methods on BaseMemoryService:

    async def delete_memory(self, *, app_name: str, user_id: str, memory_id: str) -> None
    async def delete_memories(self, *, app_name: str, user_id: str) -> None
    First one deletes a single entry, second one everything stored for a user.

    For VertexAiMemoryBankService both map onto memories.delete. InMemoryMemoryService keeps a dict so it's easy. Implementations that can't support it could raise NotImplementedError.

    Impact on your work

    I'm building agents for users in the EU, where a deletion request has to be answered within a month. Right now the memory part of that is a manual step outside ADK, and it's the part I can't show was actually done.

    Willingness to contribute

    Yes, happy to open a PR if you're OK with the method names and signatures.

    Describe Alternatives You've Considered

    Deleting from the backing store directly. It works but it's different for every implementation and bypasses ADK completely. The other option is not using MemoryService at all.

    Version

    google-adk 2.8.0

    +1. If extracted memory can't be removed through the same API, you end up with a second, unofficial delete path that's hard to audit. Until delete_memory exists, recording session_id in MemoryEntry ids at write time at least makes backing-store cleanup provable. (I work on Breeth, a memory API with retraction and hard delete built in, in case you need it before ADK ships this.)

  8. DeanChensj commented on Oct 7, 2026

    @DeanChensj
    Collaborator

    Cross-referencing #7109 (closed as a duplicate of this issue), which includes a detailed design discussion on MemoryEntry.id round-tripping across memory backends (InMemoryMemoryService, FirestoreMemoryService, VertexAiMemoryBankService, and VertexAiRagMemoryService) as well as open PR #7175 alongside PR #6961.

  9. 1320800521 commented on Oct 15, 2026

    @1320800521

    Independent recheck on 2026-10-15 (pinned versions; not a claim about the latest release):

    • Environment: Python 3.11+, google-adk==2.8.0 and 2.9.0, InMemorySessionService + InMemoryMemoryService; no external model/Vertex API calls.
    • Steps: create a session with a unique marker → add_session_to_memory() → search_memory() finds the marker → delete_session() → check session and memory again.
    • Both versions: session_exists_after_delete=false, memory_found_before_delete=true, memory_found_after_delete=true, and the callable BaseMemoryService delete-method list is empty. The existing assertion-based version matrix passed again today.
    • Scope: confirms the separation of session and copied memory in the tested in-memory implementations. This does not establish behavior in newer versions or every hosted backend.

    For the proposed #6961 / #7175 implementations, useful regression cases would be delete-then-search, missing IDs, user namespace isolation, and MemoryEntry.id round-tripping across supported backends.

    Independent repro + version matrix: https://github.com/xbstack/google-adk-memory-delete-session-repro

    Test evidence and data-deletion boundary: https://www.xbstack.com/en/ai/google-adk-delete-session-memory-retained/?utm_source=github&utm_medium=referral&utm_campaign=google_adk_memory_delete&utm_content=issue_comment

    Small source-reference correction: the related memory report is #7109 (closed duplicate of this issue); #7110 concerns duplicate agent names and is unrelated.

  10. added a commit that references this issue on Oct 15, 2026
    41e5c7b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

needs review[Status] The PR/issue is awaiting review from the maintainerservices[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions