Agno's clear_memory tool wipes every user's memories: how to scope Agno agent memory per user Mohammed, founder of MemorySync, reported that Agno's model-facing clear_memory tool calls db.clear_memories() without a user filter, so a call made inside one user's session deletes every user's memories across SQLite, PostgreSQL, MySQL and MongoDB drivers. He reproduced the bug on agno 3.1.10, the latest PyPI release as of Oct 26, 2026, showing that a clear_memory call in Alice's session left Bob's stored memories empty; a fix routing the tool through the scoped clear_user_memories(user_id=...) is open as PR #9986. He recommends checking whether MemoryManager is configured with clear_memories=True, using delete_memories=True for per-user 'forget everything' requests, and adding a guard around the tool. Disclosure: I'm Mohammed, founder of MemorySync. I drafted this article with AI assistance and reviewed it for accuracy against the official Agno and MemorySync docs. Code status: on Oct 26, 2026 I ran the same calls as Steps 1, 3 and 4 the reproduction, the per-user delete and the guard in scratch scripts on agno 3.1.10 Python 3.13, a local SQLite file , with no model and no API keys. In Step 5 I only constructed the agent and called clear memories with a placeholder key, which raised before any request. No LLM was called and no MemorySync request was made, so memory extraction and recall were not run. The rest is adapted from the docs. If you run one Agno agent for many users, you probably keep every user's memories in one database and separate them with user id . agno-agi/agno 9983 https://github.com/agno-agi/agno/issues/9983 shows where that breaks: the clear memory tool that MemoryManager can hand to the model calls db.clear memories with no user filter. One user's session can delete every user's memories. Below: how to check whether your setup can reach that tool, the settings that keep it away from the model, a per-user wipe that stays scoped, and a small guard you can add today. Agno behaviour comes from the Agno memory docs https://docs.agno.com/memory/overview , the MemoryManager reference and the installed package. I'm building MemorySync, a hosted memory layer, and it gets one short section near the end if you want it with Agno, see the MemorySync Agno guide https://docs.memorysync.io/guides/agno?utm source=devto&utm medium=social&utm campaign=pivot oct19&utm content=agno-clear-memory-per-user-memory-scoping-docs . MemoryManager builds a set of memory tools for model-driven memory work: add memory , update memory , delete memory and clear memory . The first three pass the current user id . clear memory doesn't: php def clear memory - str: db.clear memories ... The reporter says clear memories deletes the whole memories table in every database driver SQLite, PostgreSQL, MySQL and MongoDB . A fix that routes the tool through the scoped clear user memories user id=... is up as PR 9986. On Oct 26, 2026 the issue and the PR were both still open, and agno 3.1.10, the latest release on PyPI that day, still has the unscoped tool. This follows the issue's reproduction. get db tools is a private method; it's used here only to call the tool exactly as the agent would: python from agno.db.sqlite import SqliteDb from agno.memory import MemoryManager, UserMemory db = SqliteDb db file="memories.db" db.upsert user memory UserMemory user id="user-alice", memory="Alice books window seats." db.upsert user memory UserMemory user id="user-bob", memory="Bob prefers aisle seats." manager = MemoryManager db=db tools = {f. name : f for f in manager. get db tools "user-alice", db, "fixture", enable add memory=True, enable update memory=True, enable delete memory=True, enable clear memory=True, } tools "clear memory" a tool call inside Alice's session print m.memory for m in db.get user memories user id="user-bob" On agno 3.1.10 this printed Memory cleared successfully and then . Bob's memory was gone after a call made in Alice's session. clear memory In agno 3.1.10, the model only gets this tool in one situation: update memory on run=True : the background memory call is built with enable clear memory=False , so enable agentic memory=True : the agent gets an update user memory tool, and the nested memory call offers the tools your MemoryManager flags allow. MemoryManager clear memories=True . The MemoryManager reference https://docs.agno.com/reference/memory/memory lists clear memories as "Allow the manager to clear all memories", default False . So the setting to look for is clear memories=True . If you need users to be able to say "forget everything about me", use delete memories=True instead. The agentic memory docs https://docs.agno.com/memory/agent/agentic-memory say it lets the tool delete memories for the current user id : python from agno.agent import Agent from agno.memory import MemoryManager agent = Agent model=..., your model db=db, memory manager=MemoryManager delete memories=True , leave clear memories at False enable agentic memory=True, With these flags, I checked the tool list the memory call would get: add memory , delete memory , update memory , and no clear memory . Also look through your own code for MemoryManager.clear and db.clear memories . The reference says clear "has no user scope and clears the entire memory store". For an admin action or a "delete my data" endpoint, call the scoped method with the authenticated user's ID: manager.clear user memories user id="user-alice" async database: await manager.aclear user memories user id="user-alice" In my run, Alice had no memories left afterwards and Bob still had his. Always pass user id explicitly. Per the reference, user-scoped methods fall back to a user called "default" when it's omitted, and the best practices page says not to rely on it. If you want the global wipe gone no matter which flags someone sets later, subclass your database and make clear memories refuse. This is my addition, not something from the Agno docs: python from agno.db.sqlite import SqliteDb class NoGlobalClearSqliteDb SqliteDb : def clear memories self - None: raise RuntimeError "Global memory wipe is disabled. Use clear user memories user id=... ." db = NoGlobalClearSqliteDb db file="memories.db" With this in place, running Step 1 again made the clear memory tool raise instead of deleting, and Bob's memory stayed. clear user memories user id=... still worked, because it deletes one user's memories by ID and never calls clear memories . The same override works for the PostgreSQL, MySQL or MongoDB classes. I only ran it on SQLite. MemorySync's Agno guide https://docs.memorysync.io/guides/agno?utm source=devto&utm medium=social&utm campaign=pivot oct19&utm content=agno-clear-memory-per-user-memory-scoping plugs a MemorySyncDb into Agno's own MemoryManager . Sessions stay in your database, and memories go to MemorySync. Its clear memories always raises, and the per-user wipe is an explicit forget user memories user id : pip install agno-memorysync python from agno.agent import Agent from agno.db.sqlite import SqliteDb from agno.memory import MemoryManager from agno memorysync import MemorySyncDb memory db = MemorySyncDb reads MEMORYSYNC API KEY agent = Agent db=SqliteDb db file="agent.db" , sessions: local memory manager=MemoryManager db=memory db , memories: MemorySync update memory on run=True, user id="customer-42", memory db.forget user memories "customer-42" one user's memories, returns the count The guide requires Python 3.10+ and agno 2.8 or newer, and you create the API key in the dashboard under Settings → API Keys. MemorySyncDb only handles memory. If you point sessions or knowledge at it, it raises MemorySyncMemoryOnlyError , so keep those on your own database. In my run, constructing the agent worked, and clear memories raised MemorySyncClearAllError before sending anything. You don't need MemorySync for Steps 1 to 4. clear or clear memories calls in your code. Then add the Step 4 guard. user id on every run and every "default" . clear user memories raises with an async database. aclear user memories . The reference says the sync version requires a synchronous database. MemorySyncMemoryOnlyError . MemorySyncDb . Only memory manager= should use it. Does Agno's clear memory tool delete only the current user's memories? Not in agno 3.1.10. The tool calls db.clear memories , which isn't filtered by user agno 9983 https://github.com/agno-agi/agno/issues/9983 . A fix that scopes it to the calling user is proposed in PR 9986, which was still open on Oct 26, 2026. How do I delete all memories for one user in Agno? Call MemoryManager.clear user memories user id=... , or aclear user memories ... with an async database. The reference describes both as clearing only the selected user's memories MemoryManager reference https://docs.agno.com/reference/memory/memory . Is Agno memory isolated per user by default? Memories are stored and read by user id . The multi-user chat example https://docs.agno.com/memory/agent/multi-user-multi-session-chat scopes history by session id and memory by user id . If you omit the ID, Agno uses "default" , and clear / clear memories ignore user scope entirely. Can I use MemorySync as Agno's memory backend? Yes. MemorySyncDb from agno-memorysync goes into MemoryManager db=... , while sessions stay in your own database. Its clear memories always raises, and per-user wipes use forget user memories user id MemorySync Agno guide https://docs.memorysync.io/guides/agno?utm source=devto&utm medium=social&utm campaign=pivot oct19&utm content=agno-clear-memory-per-user-memory-scoping . agno/memory/manager.py : get db tools , create user memories , update memory task and PyPI agno 3.1.10, agno-memorysync 1.1.0 If you want to see a memory survive a full page reload before wiring up an agent, the MemorySync playground runs the save, reload and recall loop in your browser: memorysync.io/try https://memorysync.io/try?utm source=devto&utm medium=social&utm campaign=pivot oct19&utm content=agno-clear-memory-per-user-memory-scoping .