# Best shared state for multi-agent systems (2026): Postgres, Archil, Redis, LangGraph, Temporal and memory layers

Source: https://archil.com/compare/best-shared-state-for-multi-agent-systems

How agents in a multi-agent system should share state: PostgreSQL for task claims, handoffs and LangGraph checkpoints; an Archil disk for the files the agents work on together; Redis for fast messages and locks; LangGraph's shared graph state and store; Temporal for orchestration; Cloudflare Agents; Letta, Mem0 and AgentCore Memory for shared memory. Ranked, with the consistency rules each one gives you.

[All comparisons](https://archil.com/compare)

# Best ways to share state between agents in a multi-agent system (2026)

Most multi-agent systems need two shared layers: a database for coordination, meaning who is doing which task, what each agent handed off and the framework's thread state, and a shared file system for the work itself. Use PostgreSQL for the first and an [Archil](https://archil.com/product/filesystem) disk for the second; if your agents only exchange messages and never produce files, Postgres alone, usually through LangGraph's checkpointer and store, is enough. Add Redis when handoffs must arrive in milliseconds, Temporal when the orchestration itself has to survive crashes, and a memory layer such as Letta or Mem0 when agents should share what they've learned about users. Postgres ranks first because every multi-agent system needs coordination; Archil ranks second because, once agents write code, datasets or reports together, the workspace is most of the shared state and nothing else on this list holds it.

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

## The short list

1.  [PostgreSQL](#postgresql): Best for the coordination layer: which agent owns which task, what each one handed off, and the framework's thread checkpoints, written by many agents at once
2.  [Archil](#archil): Best for the shared workspace: the repositories, datasets, notebooks, SQLite files and reports that several agents read and write, from different sandboxes and machines
3.  [Redis](#redis): Best for handoffs and status that must reach other agents in milliseconds, short-lived shared state, and locks where an occasional race is acceptable
4.  [LangGraph](#langgraph): Best for agents built as one LangGraph graph that should share a single state object, with checkpoints per thread and memory across threads
5.  [Temporal](#temporal): Best for orchestrating many agents as durable workflows that must survive crashes, retries and deploys without losing their place
6.  [Cloudflare Agents](#cloudflare-agents): Best for agents on Cloudflare where each agent owns its state and other code reaches it by name
7.  [Mem0 or Zep](#mem0-or-zep): Best for memory several agents share about the same users and entities, recalled by relevance across sessions
8.  [Letta](#letta): Best for stateful Letta agents that should share long-term memory through Letta Cloud
9.  [Amazon Bedrock AgentCore Memory](#amazon-bedrock-agentcore-memory): Best for teams building agents on AWS that want managed short-term and long-term memory without running a database

## Side by side

| Option | Layer | What agents share | Concurrent writers | Large files | Runs where | Pricing basis |
| --- | --- | --- | --- | --- | --- | --- |
| PostgreSQL | Coordination and framework state | Task rows, claims, handoff records, thread checkpoints, memory in the LangGraph store | Transactions; `FOR UPDATE SKIP LOCKED` lets many agents claim work from one table | No; store a path | Anywhere; managed by every cloud | Your database |
| Archil | Shared workspace | Files: repositories, datasets, reports, SQLite files, build outputs | Up to 5,000 clients per disk; in conditional mode the last write to a byte range wins; `archil checkout` gives one client a path to itself | Yes, up to 1 PiB per file | Any machine or sandbox that mounts it, plus an S3 API | $0.20 per GiB-month of active data; $0.07 per GB leaving Archil on Developer and Team |
| Redis | Fast coordination | Stream entries, pub/sub messages, locks, checkpoints with a TTL | Atomic commands; stream consumer groups with acknowledgments | No | Anywhere | Open source; your server or a hosted one |
| LangGraph | Framework state | One graph state that every node reads and writes; a store across threads | Reducers merge parallel updates; without one, parallel writes to a key are an error | No | Your workers, or LangSmith Agent Server | Open source; Agent Server billed by resource time |
| Temporal | Durable orchestration | Each workflow's event history; signals between workflows | One workflow execution decides; children report back by signal | No: 2 MB per payload, 50 MB of history | Self-hosted or Temporal Cloud | Open source (MIT); Cloud from $50 per million actions |
| Cloudflare Agents | Per-agent state | Each agent's own SQLite database and state object | One Durable Object per agent; others call it by name | Up to 10 GB per agent | Cloudflare only | Durable Objects: requests, duration, rows read and written, $0.20 per GB-month stored |
| Mem0 or Zep | Shared memory | Facts about users and entities, recalled by relevance | Through the service's API | No | Managed, or open source (Mem0, Graphiti) | Mem0: free plan, then usage; Zep: credits per episode |
| Letta | Shared memory | Memory as Git repositories that agents commit, push and pull | Each agent commits and pushes; others pull | No | Shared memory repositories need Letta Cloud | From $20 per month with $20 in credits |
| Amazon Bedrock AgentCore Memory | Shared memory on AWS | Session events and long-term memory records in namespaces | Through the AgentCore API | No | AWS | Per GB ingested and stored, per 1,000 records and retrievals |

## What to look for

-   ### Claiming work without collisions
    
    Two agents must never pick up the same task. Look for an atomic claim: a row lock taken with `FOR UPDATE SKIP LOCKED` in Postgres, a Redis stream consumer group, or an exclusive checkout of a directory on Archil. File locks such as `flock` only work between processes on one machine on most network file systems, Archil included, so they can't coordinate agents in different sandboxes.
    
-   ### Handing off results
    
    When one agent finishes, the next needs to know, and needs to see everything the first one wrote. Check what the store promises: a committed transaction, an acknowledged stream entry, or a file made durable with `fsync`. Polling a shared directory for a new file is the weakest handoff; pass "it's ready" through the coordination layer and let the reader open the files.
    
-   ### Concurrent writes to the same thing
    
    Parallel agents eventually write the same key, row or file. Postgres serializes writers with transactions, LangGraph needs a reducer on any state key that parallel nodes update, Redis gives atomic commands, and a file system with several writers keeps the last write unless one agent holds the path exclusively.
    
-   ### Where the work products live
    
    Coding, research and data agents produce repositories, notebooks, datasets and reports. These don't fit in a database row or a workflow's history: Temporal caps a payload at 2 MB. Agents that run shell tools, git, Python or SQLite need those files on a mounted file system every agent can reach, and the coordination layer should hold paths to them, not the files.
    
-   ### Durable when an agent crashes
    
    Agents die mid-task. The shared state should survive the process, the sandbox and the machine, and a task held by a dead agent should become claimable again: a Postgres row lock is released when the session ends, a Redis stream entry can be reclaimed, and an Archil checkout stays until you revoke it.
    
-   ### Memory is a separate job
    
    What agents have learned about a user or a codebase, recalled by meaning, belongs in a memory layer. It complements coordination and the workspace; it doesn't replace either.
    

## Each option in detail

### 1. PostgreSQL

[postgresql.org](https://www.postgresql.org/docs/current/explicit-locking.html)

**Best for:** the coordination layer: which agent owns which task, what each one handed off, and the framework's thread checkpoints, written by many agents at once

Every multi-agent system needs a place where agents agree on who is doing what, and a relational database is the safest default for it. A tasks table read with `SELECT ... FOR UPDATE SKIP LOCKED` lets any number of agents claim work without taking the same row; the [PostgreSQL docs](https://www.postgresql.org/docs/current/sql-select.html) describe it as a way to avoid lock contention with multiple consumers reading a queue-like table. Record the owner and a lease in the same transaction, and the claim, the agent's status and the handoff record change together or not at all. `LISTEN` and `NOTIFY` wake waiting agents when a task is added or finished: a notification is delivered only once its transaction commits, to sessions listening at that moment, with a payload under 8,000 bytes by default. For a LangGraph system, `PostgresSaver` keeps each thread's checkpoints and `PostgresStore` keeps memory every thread can read, and LangSmith Agent Server backs its persistence with Postgres by default.

#### Strengths

-   Transactions across tables, so claiming a task and recording a handoff can't half-happen
-   Many concurrent writers, with row locks and advisory locks whose meaning your application defines
-   Official LangGraph checkpointer and store, so one database holds thread state, shared memory and your own coordination tables
-   Every language and framework can reach it, and every cloud runs it for you

#### Tradeoffs

-   Not for the work itself: repositories, datasets and reports go on a file system or in a bucket, with their paths in the row
-   `NOTIFY` isn't a durable queue: an agent that wasn't listening misses the message, so re-read the table after reconnecting
-   Leases, heartbeats and retries are your code; a workflow engine does them for you
-   CrewAI flows persist to a local SQLite file by default, and Microsoft Agent Framework checkpoints to memory, files or Azure Cosmos DB, so reaching Postgres from them takes some code

### 2. Archil

[docs.archil.com](https://docs.archil.com/concepts/sharing-disks#sharing-a-disk-between-agents)

**Best for:** the shared workspace: the repositories, datasets, notebooks, SQLite files and reports that several agents read and write, from different sandboxes and machines

An Archil disk is a [POSIX file system](https://archil.com/product/filesystem) that every agent in the system mounts at once: up to 5,000 clients per disk, from Archil [sandboxes](https://archil.com/product/sandboxes) and serverless tool calls, other providers' sandboxes, containers, or your own servers. Mounted in conditional mode, any agent can write any path without setup. The consistency rules are explicit. A write is durable, and any client that opens the file afterwards reads it, once `fsync`, `archil sync`, or on a conditional mount `close` returns; renames are atomic, so writing to a temporary name and renaming publishes a result whole. A client can serve cached attributes for up to 30 seconds and directory listings for up to five minutes, so the [documented pattern](https://docs.archil.com/concepts/sharing-disks#sharing-a-disk-between-agents) is: each agent writes its own directory, syncs, reports "done" through your coordination layer, and the next agent runs `archil invalidate-cache` before it reads. `archil checkout` gives one agent exclusive writes to a path; other clients can still read it and get `EROFS` if they write there. A [checkpoint or branch](https://docs.archil.com/concepts/branches-and-checkpoints) gives each attempt its own writable copy of the whole workspace, and every disk is also an S3 endpoint that is strongly consistent with the mounted file system.

#### Strengths

-   The one entry here that holds the work products themselves, so agents pass a path instead of copying files through messages
-   Up to 5,000 connected clients per disk, all able to write in conditional mode, on Linux, macOS, Kubernetes and any sandbox that can mount it
-   Exclusive checkouts per path, enforced by the file system rather than by agents' good behavior
-   A checkpoint in about 13 ms and a branch in about 33 ms at p50, whatever the disk's size, so parallel attempts each get a full copy
-   Reads up to 8 GiB/s per client, so a shared dataset doesn't have to be copied into each sandbox
-   Services that don't mount the disk read and write the same files over the S3 API, and a disk can sync with your own S3, GCS or R2 bucket

#### Tradeoffs

-   Not a coordination layer: there are no notifications or watches, so "the output is ready" goes through Postgres, Redis or your orchestrator
-   `flock` and `fcntl` locks work between processes on one client, not across clients; use `archil checkout` or a database row to keep two machines out of the same file
-   On a conditional mount, two agents writing the same part of a file means the last write to reach the disk wins
-   Every create, rename and delete on a conditional mount waits for a round trip, so check out a directory before `npm install` or `git` work in it
-   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
-   Branches can't be merged back or deleted yet; they work on Archil-managed disks, and a disk that keeps files as ordinary objects in your bucket can't branch (your own bucket can, in Archil's proprietary format, on Enterprise)
-   Data leaving Archil costs $0.07 per GB on Developer and Team; Enterprise PrivateLink or VPC peering avoids it

### 3. Redis

[redis.io](https://redis.io/docs/latest/develop/data-types/streams/)

**Best for:** handoffs and status that must reach other agents in milliseconds, short-lived shared state, and locks where an occasional race is acceptable

Redis gives agents fast shared primitives. A stream with a consumer group is a work queue with at-least-once processing: each agent reads entries with `XREADGROUP` and acknowledges them with `XACK`, the group tracks what's pending, and `XAUTOCLAIM` hands a dead agent's entries to another. Pub/sub is lighter but at most once: per [Redis's docs](https://redis.io/docs/latest/develop/pubsub/), a message a subscriber misses during a disconnect is lost for good. For LangGraph, `langgraph-checkpoint-redis` provides checkpointers and `RedisStore`, a key-value store with optional vector search, and both can expire through a TTL.

#### Strengths

-   In-memory speed for status that every agent checks on every step
-   Streams with consumer groups, pending lists and reclaiming cover the task-queue pattern without extra software
-   TTLs clean up abandoned threads and stale status without a sweeper

#### Tradeoffs

-   Durability depends on configuration: AOF with `appendfsync everysec` can lose a second of writes, RDB snapshots the last few minutes
-   Redis's own lock guide says a single-instance `SET ... NX PX` lock suits apps where a race now and then is acceptable, recommends fencing tokens, and notes that asynchronous replication breaks mutual exclusion
-   The LangGraph package needs RedisJSON and RediSearch, built into Redis 8, otherwise Redis Stack
-   Not for files

### 4. LangGraph

[docs.langchain.com](https://docs.langchain.com/oss/python/langgraph/graph-api)

**Best for:** agents built as one LangGraph graph that should share a single state object, with checkpoints per thread and memory across threads

Inside a LangGraph graph, agents share state by construction: every node reads the graph's state and returns updates to it. When parallel nodes update the same key, a reducer such as `add_messages` merges them; without one, LangGraph raises an error for concurrent updates to that key rather than pick a winner. `Send` fans one node out over many inputs in parallel, the map-reduce or orchestrator-worker pattern. Between agents, handoff tools return a `Command` that updates state, `langgraph-swarm` passes the full message history by default, and in the subagents pattern the workers are stateless by default and the main agent keeps the conversation. A checkpointer persists the state under a `thread_id`, and a [store](https://docs.langchain.com/oss/python/langgraph/stores) holds memory every thread can read, namespaced by tuple, with optional semantic search. [LangSmith Agent Server](https://docs.langchain.com/langsmith/agent-server) deploys graphs with a Postgres database for persistence and Redis for signaling.

#### Strengths

-   Shared state, parallel fan-out and merge rules in one model, without wiring a database by hand
-   Checkpointers and stores for Postgres, MongoDB and Redis
-   Agent Server runs the database and task queue for you; serverless Agent Servers scale to zero, and one small one is included at no charge

#### Tradeoffs

-   The shared state is the graph's; agents outside the graph, in other frameworks or other services, reach it only through the database underneath
-   `langgraph-supervisor` is no longer maintained; LangChain now points to a main agent that calls workers as tools
-   In `async` durability mode, Agent Server's default, a checkpoint can be lost if the process crashes; `sync` waits for each write
-   Not for files: keep a path in state
-   Agent Server is billed by resource time, for example 0.0675 LSU per vCPU-hour of runtime at $1.00 per LSU, plus database time

### 5. Temporal

[docs.temporal.io](https://docs.temporal.io/encyclopedia/workflow-message-passing)

**Best for:** orchestrating many agents as durable workflows that must survive crashes, retries and deploys without losing their place

Temporal keeps the orchestration's state rather than a shared data store. Each workflow's event history records every step, and after a crash Temporal replays it to continue. A parent workflow can split work into Child Workflows, which, per [Temporal's docs](https://docs.temporal.io/child-workflows), communicate with the parent only through asynchronous signals; signals, queries and updates let any client send data into a running workflow or read from it. Its [OpenAI Agents SDK integration](https://docs.temporal.io/develop/python/integrations/openai-agents) runs agents as workflows, in Python and TypeScript. Two alternatives work the same way: Restate's Virtual Objects keep durable key-value state per key and run at most one writing handler per key at a time, and Inngest memoizes each step, though its AgentKit network state is shared between agents for a single run only.

#### Strengths

-   Retries, timeouts and resumption after crashes are the engine's job, not your code's
-   A clean ownership model: one workflow decides, children report back
-   Self-host the MIT-licensed server or use Temporal Cloud

#### Tradeoffs

-   At most 2 MB per payload, and a workflow's history is capped at 51,200 events or 50 MB, so files and large state live elsewhere
-   Workflow code must be deterministic; I/O, clocks and model calls go in activities
-   Temporal Cloud bills $50 per million actions for the first 5 million, plus storage per GB-hour; self-hosting means running the cluster
-   Restate's server is under the Business Source License 1.1, not an open-source license

### 6. Cloudflare Agents

[developers.cloudflare.com](https://developers.cloudflare.com/agents/api-reference/store-and-sync-state/)

**Best for:** agents on Cloudflare where each agent owns its state and other code reaches it by name

In Cloudflare's Agents SDK, every agent is a Durable Object with an embedded SQLite database (`this.sql`) and a state object that `setState` stores and broadcasts to connected clients. `getAgentByName` returns a stub for calling a named agent over RPC, so a Worker, or a coordinator, can address each agent directly. Shared state here is owned state: one agent holds it, and others ask that agent.

#### Strengths

-   Durable state is built into every agent, with no database to provision
-   Single-owner state removes write conflicts: each agent's storage has one writer
-   Up to 10 GB of SQLite per agent; storage beyond 5 GB-month is $0.20 per GB-month, and rows written beyond 50 million a month are $1.00 per million

#### Tradeoffs

-   Cloudflare only
-   State that many agents update together must live in one agent or be split across them, with your code keeping them in step
-   No shared POSIX file system: Containers disks are ephemeral by default, and the Sandbox SDK mounts S3-compatible buckets as paths

### 7. Mem0 or Zep

[docs.mem0.ai](https://docs.mem0.ai/platform/features/entity-scoped-memory)

**Best for:** memory several agents share about the same users and entities, recalled by relevance across sessions

Mem0 turns conversations into stored facts and returns the relevant ones at query time. Memories are scoped by `user_id`, `agent_id` and `run_id` (and `app_id` on the platform), and several agents share memory through a common `user_id` or `agent_id`. Note that each fact is attributed to one owner: passing both `user_id` and `agent_id` to one `add` call doesn't produce records with both set. [Zep](https://help.getzep.com/concepts) instead builds a temporal graph of facts, relationships and how they change over time, using its open-source Graphiti framework.

#### Strengths

-   Extraction and retrieval built in, rather than a vector store you design around
-   Mem0's library and Graphiti are both open source under Apache 2.0
-   Zep doesn't charge credits for retrieval or storage, only for the episodes you send

#### Tradeoffs

-   Memory, not coordination: no task claims or handoffs, and not the original documents or files
-   Mem0 needs an LLM to work; the open-source default is OpenAI's `gpt-5-mini`
-   Zep Community Edition is deprecated, so self-hosting means Graphiti without the rest of Zep; Zep plans start at $125 a month for 50,000 credits

### 8. Letta

[docs.letta.com](https://docs.letta.com/concepts/shared-memory)

**Best for:** stateful Letta agents that should share long-term memory through Letta Cloud

Letta builds agents that keep their own memory. For several agents, it now offers shared memory repositories: each is a Git repository hosted in Letta Cloud, an agent commits and pushes its changes, and other agents pull those commits into their own checkouts. The older shared memory blocks, where one block attached to several agents updates for all of them at once, still work on the legacy v1 API, but Letta's docs say not to build on them anymore.

#### Strengths

-   Memory with history: every change is a commit you can inspect
-   Open source under Apache 2.0
-   Subagents that a main agent launches and steers while they work

#### Tradeoffs

-   Shared memory repositories require cloud-hosted agents
-   The docs don't describe conflict handling when two agents push changes to the same memory
-   The older shared-block API may be deprecated; plans start at $20 a month, including $20 in credits

### 9. Amazon Bedrock AgentCore Memory

[docs.aws.amazon.com](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/memory.html)

**Best for:** teams building agents on AWS that want managed short-term and long-term memory without running a database

AgentCore Memory stores short-term memory as turn-by-turn events per session, keyed by session and actor, and extracts long-term memory across sessions with built-in semantic, user preference, summary and episodic strategies, each scoped to a namespace. AWS's docs give a team of agents sharing memory as a use case. AgentCore Runtime sessions are ephemeral by default and last up to 8 hours on microVMs; for files, you attach your own Amazon S3 Files or EFS access points or an S3 bucket, which can be shared across sessions and agents.

#### Strengths

-   Managed and AWS-native: IAM, no servers, raw events kept up to 365 days
-   Several long-term extraction strategies built in
-   Fits alongside AgentCore Runtime for teams already on Bedrock

#### Tradeoffs

-   AWS only
-   Memory, not coordination or a workspace; files go on S3 Files, EFS or another file system
-   Short-term memory is $1.00 per GB ingested and $0.10 per GB-month, with each event billed at 12 KB minimum; long-term records are $0.75 per 1,000 a month with built-in strategies, and retrievals $0.50 per 1,000

## The usual stack: a coordination database plus a shared workspace

Ranking these tools on one line hides the real answer: they do different jobs, and a multi-agent system that produces anything substantial uses two of them. Anthropic's write-up of its [multi-agent research system](https://www.anthropic.com/engineering/multi-agent-research-system) puts it this way: "Subagents call tools to store their work in external systems, then pass lightweight references back to the coordinator." The reference goes through the coordination layer; the work goes in the workspace.

A layout that holds up: a Postgres table of tasks with an owner, a lease, a status and a path; one Archil disk mounted in conditional mode in every agent's sandbox; each agent writing under its own directory, or checking it out with `archil checkout` when it needs the file system to enforce that. An agent finishing a task runs `archil sync`, then commits the status change. The next agent claims the follow-up task, runs `archil invalidate-cache` and reads the files. For risky work, take a checkpoint first, or give each attempt its own branch and keep the best one.

Swap in Redis streams for the task table when handoffs must arrive in milliseconds, or Temporal when the orchestration must survive crashes on its own. Add a memory layer if agents should remember users across sessions. If your agents only exchange messages and produce no files, skip the workspace: Postgres alone, through LangGraph's checkpointer and store, is the whole answer. For where a single agent keeps its state, see [best storage for AI agent state](https://archil.com/compare/best-storage-for-ai-agent-state-and-shared-files).

## What multi-agent frameworks share on their own

LangGraph shares one state object across the nodes of a graph and persists it with a checkpointer. [CrewAI](https://docs.crewai.com/en/concepts/memory) gives a crew one memory that all its agents share unless an agent has its own, stored with LanceDB under `./.crewai/memory` on the local disk by default, and Flows persist to a local SQLite database. AutoGen's group chat has agents share a common thread of messages; AutoGen is now in maintenance mode, and its successor, [Microsoft Agent Framework](https://learn.microsoft.com/en-us/agent-framework/concepts/workflows/state), lets executors in a workflow share state, visible to others from the next superstep and checkpointed at the end of each one to memory, files or Azure Cosmos DB. In the [OpenAI Agents SDK](https://openai.github.io/openai-agents-python/handoffs/), an agent receiving a handoff sees the whole conversation so far, and sessions store history in SQLite, Redis, SQLAlchemy, MongoDB and others.

All of these share conversation and task state. None of them shares the files agents create, and several default to the local disk, which works on one machine and breaks when agents run in separate sandboxes. That gap is what a shared file system fills.

## Why file locks don't coordinate agents on different machines

Claude Code's experimental [agent teams](https://code.claude.com/docs/en/agent-teams) share a task list on disk, and "task claiming uses file locking to prevent race conditions". That works because the teammates run on one machine. Move agents into separate sandboxes and put the task list on a network file system, and the lock usually stops protecting anything.

On Archil, `flock` and `fcntl` locks behave as on a local disk for every process on one client, and they aren't shared between clients. To keep agents on different machines out of each other's way, use `archil checkout` on a path, which the file system enforces, or claim the task in a database row. That split, files on the disk and claims in the database, is the stack above.

## Which one should you use?

| If you need | Pick |
| --- | --- |
| Task claims, handoffs and agent status written by many agents | PostgreSQL |
| Files, repositories and datasets that several agents read and write | Archil |
| Agents that write code or reports together | PostgreSQL for the tasks, plus an Archil disk for the workspace |
| One agent's directory protected from the others | `archil checkout` on that directory |
| A writable copy of the workspace per parallel attempt | Archil branches |
| Handoffs delivered in milliseconds, with reclaiming when an agent dies | Redis streams with a consumer group |
| Agents in one LangGraph graph sharing a state object | LangGraph, with a Postgres checkpointer |
| Orchestration that survives crashes, retries and deploys | Temporal |
| Each agent owning its state on Cloudflare | Cloudflare Agents |
| Facts about users shared by several agents | Mem0 or Zep |
| Managed agent memory on AWS | Amazon Bedrock AgentCore Memory |
| Agents that only exchange messages and produce no files | PostgreSQL alone, through your framework's checkpointer |

## Questions people ask

### Which tools handle shared state for multi-agent systems?

Usually two at once. For coordination, meaning task claims, handoffs and the framework's thread state, use PostgreSQL, or Redis when it has to be faster; LangGraph's checkpointer and store run on either. For the files agents work on together, use a shared file system such as an Archil disk, which up to 5,000 agents can mount at once. Temporal handles durable orchestration, and Mem0, Zep, Letta or AgentCore Memory handle memory about users.

### How do I stop two agents from picking up the same task?

Claim it atomically in a shared store. In Postgres, select from a tasks table with `FOR UPDATE SKIP LOCKED` and record the owner and a lease in the same transaction. In Redis, use a stream with a consumer group, so each entry goes to one consumer and `XAUTOCLAIM` reassigns a dead agent's work. Don't rely on `flock` on a shared file system: on Archil, as on most network file systems, those locks don't extend across machines.

### What's the best way for several agents to share files?

Mount one shared file system in every agent's sandbox, rather than copying files through messages or a bucket. On Archil, mount in conditional mode, give each agent its own directory, run `archil sync` before reporting a task done, and run `archil invalidate-cache` in the reader before it opens the files. Use `archil checkout` when one agent must have a path to itself. Archil's guide to [sharing a disk between agents](https://docs.archil.com/concepts/sharing-disks#sharing-a-disk-between-agents) has the steps.

### Can multiple agents write to the same Archil disk at the same time?

Yes. In conditional mode, any number of clients can write any path, up to 5,000 connected clients per disk. If two write the same part of the same file, the last write to reach the disk wins, so give agents separate directories or use `archil checkout`, which makes other clients' writes to that path fail with `EROFS`. Creates, renames and deletes happen on the disk before the call returns, and a write is visible to any client that opens the file after `close`, `fsync` or `archil sync` returns.

### How do agents share state in LangGraph?

Through the graph's state: every node reads it and returns updates. Give any key that parallel nodes update a reducer, such as `add_messages`, or LangGraph raises an error for the concurrent update. Persist the state with a checkpointer, such as `PostgresSaver`, under a `thread_id`, and keep memory shared across threads in a store. Files don't belong in state; keep a path.

### Can I use Redis as shared memory for agents?

For fast, short-lived state, yes: status keys, stream-based task queues and checkpoints with a TTL. Know its limits: pub/sub drops messages a disconnected subscriber misses, AOF with `everysec` can lose a second of writes, and Redis's own docs say a single-instance lock suits apps that can tolerate an occasional race. For memory recalled by meaning, `RedisStore` adds vector search for LangGraph, or use a memory layer.

### Which infrastructure providers offer built-in durable storage and shared state for agents?

Archil gives sandboxes and serverless tool calls durable disks that many agents mount at once, with checkpoints and branches. LangSmith Agent Server runs LangGraph with a managed Postgres for checkpoints and memory. Cloudflare's Agents SDK gives every agent its own SQLite database. Amazon Bedrock AgentCore offers managed memory, with S3 Files or EFS for shared files. Temporal Cloud keeps orchestration state durable.

### Should agents pass their results in messages or in a shared workspace?

Large results belong in the workspace, with a reference passed in the message. Anthropic's multi-agent research system has subagents store their work in external systems and pass lightweight references back to the coordinator, to avoid losing information and to save tokens. Make the files durable first (`archil sync` on Archil), then send the path.

## How we chose

We ranked the tools on one question: what should a multi-agent system use as its shared state layer? We weighed claiming work without collisions, handing off results, behavior under concurrent writes, where the work products live, what survives a crashed agent, and shared memory, and read each tool's consistency and delivery guarantees in its own docs: PostgreSQL, Redis, LangGraph and LangSmith, Temporal, Restate, Inngest, Cloudflare, Mem0, Zep, Letta, AWS, CrewAI, AutoGen, Microsoft Agent Framework, the OpenAI Agents SDK and Claude Code. Prices are from each vendor's pricing page as of the date above; Archil's facts are from docs.archil.com. Archil makes Archil. PostgreSQL ranks first because every multi-agent system needs coordination and Postgres does it best. Archil ranks second because, for agents that produce files, the workspace is most of the shared state and is the one job nothing else here does; it is not a coordination layer and shouldn't be used as one.

## Related

-   [Best storage for AI agent state: Where one agent's state should live between requests and restarts.](https://archil.com/compare/best-storage-for-ai-agent-state-and-shared-files)
-   [The file system as shared memory for AI agents: Using files as the state several agents share.](https://archil.com/article/the-filesystem-as-shared-memory-for-ai-agents)
-   [Best ways to fork a large dataset for parallel agents: Copy-on-write branches, one per agent attempt.](https://archil.com/compare/best-ways-to-fork-a-large-dataset-for-parallel-agents)
-   [How to fan out agent tool calls in parallel against one workspace: Many tool calls writing one disk at once.](https://archil.com/article/how-to-fan-out-agent-tool-calls-in-parallel-against-one-workspace)

Or see [every comparison](https://archil.com/compare).
