Back to Blog
Education

How to Share Persistent State Across Multiple AI Agents

April WongApril Wong
4 min read
How to Share Persistent State Across Multiple AI Agents

One agent drafts a report. Another checks its sources. A third publishes the approved result. Giving all three the same folder sounds simple until two update the same file, one restarts, or the publisher reads an unfinished version.

Short answer: keep each agent’s working files separate, use a durable coordination store for shared records, and hand off versioned artifacts with explicit ownership. Persistent storage preserves bytes. Your application must also define which agent may change them and how conflicting updates are resolved.

TL;DR

  • Separate private workspace files, thread checkpoints, shared facts and published artifacts.
  • Use transactions or conditional updates for shared task ownership and state transitions.
  • Identify every artifact by a stable ID and version, rather than a filename alone.
  • Test worker restarts, concurrent claims, stale writers and tenant isolation.
  • A persistent sandbox does not automatically provide a shared filesystem or concurrency control.

Which state needs to be shared?

Start with a state inventory. Sharing everything creates unnecessary coupling; sharing too little forces workers to repeat completed work.

StateTypical homeOwnership rule
Scratch files and dependenciesAgent-specific workspaceOne worker owns its changes
Execution checkpointPersistent framework checkpointerScope by tenant and execution thread
Task status and artifact manifestTransactional database or equivalent coordination serviceGuard state transitions against concurrent writers
Completed outputVersioned artifact storagePublish immutable versions; update the reference deliberately
Cross-run knowledgeApplication-defined storeDefine who may read, update and delete each namespace

LangGraph makes a related distinction between thread-scoped checkpoints and cross-thread stores. An in-memory implementation is useful for development, but its contents disappear when that process restarts. A production persistence choice needs an explicit recovery path.

Why not mount one disk into every agent?

A shared filesystem can be appropriate when the workload and storage system support it. It does not, by itself, decide whether two updates are compatible. Your application still needs locking, version checks or an equivalent coordination mechanism.

Kubernetes access modes describe how a volume can be mounted. ReadWriteOnce means read-write mounting by one node, and can still allow multiple pods on that node. ReadWriteOncePod restricts access to one pod for supported CSI volumes. These are different from a database transaction or an application’s tenant boundary.

Before choosing shared mounts, verify the driver, filesystem, access mode and deployment topology. Do not infer multi-writer support from the fact that a workspace survives a restart.

A practical handoff: researcher to reviewer to publisher

Consider an illustrative content pipeline. The researcher owns a private workspace and writes a draft artifact. On completion, it creates an immutable artifact version and records its ID, checksum and source list in the shared task record. The reviewer reads that version, writes a separate review artifact, and marks the task ready only when its checks pass. The publisher acts on the approved version, not whichever file was modified most recently.

A useful task record includes tenant_id, task_id, status, owner, lease_until, version and artifact_id. These are proposed application fields, not a Nirvana API schema.

When claiming a task, make the ownership update conditional on its current state and version. If two workers compete, only one should receive the successful claim. PostgreSQL provides row-level locking as one building block. Keep database transactions short and handle retries; do not hold a lock across a long model call.

Leases help abandoned work become available again, but an expired lease does not stop a slow worker from writing. Pair the lease with a version or fencing token that the write path checks. Reject an old worker’s update after another worker takes ownership.

What happens when an agent restarts?

Restart recovery should answer three questions: which task does this worker own, which artifact version is authoritative, and which external actions have already happened? Reconstruct those answers from durable records rather than process memory.

For external effects such as sending a message or publishing a page, use a stable operation identifier and reconcile uncertain outcomes. Shared storage cannot make an external service call exactly-once by itself. Our agent recovery guide covers that separate retry problem.

How does this fit Nirvana Agent Sandboxes?

Nirvana’s persistence documentation describes an optional PVC-backed /workspace retained across pause and resume. It distinguishes development-oriented local-path storage from the abs class for production workloads. Your agent must write and reload the state it needs.

Use that workspace for the worker’s files, then choose a coordination service and artifact store appropriate to your application. The documentation reviewed here does not establish that one sandbox workspace can be concurrently mounted by an arbitrary number of other sandboxes.

What should you test before increasing concurrency?

  1. Have two workers claim the same task and verify that only one succeeds.
  2. Stop the owner after writing an artifact but before updating task status; recover without losing or publishing the wrong version.
  3. Let a lease expire, assign a new owner, then confirm the stale worker cannot overwrite its result.
  4. Retry the handoff and verify that artifact identity and downstream action identity stay stable.
  5. Attempt cross-tenant reads using test accounts and verify the intended access boundary.

Measure correctness first, then completed tasks per minute, coordination latency and recovery time. These are proposed acceptance tests, not results from a completed Nirvana benchmark.

Frequently asked questions

Is a checkpoint the same as shared memory?

No. A checkpoint typically represents one execution’s progress. Shared application knowledge needs a scope and update policy that works across executions.

Does faster storage solve conflicting writes?

No. Faster I/O can reduce waiting, but conflicting writes still need an application-level consistency strategy.

Can every agent keep a separate workspace?

Yes. Separate working directories with explicit artifact handoffs are often a useful starting design. Whether they fit depends on how much concurrent file sharing the workload actually requires.

Explore Nirvana Agent Sandboxes and the long-running agent infrastructure guide when evaluating your execution and persistence layers.

Primary documentation reviewed 20 October 2026.


About Nirvana Labs

Nirvana Labs is a high-performance storage cloud built for blockchain, AI and databases: demanding, real-time, stateful workloads. Its high-performance block storage, compute, private networking, Nirvana Kubernetes Service and Agent Sandboxes help teams build and operate data-intensive applications.

Learn more at Nirvana Labs.

Nirvana Cloud | Pricing | Blog | Docs | Changelog | LinkedIn | Twitter | Telegram | YouTube

Powering AI, blockchain, and
databases

Talk to Sales