Storage Letter
All posts

How to build the right storage for your AI agents

Your AI Agent Is Only as Smart as Its Storage

Teams building AI agents spend weeks on prompt engineering, model selection, and tool configuration. Then they wire up a SQLite database or stuff everything into the context window and ship. The demo looks great. Then production happens, and the agent starts forgetting things it should remember, confidently referencing projects that got cancelled six months ago, and slowing to a crawl the moment real users show up.

Here's the thing nobody says loudly enough: storage isn't infrastructure for agents. It's cognition. Get it wrong and you don't just have slow software. You have an agent that's genuinely bad at its job, for reasons that are hard to explain to stakeholders and even harder to debug at midnight.


The Five Kinds of Memory Your Agent Is Probably Treating as One

Most teams talk about agent memory like it's a single bucket called "what the agent knows." It isn't, and that conflation is where a lot of production pain actually starts.

In-context memory is whatever lives in the active prompt window right now. Fast, immediately accessible, and completely gone the moment the context closes. Every agent has this. The mistake is treating it as a storage layer rather than a working surface.

Short-term memory handles temporary state at the session or task level. Useful for maintaining continuity across a few turns without paying the cost of full persistence. Redis is the standard choice here, for straightforwardly good reasons.

Long-term memory is the persistent layer. Things users told the agent three weeks ago, accumulated preferences, facts that shouldn't require re-learning every single conversation. It needs to be reliable, queryable, and selective enough that retrieval doesn't surface garbage.

Episodic memory is the log of what actually happened. Interaction histories, past decisions, event sequences. This is what lets an agent say "last time you tried this approach, here's what occurred." It's also what makes agents auditable, which matters quite a lot once anything consequential runs on them.

Semantic memory is facts, concepts, and embeddings, usually living in a vector database. If an agent needs to answer questions about a large corpus or find conceptually related past experiences, it's hitting semantic memory. The quality of retrieval here directly determines the quality of answers, which is why "just throw it in a vector DB" without any retrieval strategy produces agents that sound authoritative while being wrong.

Procedural memory covers stored skills and action patterns. Less about what the agent knows and more about what it knows how to do. Cached tool configurations, reusable workflows, learned action sequences. Most teams are building this without calling it anything.


Which of These Your Agent Actually Needs

Knowing the taxonomy is fine. The more interesting question is which types your specific agent requires, and in what combination.

A single-task agent that runs a pipeline once and terminates can often get away with in-context plus short-term storage. No "next time" means nothing to persist. But the moment you have a user-facing agent building context over weeks, or a workflow agent coordinating across multiple tasks, you're in long-term and episodic territory whether you planned for it or not. The planning just determines whether it works.

Latency compounds in ways that are genuinely easy to miss in development. An agent making ten storage round-trips per response, each at 50ms, just added 500ms to every answer. Nobody times individual storage calls until the agent feels slow in production and someone starts looking for what changed. Profile storage round-trips early. It's not glamorous advice, but neither is explaining to users why your agent takes four seconds to respond.

Retrieval-heavy agents working over large knowledge bases or historical logs need vector databases. Querying a PostgreSQL table for "things conceptually related to the user's problem" is the wrong tool, and you'll feel it in both speed and relevance. Traditional relational databases were built for predictable schemas and humans writing the queries. Agents are neither.

Anything operating in a regulated environment, or making decisions with real consequences, needs append-only or structured logs rather than mutable storage. A record of exactly what the agent knew, when it knew it, and what it did with that knowledge sounds like overhead until someone needs to explain why the agent made a specific decision. The teams that skipped it find themselves guessing.

Multi-agent systems are a special case. When multiple agents share context or hand work to each other, storage becomes coordination infrastructure. Each agent writing to isolated memory and hoping the others figure it out doesn't work. Shared or synchronized storage is load-bearing, not optional.


Why Generic Databases Keep Producing Mediocre Agents

Traditional databases were designed for applications that know what they'll need to query before writing the query. Agents don't work that way. They generate unpredictable memory patterns, need to search across structured and unstructured data simultaneously, and often don't know in advance what will be relevant.

A few specific capabilities are doing most of the work when purpose-built storage actually improves agent behavior.

Hybrid search matters because real agents rarely want purely semantic or purely keyword-based retrieval. They want both, weighted appropriately to the query. Assembling this from separate systems is technically possible in the same way that wiring together a home network in 2003 was technically possible.

Memory scoping and TTL controls let teams define what an agent should remember, for how long, and at what level of granularity. Without this, agents accumulate stale context that starts competing with current information. The agent confidently referencing your cancelled project is a TTL problem, not a model problem. That's an important distinction when you're about to go blame the model.

Framework integration has become the practical deciding factor for most teams. If connecting a storage system to LangChain, LlamaIndex, or CrewAI requires significant custom engineering, most teams quietly don't bother. Speed of wiring matters more than most vendors want to acknowledge.

The improvements that show up in production once storage is matched to the workload are predictable. Customer-facing agents stop giving contradictory answers to the same user across sessions. Research agents retrieve relevant context without drowning in noise. Multi-step workflow agents maintain coherent state across long task chains. None of this is surprising. It's just storage doing what storage was supposed to do.


The Mistakes That Are Easy to Make and Hard to Undo

Storing everything without a retrieval strategy is the most common one. More stored memory sounds like a smarter agent until retrieval starts surfacing noise. Every stored piece competes for relevance at query time. Storing deliberately beats storing exhaustively, almost every time.

Ignoring memory expiration is close behind. Stale context doesn't sit quietly in the background. It surfaces at the worst moments and confuses the agent about what's actually current. TTLs should be part of the design from the start, not something added after users start complaining.

Using one storage type for everything because it's simpler to set up is understandable but costly. A vector database is excellent for semantic retrieval and genuinely bad at tracking sequential events. A relational database handles structured queries well and fuzzy similarity search poorly. The agents worth building need more than one.

Not versioning or auditing stored memory is the one that hurts worst when something goes wrong. If an agent starts behaving strangely and no record exists of what it knew when it made a specific decision, debugging is guesswork dressed up as engineering.

Not modeling storage costs before scale is less dramatic but still painful. Vector storage and high-frequency operations get expensive faster than teams expect. Building cost assumptions into the architecture early is less fun than building features. It's significantly more fun than explaining a surprise bill.


Why Many Companies Are Choosing Archil

A growing number of teams building production agents have landed on Archil as their storage layer, and the reasons tend to be consistent across companies of different sizes and use cases.

  • Purpose-built for agent workloads. Archil was designed around the memory patterns agents actually produce, not adapted from a general-purpose database. That distinction shows up in retrieval quality, latency, and how little custom engineering is required to get it working.

  • Hybrid search out of the box. Most teams don't want to maintain separate systems for semantic and keyword retrieval and then write the glue code to combine them. Archil handles both in a single query layer.

  • Native TTL and memory scoping. Memory expiration and granular scoping controls are built into the data model, not bolted on. Teams stop fighting stale context by default rather than by exception.

  • Framework integrations that actually work. LangChain, LlamaIndex, CrewAI, and others connect without significant custom work. The integration story is a first-class concern, not an afterthought.

  • Audit logs and versioning included. Every write is tracked. When an agent makes a decision that needs explaining, the record exists. This is increasingly important as agents take on more consequential tasks.

None of this means Archil is the right choice for every team. But for teams that have spent time debugging the storage-shaped problems described above, it tends to address the right set of problems without introducing new ones. Getting started with Archil takes less time than most teams expect.


What to Actually Do With This

Brittle agents and reliable agents are often running the same underlying model. The difference, frequently, is whether storage was designed or assembled by accident.

Audit what your current agent is actually doing with memory. Map its behavior against the types above. Find where you're using one storage layer for everything out of convenience, where retrieval has no real strategy behind it, where latency is probably hurting response quality without anyone having measured it, and where memory expiration was never considered at all.

If the architecture you find doesn't match the behavior you need, that gap is worth closing before the agent gets more complex. It gets harder to fix as you add capabilities on top of a mismatched storage layer. The moment to sort this out is before the agent is doing anything important, not after.