What is agent memory?
Agent memory is the information an AI agent stores and reads back so it does not start from nothing on each turn. It covers the task in progress, held in the context window, and what should last across sessions, held in a store the agent writes to and recalls from.
Why does an AI agent need memory?
A language model on its own is stateless. It answers the prompt in front of it and keeps nothing once the turn ends. Agent memory is the machinery around the model that carries information forward: it decides what to save, where to put it, and what to hand back to the model on the next turn.
Without it, an agent asks the same question twice, loses the thread halfway through a multi-step task, and greets a returning customer as a stranger. Storing things is the easy part. The hard part is choosing what is worth keeping and pulling back only the few items that matter for the turn at hand, because everything the agent reads costs tokens and attention.
What are the types of agent memory?
Most descriptions borrow four types from cognitive science, a split set out for language agents in the CoALA paper:
- Working memory. The task in progress: the conversation so far, tool results, the plan. It lives in the context window and is discarded when the task ends.
- Episodic memory. Records of past interactions, such as what happened in last month’s support chat and how it was resolved.
- Semantic memory. Facts the agent has learned and should keep, such as a customer’s preferred delivery address or the plan they are on.
- Procedural memory. How the agent should behave: its instructions, and rules it has refined from experience.
Working memory is short-term. The other three are long-term, because they outlive the session. Short-term vs long-term agent memory covers that split and why most agents need both.
How do agents write and recall memory?
Writing happens in one of two places. In the hot path, the agent itself decides mid-conversation that something is worth saving and calls a memory tool. In the background, a separate process reads finished conversations and extracts facts from them, so the agent’s own turns stay fast. Some tools offer both.
Reading also takes two forms. Some memory is pinned: always placed in the prompt, like a short profile of the user. The rest is retrieved: the agent or your code searches the store by meaning and adds the top matches to the prompt. A few tools assemble the retrieved pieces into one block of text ready to drop into a system prompt.
In both directions the source is the same for most memory tools. What gets written is drawn from the conversation and from documents you add. That shapes what the agent can remember, and it comes up again below.
What are the best agent memory tools?
The best tool depends on what you want the agent to remember. The table compares common options by what each stores, how memory gets in, how the agent reads it, and where it runs. Each row is taken from the tool’s own documentation, linked in the first column.
| Tool | What it stores | How it is written | How it is read | Hosting |
|---|---|---|---|---|
| Mem0 | Facts distilled from conversations, linked by entity and scoped to a user, agent or run | Extracted from the messages you send it | Search returns the most relevant memories for a query | Managed platform, or open source and self-hosted |
| Zep | A temporal graph per user: facts, their relationships and when they changed | Ingested from conversation messages and from business data you add | An assembled context block, or graph search | Zep Cloud; its open-source graph engine, Graphiti, to self-host |
| Letta | Memory blocks pinned to the agent’s prompt, plus a searchable archival store | The agent edits its own blocks and inserts archival entries through memory tools | Blocks are always in context; archival entries by semantic search | Letta’s hosted service or a self-hosted deployment |
| LangMem | Semantic facts, user profiles, episodic memories and refined prompts | By the agent through tools, or by a background manager that extracts from conversations | A search tool over a LangGraph store | A Python library; storage is the LangGraph store you configure, such as Postgres |
| Cognee | A knowledge graph built from documents and other data you add | Raw input is split into chunks, entities and concepts | Queries over the graph | Open source, or Cognee Cloud |
| Signals | Attributes and recent activity per customer or session | Computed from the customer’s behavioral events as they arrive | Attributes, or an agentic context as JSON or narrative, through an SDK, REST API or MCP server | Managed SaaS, or a private deployment in your own AWS or GCP account |
The first five are recall tools. They differ in structure (flat facts, a temporal graph, blocks the agent edits) and in who decides what to write, but they share a source: what was said to the agent and what you gave it to read. LangMem is the one that also covers procedural memory, by refining the agent’s prompt over time.
Signals sits on a different row because its input is different. It is one option for behavioral memory, and it runs beside a recall tool, not instead of one.
What is the difference between conversational recall and behavioral memory?
Conversational recall is memory of what the user said: preferences they stated, problems they described, decisions they made in a chat. It is extracted from text, usually by a model, and it is only as complete as what the user chose to type.
Behavioral memory is memory of what the user did: the pages they viewed, the searches that failed, the items they compared, the step where they stopped. It is computed from events your product records, so it includes the things a customer would not think to mention. It also stays current during the session, because each new event updates it.
The two answer different questions. Recall tells the agent who this person is and what they asked for before. Behavioral memory tells it what they are in the middle of now. For a customer-facing agent the second often explains the first message of the conversation, which is why agentic context usually draws on both: a recall query for history and the live session for the present.
Example: a support agent with both kinds of memory
A customer of an online store contacted support last month about a damaged parcel. In that chat they said they would rather have a refund than a replacement if it ever happened again. A recall tool extracted that preference and stored it against their user id.
Today the same customer opens the order tracking page for one order four times in ten minutes, then opens chat and types “where is it?”
With recall alone, the agent knows the refund preference but not which order “it” is, so it asks. With behavioral memory as well, it can see the repeated visits to one tracking page and the order number in that page’s address. It can open with that order’s status and, if the parcel is lost, offer the refund the customer asked for last time.
In Signals, the behavioral half is an attribute, a value computed from events about one key, here the session. This definition counts views of the tracking page in the current visit:
from snowplow_signals import (
Attribute, AtomicProperty, Criteria, Criterion, Event, StreamAttributeGroup, domain_sessionid,
)
page_view = Event(name="page_view", vendor="com.snowplowanalytics.snowplow", version="1-0-0")
on_tracking = Criteria(all=[
Criterion.like(AtomicProperty(name="page_url"), "%/orders/%/track%"),
])
tracking_views_session = Attribute(
name="tracking_views_session",
type="int32",
events=[page_view],
aggregation="counter",
criteria=on_tracking,
default_value=0,
)
shop_support_tracking = StreamAttributeGroup(
name="shop_support_tracking",
version=1,
attribute_key=domain_sessionid,
owner="you@example.com",
attributes=[tracking_views_session],
)
When the chat opens, the agent’s code reads the group for this session and gets a value such as
tracking_views_session: 4. The refund preference comes from the recall tool. The agent’s prompt
gets both, and the model decides what to say.
What agent memory does not do on its own
Memory supplies inputs. It does not decide which ones are relevant to a given turn, and a store that returns too much is as unhelpful as one that returns nothing. Deciding what the agent reads, and in what shape, is the job of context engineering.
Recall tools also inherit the limits of their source. A customer who never mentions a problem in chat leaves nothing to extract. Behavioral memory has the opposite limit: it knows what someone did, not why, until they say so. That is the case for running the two side by side.
See it on your own traffic
Add the SDK, define one attribute, and see an attribute updating against your own traffic in the first session. The free tier runs on the real engine: no card, no sales call.