Published 2 December 2026. Every framework detail below was read from that framework's own documentation on 2 December 2026.
Every major agent framework now ships some form of memory, and no two of them store it the same way. A LangGraph store keeps JSON items under a tuple namespace, CrewAI keeps records in LanceDB under a path-like scope tree, Mastra keys memory to a resource and a thread, Google ADK keys it to an app name and a user ID, and Pydantic AI Harness writes Markdown files under a namespace and an agent name. Inside one framework, that memory is usually good enough. The moment a second framework, a migration or a per-user deletion request enters the picture, the format becomes the problem, because nothing one framework wrote can be read by another without code you have to write and maintain.
The short answer to "which agent framework has built-in memory": LangGraph, CrewAI, Mastra, Google ADK and Microsoft Agent Framework ship a store meant to outlive one conversation, LlamaIndex ships session memory with long-term blocks, Pydantic AI ships memory in its separate Harness package, and the OpenAI Agents SDK documents sessions, which are per-conversation history rather than a store of facts about a user. Most of them default to storage that disappears when the process ends.
What each framework persists, at what scope, and where
The table compresses what each framework's documentation says today. The two columns that matter most for production are the scope key, because it decides who sees what, and the default store, because a default that lives in RAM is a demo setting.
| Framework | Run or conversation layer | Cross-conversation memory | Scope key | Default storage | Retrieval |
|---|---|---|---|---|---|
| LangGraph | Checkpointer saves graph state per thread_id | Store: key-value items any thread can read | Tuple namespace, for example (user_id, "memories") | InMemorySaver and InMemoryStore (RAM) | Semantic only if you configure an embedding index |
| CrewAI | No separate layer on the memory page | Memory class replacing short-term, long-term, entity and external memory | Hierarchical paths such as /project/alpha | LanceDB at ./.crewai/memory | Weighted mix of similarity, recency and importance |
| Mastra | Message history per thread, on by default | Working memory, semantic recall, observational memory | resource (user or entity) and thread | None named; a storage provider is required | Semantic recall across threads |
| Google ADK | Session (events and state) | MemoryService | app_name and user_id | InMemoryMemoryService, lost on restart | Keyword (in-memory) or semantic (Vertex AI services) |
| OpenAI Agents SDK | Sessions store conversation history | Not documented on the sessions page | session_id | SQLiteSession in memory unless you give a file path | Replays history |
| Microsoft Agent Framework | AgentSession, history providers, workflow checkpoints | Context providers, including Foundry managed memory | Session; scope on the Foundry provider | InMemoryHistoryProvider (Python) | Depends on provider |
| LlamaIndex | Memory short-term FIFO queue | Memory blocks: static, fact extraction, vector | session_id | In-memory SQLite | Vector block if configured |
| Pydantic AI | message_history you pass in and store | Harness Memory: Markdown notebook | Namespace plus agent name | InMemoryMemoryStore, process lifetime | Literal text, no semantic ranking |
LangGraph: checkpointers for the thread, a store for everything else
LangGraph splits the two layers cleanly. A checkpointer saves graph state snapshots for one thread, selected by the thread_id in the config, which is what gives you resume, human-in-the-loop pauses, time travel and fault tolerance. InMemorySaver keeps those checkpoints in RAM and loses them on restart; the docs point to SqliteSaver for local development and PostgresSaver for production. Long-term memory goes in a store, which holds key-value items under a tuple namespace such as (user_id, "memories"), and a search on ("alice",) also matches ("alice", "memories") because search works on namespace prefixes. Semantic search only exists if you configure the store with an embedding model, dimensions and the fields to embed. Production stores listed in the docs are PostgresStore, MongoDBStore, RedisStore and UpstashStore, and nodes or your application code decide what gets written. LangGraph gives you the drawer; it does not decide what goes in it.
CrewAI: one memory class with built-in ranking
CrewAI now has a single Memory class that replaces its older short-term, long-term, entity and external memory types. Records sit in a hierarchical scope tree such as /project/alpha, and recall ranks results by a weighted sum the docs spell out: semantic similarity at 0.5, recency at 0.3 with a 30-day half-life, and importance at 0.2. The default backend is LanceDB in ./.crewai/memory, which you can move with CREWAI_STORAGE_DIR or replace through the StorageBackend protocol (the docs name a MongoDB backend). With memory=True on a crew, every agent shares the crew's memory unless it has its own, and memory.reset(scope="/project/old") clears one branch. CrewAI is the framework that does the most memory work for you, and it is also the one whose records are most tied to its own ranking formula.
Mastra: resource and thread, and an adapter you must choose
Mastra memory offers message history (on by default), working memory for structured facts such as names, preferences and goals, semantic recall, and observational memory, where background agents compress older messages into observations. Every call carries a resource (a stable user or entity ID, which persists memory across threads) and a thread (one conversation). Working memory and semantic recall default to resource scope; observational memory defaults to thread scope. Mastra names no default store and says memory requires a storage provider; its storage page lists more than twenty, including libSQL, PostgreSQL and MongoDB, and recommends a transactional database. One line in the docs deserves attention before production: observational memory needs an adapter that supports it, "and with any other adapter it turns off without a warning."
Google ADK: sessions for the conversation, MemoryService for the user
ADK separates a session from long-term memory. The MemoryService has three Python implementations: InMemoryMemoryService keeps full conversations with keyword matching and loses everything on restart; VertexAiMemoryBankService is managed on Google Cloud's Agent Platform, uses an LLM to extract and consolidate memories and searches semantically; VertexAiRagMemoryService stores conversations in Knowledge Engine with vector search. You write with add_session_to_memory, add_events_to_memory or add_memory (the docs warn the last two are not implemented by every service), and calls carry app_name and user_id. Agents read through the load_memory tool or preload_memory at the start of each turn. In other words, durable ADK memory out of the box means Google Cloud.
OpenAI Agents SDK: sessions, which are history
Sessions store a conversation's items (user input, assistant responses, tool calls) under a session ID and replay them on the next run. SQLiteSession("user_123") with no path is in memory and "lost when process ends"; with a file path it persists. The SDK ships Redis, SQLAlchemy, MongoDB, Dapr and server-side OpenAIConversationsSession options, plus wrappers for compaction and encryption. Two points matter for design. The sessions page describes conversation history, not a separate store of facts about a user, so remembering that a customer moved to Berlin three conversations ago is your job. And the docs state plainly that "the session ID does not authenticate a user": your application has to check who may load which session.
Microsoft Agent Framework: providers, sessions and workflow checkpoints
Microsoft Agent Framework handles memory through providers. In Python, HistoryProvider and ContextProvider implementations do the work, and InMemoryHistoryProvider is the built-in local one; in .NET, history goes to an InMemoryChatHistoryProvider or to the underlying AI service, depending on what that service needs. For long-term memory the getting-started guide shows FoundryMemoryProvider, Microsoft Foundry's managed semantic memory, configured with a memory store name and a scope such as a user ID. Sessions serialize to a dictionary or JSON and resume later, and the docs warn that OpenAI Responses and Conversations IDs are scoped to the API key or project by default, so a hosted agent serving several users should store those IDs server-side and verify the user or tenant before resuming. Workflows add checkpoints at the end of each superstep, stored in memory, on local disk or in Azure Cosmos DB, and Microsoft calls checkpoint storage "a trust boundary."
If you still run AutoGen, the AutoGen repository now carries the banner "Project archived and no longer maintained," states that Microsoft is not providing bug fixes, security fixes, new features or support, and calls Agent Framework "the enterprise-ready successor to AutoGen." Teams still on AutoGen have a framework migration ahead, and any memory tied to AutoGen moves with it.
LlamaIndex: a token-budgeted queue with long-term blocks
LlamaIndex's Memory class keeps a FIFO queue of messages per session_id under a token_limit (30,000 by default) and flushes the oldest messages, 3,000 tokens at a time by default, into long-term memory blocks: a static block that is always included, a fact extraction block capped by max_facts, and a vector block that needs a vector store and an embedding model. The default store is an in-memory SQLite database; pass async_database_uri for a remote one. The older ChatMemoryBuffer is deprecated.
Pydantic AI: no store in core, a Markdown notebook in Harness
Pydantic AI core keeps nothing between runs. You pass prior messages through message_history and store them yourself, or implement a ConversationStore. Long-term memory comes from the separate Pydantic AI Harness Memory capability: a Markdown notebook (MEMORY.md plus focused files) that the agent edits through write_memory, read_memory, delete_memory and search_memory tools, stored at {namespace}/{agent_name}/{file}. The default store lasts for the process lifetime; file, SQLite, PostgreSQL and Pixeltable stores persist. Search is literal text, and the docs say "Semantic ranking is not built in." They also say namespace isolation is not an authorization system.
What every framework keeps for you, and what none of them settle
Read side by side, the docs show a pattern. Each framework does a good job of the layer it was built for: resuming a run, replaying a conversation, keeping a workflow's pending approvals. That layer, the checkpoint or session, belongs inside the framework, and you should keep it there whatever else you decide (we went through that split in agent state vs agent memory).
The cross-conversation layer is where they diverge, and four questions stay open in every one of them:
- Whose memory is this? The scope key is a label your code supplies: a namespace tuple, a scope path, a resource ID, a
user_id. The OpenAI docs say the session ID does not authenticate a user, and the Pydantic AI Harness docs say namespace isolation is not an authorization system. In all eight, your code supplies the key and has to enforce who may use it. - What happens when a fact changes? CrewAI ranks by recency and Vertex AI Memory Bank consolidates with an LLM; LangGraph, Pydantic AI Harness and LlamaIndex's static block store what you or the agent write. Handling "used to live in Pune, now lives in Berlin" is mostly left to you.
- How do you forget one person? CrewAI resets a scope branch, Pydantic AI deletes a file, LangGraph stores implement delete. Each works inside its own store and nowhere else.
- Who else can read it? No framework reads another's format.
When the framework's own memory is enough
Keep memory inside the framework when all of these hold: one framework runs every agent that needs the memory, you do not expect to change framework in the life of the product, the memory is about the work (a project, a codebase, a task) rather than about many end users with their own rights, and you have replaced the in-memory default with a durable store. A single CrewAI crew researching for one internal team, or a LangGraph assistant with a Postgres store behind one product, fits that description. Pick the framework for its execution model; its memory will follow.
When to keep memory outside the framework
Move the cross-conversation layer out when any one of these is true.
Agents on different frameworks need the same facts. A support agent in LangGraph and a voice agent in another stack that both serve the same customer cannot share a LangGraph store and a CrewAI LanceDB directory. An external store with one scope model, read through each framework's extension point, is the only arrangement where both see the same customer. (The patterns for that are in multi-agent shared memory.)
You may change framework. A migration moves your code; it does not move LanceDB records, Markdown notebooks or Vertex AI Memory Bank entries into the next framework's shape. AutoGen users are living through exactly that now. If memory sits outside, the migration touches the adapter and leaves the memory alone. If it sits inside, you are running a data migration on top of a code migration (how to migrate agent memory covers what that involves).
You owe users deletion and isolation. When an end user asks to be forgotten, you need one place to find everything about them, plus every derived copy. Two frameworks mean at least two stores, two scope schemes and two deletion paths, and checkpoints and sessions can hold the same person's messages too. One external memory with a user scope, plus a short retention on checkpoints, is far easier to answer for (GDPR-compliant agent memory goes through the details).
Memory is a product surface. If users see, correct or rely on what the agent remembers across channels, memory has its own lifecycle (extraction, conflict handling, expiry, audit), and tying that lifecycle to the release cadence of one framework is an avoidable dependency.
How to keep memory outside without fighting the framework
Every framework above has a slot for this, which makes the external route less work than it sounds. LangGraph accepts any BaseStore subclass, CrewAI any StorageBackend, Mastra any storage provider, ADK any MemoryService, Microsoft Agent Framework any context provider, LlamaIndex a custom chat store, and Pydantic AI a custom memory store or conversation store. The pattern is the same in each:
- Leave checkpoints and sessions in the framework, on a durable backend, with a retention period.
- Put facts, preferences and history about users in one external store with a single scope model (tenant, user, agent), and enforce it on the server, not in the prompt.
- Plug that store into each framework's slot, so every agent reads the same record of the same user.
- Write one deletion path that clears the external store and the framework's session data for that user.
Maximem Synap is one option built this way: it ships native adapters for 23 agent frameworks, and each adapter plugs into the extension point the framework already has, such as a memory backend, a retriever, a checkpointer, a hook or a tool.
What to test before trusting any of these in production
Whichever way you go, run five checks on your own stack. Restart the process and confirm memory survives (several defaults here will fail). Load one user's memory with another user's ID and confirm your code refuses it. Change a fact and confirm the old one stops coming back. Delete a user and confirm nothing about them returns from memory, sessions or checkpoints. If you run Mastra with observational memory, confirm your adapter supports it, since the docs say it otherwise turns off silently.
Frequently asked questions
Which agent framework has the best built-in memory?
It depends on what you want the framework to decide. CrewAI does the most for you, with one memory class, a scope tree and ranking by similarity, recency and importance. LangGraph gives the most control, with a store whose namespaces and indexing you define. Mastra sits between them with working memory and semantic recall keyed to a resource. If you are on Google Cloud, ADK's Vertex AI Memory Bank adds managed extraction and consolidation.
Does the OpenAI Agents SDK have long-term memory?
Its sessions persist a conversation's history under a session ID, on SQLite, Redis, SQLAlchemy, MongoDB, Dapr or OpenAI's Conversations API. The sessions documentation does not describe a store of facts about a user across conversations, so cross-session memory of a person needs an external store.
Can two agent frameworks share the same memory?
Not through their built-in stores, because each uses its own format and scope key. They can share memory if both read and write one external store through their memory extension points.
Is a LangGraph checkpointer long-term memory?
No. A checkpointer saves graph state for one thread so a run can resume. Long-term memory across threads goes in a LangGraph store.
What happened to AutoGen memory?
Microsoft's AutoGen repository is archived and no longer maintained, and it points users to Microsoft Agent Framework, where memory runs through history and context providers. Any memory tied to AutoGen has to move with the migration.
Sources
All retrieved 2 December 2026.
- LangGraph persistence: https://docs.langchain.com/oss/python/langgraph/persistence
- LangGraph stores: https://docs.langchain.com/oss/python/langgraph/stores
- CrewAI memory: https://docs.crewai.com/en/concepts/memory
- Mastra memory overview: https://mastra.ai/docs/memory/overview
- Mastra storage: https://mastra.ai/docs/memory/storage
- Google ADK memory: https://adk.dev/sessions/memory/
- OpenAI Agents SDK sessions: https://openai.github.io/openai-agents-python/sessions/
- Microsoft Agent Framework memory and persistence: https://learn.microsoft.com/en-us/agent-framework/get-started/memory
- Microsoft Agent Framework conversations: https://learn.microsoft.com/en-us/agent-framework/concepts/agents/conversations/
- Microsoft Agent Framework checkpoints: https://learn.microsoft.com/en-us/agent-framework/workflows/checkpoints
- AutoGen repository: https://github.com/microsoft/autogen
- LlamaIndex memory: https://developers.llamaindex.ai/python/framework/module_guides/deploying/agents/memory/
- Pydantic AI message history: https://pydantic.dev/docs/ai/core-concepts/message-history/
- Pydantic AI Harness memory: https://pydantic.dev/docs/ai/harness/memory/



