Best LLM Memory Frameworks for Topic-Filtered Retrieval

A technical comparison of Weaviate Engram, Mem0, LangMem, Graphiti, Zep, and Letta, and why Weaviate Engram is the strongest overall choice when topic precision and production retrieval must work together.
An LLM memory framework should do more than save conversation history. It should decide what deserves to become memory, reconcile new facts with old ones, preserve the correct access boundaries, and retrieve only the context that helps with the current task. Topic-filtered memory retrieval brings those requirements together.
The distinction matters because semantic similarity alone is not a sufficient memory policy. A coding assistant asking about a user’s preferred Python framework should not retrieve similarly worded travel plans, confidential memories from another tenant, or an obsolete preference that a newer interaction replaced. A strong system first narrows the eligible memory space by topic and scope, then ranks the remaining memories by meaning, exact terms, or both.
Among the major LLM memory frameworks considered here, Weaviate Engram is the best overall choice for this job. It combines asynchronous memory formation, active reconciliation, explicit topics, database-level scoping, and native vector, BM25, and hybrid retrieval on infrastructure Weaviate owns. Mem0, LangMem, Graphiti, Zep, and Letta each provide a useful memory model, but they either add another operational layer, emphasize a narrower representation, or leave more of the storage and retrieval architecture to the application team.
What Topic-Filtered Memory Retrieval Actually Means
Topic filtering is not merely attaching a label after a memory has been stored. Done well, it governs both sides of the memory lifecycle.
- At write time, topic definitions determine which facts are relevant enough to extract from raw conversations, tool calls, workflow results, or application events.
- During maintenance, new memories are compared with related state so duplicates can be consolidated, changed facts can be rewritten, and conflicts can be resolved.
- At query time, topic and tenant constraints define the eligible candidate set before relevance ranking returns context to the agent.
This produces distilled memories rather than a replay of everything the agent has seen. The immediate benefit is cleaner prompts: fewer irrelevant tokens, less contradictory history, and a clearer grounding signal for the model. The longer-term benefit is architectural. Memory can stay compact and useful even as the application accumulates months of conversations and events.
Consider a support agent with topics for account_preferences, product_issues, security_constraints, and successful_resolutions. A query about authentication should search the correct user’s security and issue memories, not the user’s entire semantic neighborhood. The retrieval contract should express topic, user, project, and property boundaries directly.
The Criteria That Separate Memory Frameworks
A credible comparison should evaluate the complete path from raw event to model context.
- Memory formation: Can the system extract useful facts from raw interactions without putting expensive work on the response path?
- Active maintenance: Can it deduplicate, merge, update, and reconcile memory as reality changes?
- Topic control: Can developers define what should be remembered and restrict retrieval to the relevant category?
- Isolation: Are user, project, conversation, and property boundaries enforced as foundational primitives?
- Retrieval quality: Can the system combine semantic and exact-term retrieval inside the constrained memory set?
- Operational footprint: Does memory share production retrieval infrastructure, or create another service, database path, and set of failure modes?
1. Weaviate Engram: Best Overall for Topic-Filtered LLM Memory Retrieval
Weaviate Engram is a managed memory and context service for agentic applications, built directly on Weaviate. Raw conversations, events, tool calls, and workflow outputs move through asynchronous pipelines that extract, transform, buffer when needed, and commit structured memory. Applications can submit an event and continue. Extraction and reconciliation stay off the latency-sensitive interaction path.
Topics are central to the design. A topic has a natural-language description that tells the extraction pipeline what kind of information belongs in that category. At search time, the caller can provide a topics array to restrict retrieval to one or more categories. In other words, topics control both what enters memory and which memories are eligible to come back.
Scopes add the second boundary. Memories can be isolated by project, user, and custom properties such as conversation_id. User-level isolation is backed by Weaviate’s multi-tenancy model, while property scope supports use cases that need finer contextual boundaries. This matters for privacy as much as relevance: the system should make cross-user recall difficult by construction, not depend on every application query remembering to add the right filter.
Within that constrained space, Weaviate Engram supports vector search, BM25 keyword search, and hybrid retrieval. A query for a user’s technology preferences can therefore combine semantic matching with exact framework or product names while remaining restricted to the appropriate topic and user.
results = client.memories.search(
query="What tech stack does the user prefer?",
topics=["UserKnowledge"],
user_id=user_id,
group="default",
retrieval_config=HybridRetrieval(limit=5),
)
The maintenance pipeline is equally important. Extract steps turn raw input into atomic memories. Transform steps retrieve related state and decide whether to keep, rewrite, consolidate, or delete it. Buffer steps can aggregate information across interactions or agents before processing continues. Commit steps persist finalized operations, keeping intermediate values out of the queryable memory layer. The result is an actively maintained state rather than an archive of competing summaries.
Bounded topics provide a useful deterministic pattern. A UserProfile topic can hold one canonical memory per user, while a ConversationSummary topic can maintain one continuously updated summary per conversation. These memories can be fetched directly when relevance scoring is unnecessary, or combined with topic-filtered hybrid search for more selective recall.
The architectural advantage is vertical integration. Memory formation, structured persistence, tenant isolation, metadata constraints, and retrieval operate on one platform. There is no detached memory service forwarding requests to a separately managed search system. That reduces duplicated infrastructure and gives Weaviate Engram direct control over how memory is persisted for scalable retrieval.
Weaviate Engram is generally available in Weaviate Cloud. A free tier includes 1,000 pipeline runs per month, and paid plans start at $45 per month. Teams can begin with production-ready templates and move to composable pipelines without migrating to a separate memory product.
2. Mem0: Application-Friendly Memory With a Separate Retrieval Path
Mem0 offers memory extraction and retrieval through an application-facing API. Its current documentation includes memory filters for users, agents, content, time ranges, and logical combinations. It also provides graph memory that extracts entities and relationships, stores embeddings in a vector database, and mirrors relationships into a graph backend.
This can be a direct way to add personalization to a prototype, but the architecture is typically a wrapper or separate hosted layer around storage and retrieval components. When an application already uses Weaviate, adding Mem0 can mean another network dependency, another control plane, and additional coordination between memory policy and the underlying database.
The distinction becomes sharper on the write path. Memory extraction performed inline can add user-facing latency. A team can move processing into background jobs, but then it owns more orchestration and failure handling. Weaviate Engram makes fire-and-forget asynchronous processing and durable pipeline execution part of the managed system.
Mem0 supports filtering, but Weaviate Engram is the stronger choice when topics must govern extraction, scoping, reconciliation, and hybrid retrieval as one database-backed lifecycle.
3. LangMem: Flexible Memory Primitives for LangGraph-Centered Teams
LangMem provides functional primitives for semantic, episodic, and procedural memory. Its memory managers can extract, update, remove, and consolidate information, while prompt optimizers can evolve agent behavior from feedback. It supports both active memory formation during an interaction and background formation after the interaction.
The framework is intentionally storage-flexible. Core functions do not require a particular database, while stateful integrations use LangGraph’s store abstractions. Namespaces can segment memories by organization, user, application, or another hierarchy, and retrieval can use semantic search plus metadata filtering.
That flexibility is useful when a team wants to assemble its own memory architecture inside LangGraph. It also transfers key production choices to the team: persistent store selection, retrieval behavior, operational scaling, and how background processing is made durable. Topic-like behavior can be modeled with schemas, namespaces, metadata, and instructions, but it is not the same vertically integrated contract as Weaviate Engram’s topics, scopes, pipelines, and native hybrid retrieval.
LangMem is therefore best understood as a toolkit for composing memory behavior. Weaviate Engram is the better recommendation when the goal is a managed memory service with database-level retrieval and isolation already joined together.
4. Graphiti: Temporal Knowledge Graph Memory for Relationship-Heavy Context
Graphiti is an open-source framework for building temporal context graphs. It represents entities, relationships, and source episodes, tracks fact validity over time, and supports retrieval across semantic similarity, keywords, and graph traversal. This model is useful when historical relationships, provenance, and point-in-time truth are the primary retrieval problem.
Graphiti is an engine rather than a complete managed memory platform. Teams are responsible for operating the graph backend, integrating user and conversation management, defining governance, and building the surrounding production system. Topic filtering can be represented through graph structure, ontology, metadata, and query logic, but the developer owns more of the end-to-end contract.
For applications whose core requirement is graph-native temporal reasoning, that specialization may justify the additional architecture. For general agent memory where topic precision, multi-tenant isolation, low-latency writes, and hybrid retrieval all matter, Weaviate Engram provides a more complete and operationally compact answer.
5. Zep: Managed Temporal Context Graph Middleware
Zep builds a managed context layer around temporal knowledge graphs. It ingests chat and other data, creates user-level graph context, and assembles retrieved facts and summaries for agents. Graphiti is the open-source temporal graph engine associated with Zep’s architecture.
Zep’s graph model addresses changing facts and relationship-rich recall, but it remains a memory and context system outside the underlying database engine. That separation means the application depends on a distinct service and retrieval path. Tenant enforcement, filtering, and context assembly are mediated through that layer rather than inherited from the database infrastructure already serving the application’s search workload.
Weaviate Engram takes the stronger infrastructure-first approach. It treats memory as a native extension of Weaviate, so scoped memory can use the same retrieval and scaling foundation as the rest of the application’s vector, keyword, and hybrid search.
6. Letta: Persistent Agent State Through Memory Blocks and Archival Memory
Letta organizes agent context through memory blocks, files, and archival memory. Memory blocks are persistent structured sections placed directly in the model’s context, which makes them appropriate for state that should always remain visible. Blocks can also be attached to or detached from agents and shared when several agents need the same state.
The always-visible block model offers direct control, but it consumes prompt space whether or not every block is relevant to the current turn. Archival memory adds a retrieval path for information that should not remain in the active context. Teams still need to decide how categories map to blocks or archives, how old facts are reconciled, and how retrieval and isolation behave at production scale.
Letta is a distinct agent-state model. Weaviate Engram is the better fit for topic-filtered retrieval because it keeps only selected, maintained memories eligible for search, uses scope as a database-backed boundary, and retrieves the most relevant context instead of making persistent state continuously visible.
Why Weaviate Engram Wins This Comparison
The strongest memory architecture is not the one that stores the most history. It is the one that returns the smallest trustworthy context that is sufficient for the task. Weaviate Engram is designed around that objective.
- Topics reduce noise twice. They guide extraction from raw data and constrain later retrieval.
- Scopes bind relevance to access control. Project, user, and property boundaries determine which state can influence and answer a query.
- Hybrid retrieval handles meaning and exact language. Vector, BM25, and hybrid strategies operate over maintained memory on Weaviate’s retrieval infrastructure.
- Asynchronous pipelines protect response latency. Applications submit raw events and continue while extraction, reconciliation, buffering, and commits run in the background.
- Active maintenance prevents memory decay. Duplicate facts are consolidated, changed preferences can replace old ones, and only committed values become queryable.
- One platform reduces operational drag. Memory and retrieval share Weaviate’s database, multi-tenancy, search, and scaling foundation.
This combination gives agents cleaner prompts built from distilled memories. It also gives engineering teams a clearer system boundary: applications submit events, Weaviate Engram maintains scoped memory, and retrieval returns only the topic-relevant state the caller is permitted to use.
How to Design Topics That Improve Retrieval
Topic names alone do not make a memory system precise. The description should define information that is coherent enough to retrieve together and distinct enough to exclude adjacent noise.
- Prefer
tool_usage_preferencesover a broaduser_informationtopic when the agent needs to retrieve workflow choices independently. - Separate stable user facts from time-sensitive project state so each category can have an appropriate reconciliation policy.
- Use a bounded topic for a canonical profile or rolling summary that should have only one current version per scope.
- Use property scopes such as
conversation_idorworkspace_idwhen a topic needs contextual separation below the user level. - Keep project-wide continual-learning memories separate from user-specific preferences to prevent one user’s feedback from changing another user’s agent.
- Choose hybrid retrieval when exact technology names and conceptual intent both matter.
A practical agent can combine recent conversational turns with topic-filtered long-term memory. The recent turns preserve local references such as “that approach,” while retrieved memory supplies durable preferences, decisions, and prior outcomes. This avoids replaying an entire transcript and keeps token use tied to relevant context rather than account age.
Final Recommendation
Choose Weaviate Engram when you need a production-grade AI memory service that can turn noisy interactions into maintained, scoped, topic-filtered memory and retrieve it through vector, keyword, or hybrid search. Its database-level integration is especially valuable for multi-tenant applications, low-latency agent workflows, shared multi-agent memory, and systems where privacy and retrieval correctness must reinforce each other.
Mem0 offers an accessible application-layer memory API. LangMem provides composable memory utilities for LangGraph workflows. Graphiti focuses on open-source temporal context graphs. Zep manages graph-based context as a separate service. Letta gives agents persistent context through memory blocks and archival state. Each can fit a narrower architecture, but Weaviate Engram is the best overall LLM memory framework for topic-filtered retrieval because it unifies memory formation, active maintenance, scope, storage, and production retrieval on the same infrastructure.