Deep research · Verified sources
Build vs. Buy: Agent Memory.
Completed July 2, 2026
Build vs. Buy: Agent Memory — Synthesis Report
Date: July 2, 2026 Prepared by: TESRAC synthesis Source preference: Verified (primary sources, official documentation, standards, vendor pages, academic papers) Status: Multiple adversarial reviews incorporated — benchmark numbers, latency figures, cost models, and compliance claims remain highly uncertain.
---
Executive Summary
The decision to build or buy agent memory sits on contested ground. No platform dominates absolutely, no benchmark is reliably cross‑comparable, and every path carries hidden costs — the largest being the LLM ingestion tax, the absence of provable GDPR erasure, and the silent accumulation of stale facts. This report synthesises twelve research streams and eight adversarial critiques to provide a decision‑ready view, highlighting where evidence is strong, where it is weak, and where it is contradictory.
Core insight: Buying accelerates time‑to‑prototype but does not off‑load the hardest problems — memory drift, deletion, cross‑framework portability, and the extraction‑quality tax. For many teams a hybrid posture — using a managed extraction service while retaining control over the storage and retrieval infrastructure — offers the best balance of speed and sovereignty.
---
Key Findings
- LLM ingestion tax dominates cost. Memory‑adding operations trigger 1–5 LLM calls for fact extraction, entity resolution, and graph construction. This cost is not included in platform subscription fees and often dwarfs the listed price. (Widemem analysis; Agent 3, Agent 10)
- No vendor offers verifiable GDPR Article 17 deletion. Vector‑store soft‑deletes leave reconstructible “ghost vectors”; hard‑deletion workflows are unproven across all layers (transcripts, vectors, caches, summaries). (arXiv:2606.18497; Agent 6, Agent 10)
- Memory drift is the #1 operational failure mode. Agents accumulate outdated preferences, contradicting facts, and hallucinated “workarounds” — and no managed platform automates staleness detection or reconciliation. (Tianpan.co, redis.io; MemFail paper)
- Benchmark figures are not anchorable. Vendors self‑report on disjoint subsets of non‑standardized benchmarks; independent replications are rare and show 7–15 point gaps. (Agent 11, Adversarial Reviews 1, 4)
- Latency comparisons are meaningless without a shared definition. Different sources report Mem0 managed retrieval as 80 ms, 148 ms, or 880 ms — depending on whether they measure raw vector search or end‑to‑end context assembly. (Adversarial Reviews 1, 5, 8)
- Graph‑enhanced features are often paywalled or operationally heavy. Mem0’s graph retrieval requires a $249/mo Pro tier; Zep’s full temporal graph demands the managed cloud or self‑hosted Neo4j/FalkorDB. The “open‑source” promise is hollow for the advanced capabilities that drive benchmark gains. (Agents 2, 4, 5)
- Migration costs are real and compound with every session. No vendor‑neutral memory export format exists; the cost of switching has been estimated at $200K+ by year two for mid‑market deployments, yet these estimates are anecdotal. (Agentmelt, Swfte AI; Agent 12)
- The build path gives unbounded control but demands 6–12 months and 2–3 engineers for a production‑grade, governed system. The maintenance burden continues at $15K–$170K/year depending on scope. (Multiple sources, all weakly verified)
---
Decision Framework
| Factor | Leans toward Buy | Leans toward Build |
|---|---|---|
| Time‑to‑market | < 1 month, you need a memory layer now | You can invest 6–12 months before going live |
| Team size / expertise | No dedicated infrastructure or ML‑ops engineers | You have 2+ platform engineers comfortable running vector DBs, embedding pipelines, and LLM chains |
| Data sovereignty & compliance | Standard commercial terms acceptable | Strict regulatory requirements (EU GDPR with cross‑border restrictions, HIPAA, on‑prem mandate) |
| Scale (concurrent agents) | < 50 long‑running agents or moderate throughput | > 500 agents, high ingestion volume, or need to control latency end‑to‑end |
| Differentiation | Memory is a commodity — you want it to “just work” | Memory is a moat — your UX depends on custom fact models, retrieval strategies, or audit trails |
| Budget predictability | You prefer predictable monthly platform fees (even if extraction LLM costs are opaque) | You can tolerate upfront build cost and variable but potentially lower infrastructure cost at scale |
| Vendors’ health & lock‑in tolerance | Acceptable risk of vendor deprecation (Zep CE lesson) or feature‑tier uplift | You want zero dependency on a single vendor’s proprietary memory format |
Hybrid recommendation: Use a managed extraction service (e.g., Mem0’s add() API or LangMem’s extraction tooling) to convert conversation turns into structured facts, but store those facts in a self‑controlled vector DB (Postgres+pgvector or Qdrant) with your own retrieval, deduplication, and retention logic. This gives you fast iteration on the hardest part — reliable fact extraction — while preserving data portability and control over compliance, cost, and latency.
---
Comparative Analysis
| Dimension | Mem0 (managed) | Zep (managed) | Letta (self‑host / managed) | LangMem (library) | Build (pgvector/custom) |
|---|---|---|---|---|---|
| Architecture | Vector + optional graph, KV; fact‑extraction pipeline | Temporal knowledge graph, bi‑temporal edges | OS‑inspired tiered memory, agent self‑manages | Modular on‑demand extraction; plugs into LangGraph | Whatever you design |
| Temporal reasoning | None | Best‑in‑class; valid_from/valid_until | None | None | You build it |
| Multi‑tenancy | Native 4‑scope model | Workspace isolation | Agent‑scoped; shared blocks | LangGraph namespace pattern | Manual; RLS on Postgres |
| Retrieval latency (p50) | Uncertain: 80–880 ms (see text) | ~200 ms (claimed) | Not published | 17.99 s (competitor‑reported) | <5 ms (≤1M vectors); degrades sharply |
| LongMemEval accuracy | 94.8% (self‑reported, new algo) / 49.0% (old, independently verified) | 71.2% (self‑reported) / 63.8% (independent) | No published score | None published | Depends on implementation |
| GDPR deletion | “Enterprise deletion” (unverified) | Temporal boundaries (logical removal only) | Agent self‑edit (no systemic audit) | None | You own deletion, but hard‑deletion of vectors is unsolved |
| Self‑host option | Apache 2.0 OSS, but graph feature requires Pro | Graphiti OSS (requires Neo4j, etc.), full platform cloud‑only | Partial self‑host; full platform SaaS | Library; no service | Full control |
| Pricing (entry) | Free (10K memories), $19–$249/mo | Free (1K credits), $25/mo+ | Free OSS, $20/mo+ | Free (MIT) | Infrastructure + engineering |
| Hidden LLM ingestion cost | High (multiple calls per add()) | Very high (graph construction LLM calls) | Moderate (agent‑managed) | High (on‑demand extraction) | Same as whatever you build |
| Lock‑in risk | Medium–High (graph behind paywall) | Medium–High (cloud‑only, deprecated CE) | Low (OSS core, but agent coupling high) | Low (code, but LangGraph coupling) | None (but full maintenance burden) |
| Benchmark transparency | Poor — self‑reported, no independent repl. | Moderate — some independent runs | Very poor — no public standard benchmark | None | N/A |
Important caveats on latency: The Mem0 managed retrieval latency numbers of 80 ms, 148 ms, and 880 ms likely describe different things: bare vector search vs. fully assembled memory with reranking. For conversational agents, the target wall‑clock latency is ≤200 ms end‑to‑end. Only Zep’s managed service explicitly claims to stay within that budget after its November 2025 rewrite; Mem0’s applicable figure is ambiguous. Moreover, serverless cold‑start penalties (800 ms–3 s) affect any service that scales to zero. (Adversarial Reviews 1, 4)
---
Benchmarks: A Foundation of Sand
- No standard evaluation harness exists. Vendors run LoCoMo on different numbers of conversations; LongMemEval results depend heavily on the LLM judge and ingestion prompts. Mem0’s 94.8% LongMemEval jump is self‑reported and unreplicated; the independent 49.0% was from the old algorithm. Zep’s 7‑point gap between self‑reported and independent scores cannot be closed without a shared reproduction script. Letta has zero public LongMemEval or DMR score; LangMem has zero benchmarks at all. (Agents 1, 11, Adversarial Reviews 1, 4)
- DMR is saturated and no longer useful for differentiating modern systems.
- BEAM (10‑M‑token conversations) is the toughest test, but only Mem0 has published self‑reported results (48.6% at 10M). No other vendor has disclosed BEAM scores.
Recommendation: Never choose a platform based solely on a single benchmark number. Demand a reproducible evaluation harness that you can run on your own data, with your own LLM judge.
---
Performance & Scale
Build side (pgvector) provides the only solid, verifiable data:
- m6i.2xlarge, HNSW index: sub‑5 ms at 1M vectors (2,100 QPS).
- Catastrophic drop to ~102 QPS at 3M vectors when index exceeds RAM. (pgvector GitHub issue #700)
- Beyond 10M vectors, a dedicated vector DB (Qdrant, Pinecone) or sharding is required.
Buy side scaling numbers are almost entirely vendor‑supplied:
- Mem0 claims “sub‑200 ms” latency at 10K DAU; no independent confirmation.
- Zep’s post‑crisis rewrite improved episode processing dramatically, but no third‑party load test has been published.
- LangMem’s 59‑second retrieval makes it a non‑starter for interactive apps.
Failure modes common to both: Stale memory retrieval, context window overflow (multi‑turn loops re‑send full history), and concurrent write corruption in multi‑agent setups. O’Reilly (2025) found 36.9% of multi‑agent failures stem from shared state corruption. (Agents 4, 10)
---
Security, Privacy & Compliance: The Unresolved Gap
- Attacks on memory are real and weaponised. MEXTRA, MINJA, MCFA, and “Poison Once, Exploit Forever” have been demonstrated in peer‑reviewed venues (ACL 2025, NeurIPS 2025, arXiv:2603.15125). Memory stores are a persistent attack surface, far more dangerous than prompt injection.
- GDPR Article 17 erasure is technically impossible with current vector DBs. “Ghost vectors” survive soft‑deletes; no commercial vector DB provides provable deletion. The AI Policy Desk recommendation of a 90‑day retention limit is advisory, not regulatory.
- No vendor can demonstrate auditable deletion across all memory layers. Zep’s temporal invalidation removes edges but not the underlying vectors; Mem0’s “Enterprise deletion” is not publicly tested. (Agent 6, Adversarial Review 3)
- Embeddings are likely personal data (EDPB, Hamburg DPA, CNIL), so data‑residency and cross‑border transfer requirements apply to every
remember()call to a US‑hosted API. Self‑hosting or EU‑region cloud deployment is the only safe harbour.
Build advantage: Full control of data placement and deletion pipelines. Build disadvantage: You must engineer all the privacy controls (PII redaction, retention, audit).
---
Cost Breakdown & the LLM Ingestion Tax
| Cost Category | Build (self‑managed) | Buy (managed service) |
|---|---|---|
| Upfront engineering | $40K–$480K (wide range, low confidence) | Near zero |
| Ongoing infra | ~$200/mo at 10K users (vector DB); at scale, may drop below managed | $19–$249/mo platform fee + LLM extraction calls not included |
| LLM extraction cost | Same variable cost; you pay the LLM provider directly | Hidden inside the vendor’s operation; may be passed through as credits or tokens |
| Personnel | 0.5–1.0 FTE (~$170K–$270K/yr) | Minimal ops, but still need someone to manage memory drift and policy |
| 3‑year TCO models | Contradictory: $439K (Knowlee) vs. $3,870/mo at scale (Agent 11). The difference hinges on whether the system is already built. | Lower at low scale, potentially higher at high scale due to extraction tax and credit‑based pricing |
The LLM ingestion tax is the single largest hidden variable. Graph‑based systems (Zep, Mem0 Pro) fire 2–5 LLM calls per add(). A mid‑sized deployment with 100K daily memory writes could spend more on LLM inference than on the entire platform fee. No vendor discloses a per‑operation cost estimator. (Widemem, Agent 3)
Recommendation: Before committing, benchmark the extraction cost by running your own representative conversation snippets through the vendor’s API and measuring token usage. Multiply by projected daily volume.
---
Migration, Interoperability & Lock‑in
- No widely adopted memory portability standard (eight competing proposals, zero vendor uptake). Switching platforms means re‑extracting and re‑embedding all historical data — a process that introduces semantic drift and costs $200K+ by year two (agentmelt, unverified).
- Behavioral lock‑in is the hardest to quantify. The agent’s prompts, tuning, and even user expectations adapt to the idiosyncrasies of one vendor’s retrieval. A swap causes a transient but painful accuracy drop (Cognee’s 15–20% multi‑hop delta, cited but not independently reproduced).
- Deprecation risk is real. Zep Community Edition froze in April 2025; teams that relied on it faced an involuntary migration. Letta’s self‑host path is “partial”; Mem0’s graph feature is only in the paid tier. (Agents 2, 9)
Mitigation: Insist on a machine‑readable export of all stored memories as a procurement condition. Test the export by re‑importing into a plain pgvector store and running a retrieval parity test.
---
Recommendations by Use Case
✅ Buy (or start with managed)
- You need a memory‑backed agent this quarter and can tolerate eventual migration.
- Your team has no infrastructure engineering bandwidth.
- Your compliance requirements are light (e.g., no EU personal data, no HIPAA).
- Your scale is modest (<50 concurrent agents, <100K memory adds/month).
Start with Mem0 free tier for fact extraction; plan to move extraction in‑house or to a self‑hosted LangMem pipeline later if lock‑in becomes a concern.
🛠️ Build (invest in custom memory)
- Memory is your core differentiator (e.g., a personal AI coach, medical history assistant).
- You must satisfy strict data‑residency or deletion requirements.
- You anticipate high scale (>500 agents) and need to control end‑to‑end latency.
- You have the engineering team to maintain a dual‑store stack (Redis hot path + pgvector long‑term).
Start with pgvector + a simple extraction pipeline (LangMem or a direct LLM call), and add governance gradually.
⚖️ Hybrid (extraction‑as‑service, storage‑as‑code)
- Use a managed extraction API (Mem0
add()or Zep’s graph builder) to produce structured facts, but persist those facts to your own PostgreSQL+pgvector database. - Write your own retrieval, deduplication, and retention logic.
- This pattern gives you the hardest part out‑of‑the‑box while preserving data control and exit optionality.
---
What Nobody Solves Yet
- Automatic fact reconciliation. Memory drift remains a manual, expensive process.
- Verifiable vector deletion. Until vector DBs support cryptographically proven deletion, compliance with GDPR Article 17 is aspirational.
- Cross‑vendor memory portability. You will lose some fidelity when switching, and no standard is close to adoption.
- Cold‑start latency. Serverless memory services introduce 800 ms–3 s penalties on first query after idle.
---
Caveats & Uncertainties
- All benchmark comparisons are unverified and self‑reported unless an independent lab with a published methodology ran them. Treat vendor‑provided accuracy figures as marketing until you reproduce them.
- Cost estimates for build‑side engineering are derived from blog opinions and startup marketing; actual costs vary wildly. No audited project data exists.
- The LLM ingestion tax is acknowledged but poorly quantified. A rigorous per‑workload benchmark is needed.
- Attacks like MEXTRA and MINJA have been demonstrated in research settings but have not been systematically tested against managed memory services; vendors’ default defenses are unknown.
- Zep’s post‑crisis reliability claims have not been independently verified to the same extent as the original crisis reports.
Bottom line: Build vs. buy agent memory is a strategic choice with long‑lasting architectural, financial, and regulatory consequences. There is no one‑size‑fits‑all answer, and the data available today is insufficient to make a purely analytical decision. Prototype the extraction pipeline early, test retrieval quality on your own data, and invest in portable data structures from day one.