All comparisons

Best storage for AI agent state: shared state, memory and files (2026)

The short version: keep an agent's working state on an Archil disk, with its files on the disk and its structured data in a SQLite file next to them; if all you persist is LangGraph or CrewAI thread checkpoints, use a Postgres checkpointer instead. For most agents, state is a workspace: the files, repositories and artifacts it builds, plus some structured data about the task. One Archil disk holds all of it. Up to 5,000 clients can mount it at once, it keeps its contents across restarts, a checkpoint or branch copies the files and databases together in milliseconds, and every disk is readable over S3. Plain sqlite3 works on it, with no SDK and no per-query charge. Postgres is the default for structured thread and workflow state that many tenants write heavily, Redis for short-lived state, and Temporal for workflows that must survive crashes; memory about users belongs in Mem0 or the LangGraph store.

Updated . Competitor facts are from each vendor's own docs and pricing pages.

The short list

  1. Archil: Best for an agent's whole working state, its files, repositories and artifacts plus the SQLite databases beside them, shared across agent instances, kept across restarts and forked per attempt
  2. PostgreSQL: Best for structured thread and workflow state through your framework's checkpointer, especially many tenants or workers writing heavily; the right default if all you persist is thread checkpoints
  3. Redis: Best for short-lived, frequently read state and checkpoints that should expire on their own
  4. Temporal: Best for multi-step agent workflows that must survive crashes, retries and deploys without losing their place
  5. Amazon S3 or Cloudflare R2: Best for files an agent writes once and others read: reports, generated media, uploaded documents and exported state
  6. Amazon EFS: Best for shared directories for agents that run entirely on AWS, where large files matter more than small-file speed
  7. Mem0: Best for long-term memory: what agents should remember about users and entities across sessions
  8. LangGraph store: Best for LangGraph apps that need memory shared across threads, kept in the same database as their checkpoints

Side by side

OptionBest forWhat it holdsShared by many agentsLarge filesWorks withPricing basis
ArchilAn agent's whole working state: files plus SQLiteRepositories, datasets, artifacts, and SQLite databases next to themUp to 5,000 clients per disk; one writing machine per plain SQLite fileYes, up to 1 PiB per fileAny framework, through a mount, the S3 API, SDKs or any SQLite library$0.20 per GiB-month of active data; no per-query charge for plain SQLite
PostgreSQLThread and workflow checkpoints, heavy concurrent writesCheckpoints per thread, plus rows you queryYes: any worker resumes a thread by its IDNo; keep a path or URL in stateLangGraph (PostgresSaver); other frameworks through your own persistence codeYour database
RedisShort-lived state that should expireCheckpoints, optionally only the latest; key-value store with vector searchYesNoLangGraph (langgraph-checkpoint-redis)Open source; your Redis server or a hosted one
TemporalWorkflows that must survive crashesEach workflow's event history: inputs and the result of every stepYes: any worker can continue a workflowNo: 2 MB per request, 50 MB of history per workflowTemporal SDKs; an OpenAI Agents SDK integrationOpen source (MIT); Temporal Cloud from $50 per million actions
Amazon S3 or Cloudflare R2Files written once, read by othersOutputs, uploads, generated media, exported stateYes; on the same key, the last write winsYesAny framework, through an SDKS3 Standard $0.023 per GB-month (us-east-1); R2 $0.015, with no egress fees
Amazon EFSShared directories on AWSFiles over NFSYes, with advisory locksYesAny framework on AWS compute$0.30 per GB-month (Standard, us-east-1), plus per-GB reads and writes
Mem0Long-term memory about usersFacts distilled from conversations, organized by user, agent, app and runYes, through its APINoAny code through its SDK; guides for LangGraph and CrewAIOpen source (Apache 2.0); managed platform with a free plan, then usage
LangGraph storeMemory across threads in LangGraphItems by namespace, with optional semantic searchYes, across threadsNoLangGraphOpen source (MIT); you pay for the database

What to look for

  • Where the whole working state lives

    We ask where an agent's state lives so that it survives restarts, can be shared across agent instances and can be forked per attempt. For agents, that state is mostly a workspace: files, repositories and outputs, plus structured data about the task. A store that holds both together ranks higher.

  • Shared across agent instances

    State kept in process memory or on a sandbox's local disk belongs to one process on one machine. LangGraph's InMemorySaver loses checkpoints on restart, and its docs describe SqliteSaver as local storage for development. When agents run as many workers or in many sandboxes, every instance needs to reach the same store.

  • Durable at a known moment

    Know exactly when a write is safe: a returned fsync on Archil, a committed transaction in Postgres, a successful PUT in S3. Redis depends on its persistence settings, and a write still buffered in a client is lost if the machine stops.

  • Fork and roll back

    Agents try things. A checkpoint before a risky step, or a writable copy of the workspace per attempt, is cheaper than copying it. It's most useful when one operation captures the files and the structured data together, so they can't drift apart.

  • Concurrent writers

    Check what happens when two agents write at once. Postgres handles many concurrent writers to one database; a plain SQLite file takes one writing machine. S3 and Archil's conditional mode keep the last write, S3 conditional writes can refuse a stale update, EFS has advisory locks, and Archil can give one client a path to itself with archil checkout.

  • Thread checkpoints are a narrower job

    Saving a framework's chat history and graph state between turns is one part of agent state, and a database checkpointer does it well. If that's all you persist, the Postgres checkpointer is the right default. Large files never belong there: Temporal caps a request at 2 MB, so state should keep a path, not the file.

Each option in detail

Best for: an agent's whole working state, its files, repositories and artifacts plus the SQLite databases beside them, shared across agent instances, kept across restarts and forked per attempt

An Archil disk is a POSIX file system that many agents mount at once, from any machine or sandbox, and that keeps its contents when they stop. A write is durable when fsync returns, on SSD replicated across Availability Zones, and every disk is also an S3-compatible endpoint that is strongly consistent with the file system, so services that don't mount it can read and write the same files. The structured part of the state goes in a SQLite file next to the files: the sqlite3 CLI, Python's sqlite3 module or any SQLite library works on a mounted disk, as Archil's web app guide shows, because SQLite only sees a file. WAL mode works, and a plain mount gives that machine exclusive access, so SQLite's locking behaves as on a local disk. A checkpoint or branch then captures the files and the databases together. When several machines must write the same database, Archil's SQLite integration runs queries from many clients, writes included.

Strengths

  • Files and structured state on one disk, with one set of credentials and one lifecycle; plain SQLite needs no SDK and has no per-query charge, since it's billed as ordinary disk storage
  • Up to 5,000 connected clients per disk, on Linux, macOS, containers, Kubernetes, other providers' sandboxes and Archil's own sandboxes; in conditional mode any client can write anywhere
  • A checkpoint takes about 13 ms and a branch about 33 ms at p50, whatever the disk's size, so each attempt gets its own writable copy of the files and databases
  • A real file system, so git and npm run on it; a react git clone took 9.8 s on Archil and 81.5 s on Amazon EFS in Archil's benchmark
  • Readable over S3, and a disk can sync both ways with your own S3, GCS or R2 bucket, each file an ordinary object
  • For many machines writing one database, the SQLite integration allows any number of databases per disk; each write gets the database file to itself, and reads run in parallel

Tradeoffs

  • With plain SQLite, keep one writing machine per database file: SQLite's locks don't extend across machines. Heavy concurrent writes from many machines to one database belong in Postgres
  • If all you persist is a framework's thread checkpoints, a Postgres checkpointer is simpler
  • A file system isn't a memory or vector layer; facts ranked by relevance need Mem0 or a store
  • In conditional mode, if two clients write the same part of a file, the last write to reach the disk wins; a reader can serve cached listings for up to five minutes, so hand off through your orchestrator and run archil invalidate-cache
  • Writes not yet sent are lost if a sandbox is killed before fsync, archil sync or unmount, and a crashed client's checkouts stay until you revoke them
  • Checkpoints and branches work on Archil-managed disks, in AWS regions; disks that keep files as ordinary objects in your bucket can't branch on any plan (your own bucket can branch only in Archil's proprietary format, on Enterprise), and branches can't be deleted yet or merged back
  • The SQLite integration is TypeScript-only (@archildata/sqlite), runs on disks in AWS regions only, and bills each query as one serverless tool call, $0.05 per 1,000 on Developer and Team
  • A managed service, not open source; public regions are three in AWS and one in Google Cloud

2. PostgreSQL

docs.langchain.com

Best for: structured thread and workflow state through your framework's checkpointer, especially many tenants or workers writing heavily; the right default if all you persist is thread checkpoints

Every major framework saves a thread's state as checkpoints, and in production those belong in a database every worker can reach. LangGraph ships PostgresSaver and AsyncPostgresSaver in langgraph-checkpoint-postgres; a graph compiled with one persists the thread's state as checkpoints, and a worker that runs the graph with the same thread_id continues from them. CrewAI Flows persist with @persist to a local SQLite database by default and accept your own FlowPersistence backend. AutoGen's save_state() returns a dictionary that, per its docs, can be serialized to a file or written to a database. AG2 resumes a group chat from saved messages, and storing them is up to you.

Strengths

  • Many concurrent writers to the same data, with transactions and SQL
  • Official LangGraph checkpointer and store, so one database holds both each thread's state and memory shared across threads
  • Stateless workers: any of them can serve any thread

Tradeoffs

  • Not for files: keep repositories, datasets and large outputs elsewhere and store a path in state
  • No copy-on-write fork of a whole workspace; the files and the rows live in different systems
  • CrewAI's documented default is a local SQLite file, and AutoGen and AG2 hand you the state to store; reaching Postgres takes some code of your own
  • Microsoft Agent Framework, which Microsoft calls AutoGen's successor, ships in-memory, file and Azure Cosmos DB checkpoint storage rather than Postgres
  • Call checkpointer.setup() the first time to create tables; LangGraph suggests running it as a deployment step

3. Redis

github.com

Best for: short-lived, frequently read state and checkpoints that should expire on their own

The langgraph-checkpoint-redis package provides RedisSaver and AsyncRedisSaver for full checkpoint history, shallow savers that keep only the latest checkpoint, and RedisStore, a key-value store with optional vector search. Checkpoints and store items can expire through a Redis TTL (default_ttl, optionally refreshed on read); without one, they never expire.

Strengths

  • In-memory reads and writes for state that every turn touches
  • TTLs clean up abandoned threads without a sweeper job
  • One Redis for checkpoints, memory with vector search and caching

Tradeoffs

  • Needs the RedisJSON and RediSearch modules: built into Redis 8, otherwise use Redis Stack
  • Durability depends on configuration: RDB snapshots can lose the last few minutes of writes, and AOF with the default everysec policy can lose one second
  • The package is for LangGraph; other frameworks need their own code to use Redis
  • Not for files

4. Temporal

docs.temporal.io

Best for: multi-step agent workflows that must survive crashes, retries and deploys without losing their place

Temporal makes an agent's control flow durable instead of storing a state object. Each workflow keeps an event history, which Temporal's docs call a complete, ordered log of everything that has already happened, and after a crash Temporal replays that history to rebuild the workflow's state and continue, reusing the results of steps that already ran. Its OpenAI Agents SDK integration runs the agent loop inside a workflow and each model call as an activity. Archil's Temporal guide runs each activity in its own sandbox with the work's disk mounted, so the files stay put when the sandbox is deleted.

Strengths

  • Retries failed steps and resumes long-running work after crashes and deploys
  • Fans out to many parallel tasks from one workflow
  • Self-host the open-source server (MIT) or use Temporal Cloud

Tradeoffs

  • Workflow code has to make the same decisions when given the same history, so clocks, random numbers and I/O go in activities
  • At most 2 MB per request, and a workflow's history is capped at 51,200 events or 50 MB; files and large data need their own store
  • Temporal Cloud bills per action, $50 per million for the first 5 million, plus storage; self-hosting means running the cluster

5. Amazon S3 or Cloudflare R2

docs.aws.amazon.com

Best for: files an agent writes once and others read: reports, generated media, uploaded documents and exported state

Object storage is the simplest durable place for whole files. Amazon S3 gives strong read-after-write consistency, and conditional writes (If-None-Match to refuse an overwrite, If-Match on an ETag to update only an unchanged object) let agents coordinate without a lock service. Cloudflare R2 speaks the S3 API, costs $0.015 per GB-month and charges nothing for egress.

Strengths

  • The lowest price per GB here: S3 Standard is $0.023 per GB-month in us-east-1, plus $0.005 per 1,000 PUTs
  • Every language, service and analytics tool can read it
  • Conditional writes cost nothing extra on S3

Tradeoffs

  • Objects are written whole through an API, so tools that edit files in place, such as git, SQLite and package managers, can't run on a bucket; agents copy files down, work, and upload, losing anything done since the last upload
  • Two PUTs to the same key at once: the one with the latest timestamp wins, and there are no atomic updates across keys
  • No branches; S3 Versioning keeps per-object history

Best for: shared directories for agents that run entirely on AWS, where large files matter more than small-file speed

EFS is AWS's managed NFS file system. Many EC2 instances, containers and Lambda functions mount one file system, with the close-to-open consistency NFS applications expect and NFSv4 advisory locks. Regional file systems store data across Availability Zones.

Strengths

  • Mature and AWS-native, with IAM and AWS Backup
  • NFS locks shared across clients, up to 512 per file
  • Faster than Archil on large sequential writes: 590 MB/s against 194 MB/s in Archil's benchmark

Tradeoffs

  • Slow on the small files agents create: npm ci took 86.3 s on EFS and 7.6 s on Archil, and 10,000 single-row SQLite transactions took 523 s against 23.9 s
  • Locks are advisory: reads and writes don't check them
  • AWS only, with no branches or S3 access to the files
  • $0.30 per GB-month for Standard storage in us-east-1, plus $0.03 per GB read and $0.06 per GB written on Elastic throughput

Best for: long-term memory: what agents should remember about users and entities across sessions

Mem0 turns conversations into long-term memory. You send it messages, it distills them into facts and links entities across memories, and at query time it returns only the most relevant ones. Memories can be organized by user, agent, app and run, so several agents can share what they've learned about the same person. It runs as a managed platform or as the open-source library under Apache 2.0.

Strengths

  • Extraction and retrieval built in, rather than a raw vector store you design around
  • The managed platform runs the vector store and rerankers for you
  • Guides for LangGraph and CrewAI

Tradeoffs

  • Requires an LLM to work; the open-source defaults are OpenAI's gpt-5-mini and text-embedding-3-small
  • Stores distilled facts, not the original documents or files
  • On the managed platform, graph memory (entity linking) is only on the Custom plan, and the Free plan has monthly add and retrieval limits

8. LangGraph store

docs.langchain.com

Best for: LangGraph apps that need memory shared across threads, kept in the same database as their checkpoints

A LangGraph store holds application-defined data outside the graph state, for long-term, cross-thread memory such as user preferences, facts and shared knowledge. Pass it when compiling the graph, and nodes read and write it through the runtime. Production stores are backed by Postgres, Redis, MongoDB or Oracle, and a store created with an embedding index (embed and dims) supports semantic search.

Strengths

  • Shared across every thread, alongside per-thread checkpoints
  • Lives in a database you already run
  • Open source (MIT)

Tradeoffs

  • LangGraph only
  • Nodes write to it explicitly, so deciding what to remember is your code's job
  • Call store.setup() the first time with Postgres; semantic search on MongoDB needs Atlas or self-managed Vector Search

Workspace state vs thread checkpoints

Questions about agent state usually mean an agent keeping its work between requests, across restarts, and across several agent instances. For agents, that work is mostly a workspace: a repository, a dataset, generated files, and some structured data about the task. That's why Archil ranks first: one disk holds the files and, in SQLite files next to them, the structured data, and a checkpoint or branch copies both together.

Saving a framework's thread checkpoints is a narrower job. If that's all you persist, or many tenants write the same structured state heavily, Postgres through your framework's checkpointer is the better pick, and many products use both. Memory that should be recalled by meaning is a third job, for Mem0 or a store. See also the file system as shared memory for agents.

What LangGraph, CrewAI and AutoGen persist on their own

LangGraph has the most built in: checkpointers save each thread's state, and stores hold memory across threads. InMemorySaver keeps checkpoints in RAM, SqliteSaver is for development, and production checkpointers and stores exist for Postgres, MongoDB, Redis and Oracle.

CrewAI Flows persist to a local SQLite database with @persist, and crew memory is stored with LanceDB under ./.crewai/memory (or $CREWAI_STORAGE_DIR/memory). Both live on the local disk by default, so a crew that runs in a fresh container or on several machines needs a custom FlowPersistence or memory StorageBackend, or that directory on durable storage.

AutoGen's save_state() and load_state() move an agent's or a team's state as a dictionary you store yourself. AutoGen's README now says the project is in maintenance mode and points new users to Microsoft Agent Framework, whose workflows checkpoint after every superstep to in-memory, file or Azure Cosmos DB storage. AG2 resumes a group chat from messages saved with messages_to_string(); storing them is up to you.

None of these frameworks stores the files an agent works on. That's the job of the disk or bucket the agent's tools write to.

Putting it together

A simple setup is one Archil disk per agent, tenant or task: the workspace in directories, the structured state in a SQLite file beside it, a checkpoint before risky steps and a branch per attempt. Keep one writing machine per SQLite file. When many workers serve the same threads, add a Postgres checkpointer for the framework's state and keep file paths, not files, in it.

When several agents share one disk, give each its own directory, and pass "the output is ready" through your orchestrator after archil sync returns. Archil's guide to sharing a disk between agents has the exact steps.

Which one should you use?

If you needPick
An agent's files and structured data kept together across requests and restartsArchil, with SQLite files on the disk
Files and repositories shared by many agent instancesArchil
A writable copy of the whole workspace per agent attemptArchil branches
Several machines writing the same SQLite databaseArchil's SQLite integration; Postgres if the write load is heavy
Only LangGraph or CrewAI thread checkpointsPostgreSQL checkpointer
Structured state that many tenants write heavilyPostgreSQL
Hot, short-lived state that should expireRedis
Multi-step workflows that must survive crashes and retriesTemporal
Outputs written once and read by other servicesAmazon S3 or Cloudflare R2
Shared directories on AWS, mostly large filesAmazon EFS
Facts about users remembered across sessionsMem0
Memory across threads in a LangGraph app, in the database you already runLangGraph store
CrewAI flows running on more than one machineA custom FlowPersistence on a shared database
A new Microsoft-stack multi-agent projectMicrosoft Agent Framework, with Cosmos DB checkpoint storage

Questions people ask

How do I persist an AI agent's state between calls?

Put the agent's workspace on a durable disk it mounts on every call, such as an Archil disk, and keep its structured data in a SQLite file on the same disk. Framework thread state goes through the framework's persistence: in LangGraph, a Postgres or Redis checkpointer with the same thread_id on each call; in CrewAI, @persist and the state's id; in AutoGen, save_state() stored in your database and load_state() on the next request.

Which tools handle shared state for multi-agent systems?

For the shared workspace, a disk every agent mounts: Archil supports up to 5,000 clients per disk, all writing, with per-path checkouts when one agent needs a directory to itself. For thread state that many workers write, a LangGraph checkpointer on Postgres or Redis, or Temporal for whole workflows. For memory, Mem0 scoped by user and agent, or the LangGraph store.

Can I keep structured state and files in one place?

Yes. Put the agent's SQLite database on its Archil disk, next to its files, and use ordinary sqlite3 from an Archil sandbox or any machine that mounts the disk; there's no SDK and no per-query charge. WAL mode works, and a checkpoint or branch of an Archil-managed disk captures the database and the files together. Keep one writing machine per database file, since SQLite's locks don't extend across machines. If several machines must write the same database, use Archil's SQLite integration: TypeScript only, AWS regions only, with each query billed as a serverless tool call ($0.05 per 1,000).

Should agent state go in SQLite on Archil or in Postgres?

SQLite on Archil when each agent, tenant or task has its own small database that belongs with its files and should fork with them. Postgres when many machines write the same database heavily, or when all you persist is a framework's thread checkpoints. Many products use both.

Do LangGraph, CrewAI and AutoGen have built-in persistence?

LangGraph does: checkpointers for each thread and stores for memory across threads, with Postgres, Redis, MongoDB and Oracle backends. CrewAI persists flows to a local SQLite file and memory to LanceDB on the local disk by default. AutoGen gives you the state as a dictionary to store yourself, and is now in maintenance mode, with Microsoft Agent Framework as its successor. None of them store the files an agent works on.

Where should agents keep files between requests?

On storage that outlives the process. For files that tools edit, such as repositories, node_modules or SQLite databases, use a shared file system: Archil on any cloud, or EFS on AWS. For files written once and read later, a bucket such as Amazon S3 or Cloudflare R2 is enough. See best ways to persist agent files across sandbox restarts.

Can I keep files in my checkpointer or Temporal history?

Only small ones. Temporal caps a request at 2 MB and a workflow's history at 50 MB, and checkpoints are rewritten as a thread runs. Put the file on a disk or in a bucket and keep its path in the state.

How do several agents write the same files without overwriting each other?

Give each agent its own directory, and hand results off through your orchestrator once they're durable. On Archil, archil checkout gives one client exclusive writes to a path, and in conditional mode the last write to reach the disk wins otherwise. On S3, use conditional writes with If-Match so a stale update fails. EFS offers NFS advisory locks.

Is Archil a replacement for Postgres or Mem0?

Not entirely. Archil holds files and the SQLite databases beside them. Heavily written state shared by many machines belongs in Postgres, and memory recalled by meaning belongs in a memory layer.

How we chose

We ranked the tools teams use for agent state on one question: where does an agent's whole working state live, so it survives restarts, can be shared across agent instances and can be forked per attempt? We weighed holding files and structured state together, sharing across instances, durability, and fork and rollback, and checked each framework's persistence in its own docs (LangGraph, CrewAI, AutoGen, AG2, Microsoft Agent Framework and Temporal). Competitor facts and prices come from each vendor's docs and pricing pages as of the date above; Archil's numbers come from docs.archil.com and its published benchmarks, which you can rerun. Archil makes Archil. It ranks first because one disk holds an agent's files and its SQLite data together, shared, durable and forkable. PostgreSQL ranks second and is the better pick when all you persist is thread checkpoints, or when many machines write the same structured state heavily.