THE INDEPENDENT RECORD · AGENTIC AI AS A SERVICE AboutStandardsContact
GAASAGENTIC AI · AS A SERVICE
INDEPENDENT · SINCE 2026
UPDATED DAILY
NO HYPE · NO PAY-TO-PLAY
PER-TASK PRICING NOW STANDARD ● NEW BENCHMARK: 71% TASK COMPLETION ● ENTERPRISE PILOTS UP 4X ● RUNTIME FUNDING ACCELERATES ● "AGENTS ARE THE NEW SEATS" ● MARGINS UNDER PRESSURE ● THE INDEPENDENT RECORD ON GAAS
Infrastructure

Memory Systems for Agents: The Architecture Options That Actually Matter

Most "agent memory" is just a vector database bolted onto a prompt, and it shows. A real memory system is a stack of distinct components, working context, episodic recall, semantic facts, procedural skills, and the write path that decides what's worth keeping. This guide walks the architecture options node by node, explains where each one earns its cost, and flags the design choices that quietly determine whether your agent feels like it learned anything. If you're pricing or operating agents-as-a-service, memory is also where a surprising share of your token bill and your reliability problems live.

By L. Karlsson · Feb 13, 2026 · 13 min read

Table of Contents

Why Memory Is Suddenly the Hard Part

For a long time, "memory" in an LLM app meant stuffing the last ten messages back into the prompt. That worked because the jobs were small: answer a question, write a paragraph, done. The moment you sell an agent as a service, something that runs a multi-step workflow, comes back tomorrow, and is supposed to know things about the account it's working, the naive approach falls apart in two directions at once. Either you keep cramming history into context until the bill balloons and the model starts ignoring the middle of its own prompt, or you drop history and the agent reintroduces itself to the same customer for the fourth time.

That tension is the whole subject. Memory in agentic systems isn't one feature; it's a set of architectural decisions about what to keep, in what shape, where it lives, and how it gets back into the model's attention at the right moment. Get those decisions right and the agent compounds, it gets more useful per interaction. Get them wrong and you've built an expensive goldfish.

There's an economic edge to this in the GaaS world specifically. When you charge per task or per outcome, every token an agent reads is margin you don't keep. Memory architecture is one of the few levers that moves both quality and unit cost in the same direction, a tighter memory system retrieves less junk, spends fewer tokens, and answers better. That's rare, and it's why this is worth getting right rather than defaulting to "we'll add a vector store."

The Five Layers of Agent Memory

The most useful mental model borrows from cognitive science, and not just as a metaphor, the categories map cleanly onto different storage and retrieval needs. Anthropic's own guidance on building effective agents makes a related point: complexity should be added only where it buys something. Memory is the clearest case of that principle, because each layer below has a real cost and a real payoff, and most agents need only some of them.

Working Memory: The Context Window Is Not Free

Working memory is what's in the context window right now, the system prompt, the current task, recent turns, and whatever you've just retrieved. It's the fastest memory you have and the only kind the model can actually reason over directly. It's also the most expensive per token and the most fragile: models exhibit a well-documented "lost in the middle" effect where information buried in a long context gets ignored, a behavior characterized in Liu et al.'s research on long-context language models.

The architecture question here isn't "how big a window can I afford", it's "what discipline governs what enters the window." The good designs treat working memory as a scratchpad with eviction: summarize older turns into a compact running state, keep the live task verbatim, and pull longer-term memories in only when a step needs them. The bad designs treat the window as a junk drawer and wonder why the agent forgets the instruction you gave it three steps ago. This is tightly coupled to token-budget management at runtime, which the cluster covers in its own right.

Episodic Memory: What Happened Last Tuesday

Episodic memory is the log of specific past interactions, this user asked for X, the agent did Y, the outcome was Z. It's stored verbatim or near-verbatim and keyed by time and entity. This is what lets an agent say "last time you imported a CSV it failed on the date column, want me to handle that the same way?"

Architecturally, episodic memory is usually an append-only store, sometimes a plain relational table, sometimes a vector index over conversation chunks, often both. The trap is treating every episode as equally worth retrieving. Raw transcripts are noisy; an agent that retrieves the full text of last week's chat spends a fortune to recall three relevant sentences. The better pattern compresses episodes into summaries at write time and keeps the raw log available only for audit or deep recall.

Semantic Memory: Facts, Not Transcripts

Semantic memory holds distilled, durable facts decoupled from the conversation that produced them: "the customer's billing contact is Dana," "this account is on the enterprise plan," "they prefer metric units." Unlike episodic memory, you don't care when or how you learned it, you just want it true and retrievable.

This is where structured storage earns its keep. A key-value or graph representation of facts is far cheaper to query and far less ambiguous than searching transcripts hoping the fact surfaces. Many of the more capable agent memory systems, the approach popularized by tools like Mem0 and the memory modules in the larger orchestration frameworks, are essentially semantic-memory extractors: they read conversations and write back clean fact triples. The privacy implications of holding durable user facts are real and deserve their own treatment, which the beat handles separately.

Procedural Memory: Remembering How

The least discussed and arguably highest-leverage layer. Procedural memory is the agent remembering how to do things, the successful tool sequence for a task, the prompt that worked, the workflow shape that didn't blow up. In practice this shows up as cached plans, learned tool-call recipes, and few-shot examples assembled from past successes.

Most teams don't build this deliberately, and it's a missed opportunity. An agent that records "for this class of request, this five-step sequence works" and replays it is both cheaper (less reasoning from scratch) and more reliable (proven path). It's the closest thing agents have to getting better at their job over time without retraining the model.

The Storage Backends and What They're Good At

Once you've decided which layers you need, you choose where they live, and this is where a lot of well-intentioned designs go wrong by reaching for a single backend to do everything.

Vector databases (Pinecone, Weaviate, pgvector, Qdrant) are the default reflex, and they're genuinely good at one thing: fuzzy semantic recall over unstructured text. If the query is "find me past conversations that feel related to this," a vector index is the right tool. But vectors are a poor home for exact facts, "what plan is this customer on" should never be a similarity search, because similarity search has no notion of correct, only close. Whether you even need a dedicated vector store is a live debate the cluster takes up directly.

Relational and key-value stores are the unglamorous workhorses for semantic memory and structured state. When a fact has a definite answer, store it as a row or a key and read it back deterministically. This is faster, cheaper, and auditable in a way vector recall never is.

Graph stores shine when relationships matter, who reports to whom, which invoice belongs to which contract, how entities connect. A graph-backed memory can answer multi-hop questions ("which of this customer's teammates also reported the bug") that a flat store can't reach without expensive joins or hopeful retrieval.

The mature pattern is a hybrid: structured stores for facts and state, a vector index for fuzzy episodic recall, and a routing layer that knows which to query for a given need. Single-backend memory systems are usually a sign the team optimized for "easy to stand up" over "good to operate." That hybrid mirrors a broader shift; McKinsey's analysis of the agentic AI shift in enterprise software frames these systems as composed services rather than single models, and memory is one of the clearest places that composition becomes load-bearing.

The Write Path Is Where Architectures Live or Die

Here's the thing almost every "add memory to your agent" tutorial skips: deciding what to write is harder and more consequential than deciding what to read. Retrieval gets all the attention; the write path is where memory systems actually differentiate.

Consider the options. The laziest is write-everything: dump every turn into storage and sort it out at retrieval. It's simple and it's a slow-motion disaster, your store fills with noise, retrieval quality degrades as the haystack grows, and costs climb on both ends. The opposite extreme, write-nothing-automatic and require explicit "remember this" commands, is reliable but pushes work onto the user and misses most of what's worth keeping.

The interesting designs sit in between and make the write path an active, reasoned step. After an interaction, a lightweight pass decides: is there a durable fact here worth extracting? Did a procedure succeed in a way worth caching? Should this episode be summarized and the raw text discarded? This "reflection" or "consolidation" step, sometimes run by a cheaper model to keep costs down, is what separates a memory system that compounds from one that just accumulates.

Two write-path decisions deserve explicit attention. Conflict resolution: when a new fact contradicts a stored one ("the billing contact is now Sam, not Dana"), does the system overwrite, version, or flag? Naive systems silently keep both and retrieve whichever the vector search prefers, which is how agents end up confidently wrong. Forgetting: memory that only grows is memory that gets slower, costlier, and staler. Deliberate decay, TTLs on episodic entries, demotion of unused facts, periodic re-consolidation, is a feature, not an afterthought, and almost nobody builds it until the store is already a problem.

Retrieval: The Other Half Nobody Budgets For

Retrieval is the read path, and the common failure is treating it as a solved problem because "we have embeddings." Plain top-k vector search, grab the five most similar chunks, paste them in, is the baseline, and for a lot of agent work it underperforms badly. It retrieves things that are topically similar but not actually useful, it has no sense of recency or importance, and it can't answer questions that require connecting two facts neither of which is individually a strong match for the query.

Better retrieval layers in several signals. Recency weighting so that what happened recently outranks an old near-match. Importance scoring so a flagged critical fact beats a casual mention. Hybrid search combining keyword and vector so exact terms aren't lost in the fuzz. And increasingly, an agentic retrieval step where the model itself decides what to look for and issues targeted queries rather than relying on one similarity sweep, a meaningful step beyond basic RAG that the cluster explores on its own.

The operational point for GaaS builders: retrieval quality and token cost are the same dial viewed from two sides. Precise retrieval pulls fewer, better chunks, cheaper context and a better answer. Sloppy retrieval pulls more junk to compensate, inflating cost and degrading quality at once. Budgeting retrieval as carefully as you budget generation is one of the highest-return things an agent operator can do.

Picking an Architecture by Workload

There's no universal right answer, which is exactly why so many teams over- or under-build. A rough guide:

The honest meta-advice: start one layer simpler than you think you need, instrument what the agent forgets or gets wrong, and add the next layer in response to observed failures rather than anticipated ones. Memory systems are easy to over-engineer and the cost of doing so is paid on every single request.

Insights Most People Overlook

The write path, not the vector database, is the real product. Everyone shops for retrieval infrastructure; almost nobody invests in the reasoning step that decides what's worth remembering. Two agents on identical vector stores can have wildly different memory quality based entirely on their consolidation logic. If you're evaluating a memory vendor, ask how they decide what to write, not how fast they search, the second is a commodity and the first is the whole game.

Forgetting is a feature you have to build, and its absence is a time bomb. A memory store that only grows degrades on every axis, slower, costlier, staler, more contradictory, and the degradation is gradual enough that nobody notices until retrieval quality has quietly collapsed. The teams who ship memory and walk away are the ones who get paged six months later wondering why the agent got dumber.

Semantic facts should almost never be a similarity search. The reflexive "everything goes in the vector DB" instinct is actively harmful for durable facts, because similarity has no concept of correctness. "What plan is this customer on" has one right answer and retrieving the most similar stored statement is a great way to return last quarter's plan. The discipline of routing exact facts to deterministic storage is unglamorous and quietly fixes a whole class of confidently-wrong failures.

Procedural memory is the cheapest reliability win nobody takes. Caching proven tool sequences for recurring task types reduces both cost (less from-scratch reasoning) and variance (proven paths fail less). It's underbuilt mostly because it's less obvious than "store the conversation," not because it's hard, and in per-outcome GaaS pricing, where reliability is the product, it's arguably the highest-ROI layer.

Memory architecture is a pricing decision in disguise. In per-task and per-outcome models, every retrieved token is margin. A memory system tuned for precision rather than recall doesn't just answer better, it directly widens your margin on every call. Teams that treat memory as purely an engineering concern miss that it's one of the few design choices sitting squarely on the revenue line.

References

#agent memory architecture

More in Infrastructure