Short answer: Shared memory is not a table that every agent may update freely. Define ownership, schema, version, event ordering, conflict rules, and write permissions. Pass the smallest useful state between agents, and make unresolved conflicts visible to an orchestrator or human reviewer.
Why shared state becomes a failure point
Multiple agents may research, classify, draft, and execute work in parallel. If each writes an interpretation into a common store, the final result can depend on timing rather than evidence. One agent may overwrite a newer value, another may read a half-complete record, and a retry may duplicate an action.
Begin by asking whether shared memory is needed at all. A single agent or a short-lived task object may be simpler. Add shared state when agents truly need to coordinate across steps, not because “multi-agent” sounds more advanced.
Design the state contract
Define a schema for each shared object: identifier, owner, status, version, source references, timestamp, confidence or uncertainty state, and permitted transitions. Do not let free-form prose become the only representation of a decision that downstream agents must interpret.
Give each field an owner. A research agent may append evidence; a policy agent may approve a classification; an execution agent may report tool results. Ownership prevents two agents from silently deciding the same field.
Use optimistic concurrency or an equivalent version check. An agent must read version 7 and write “update version 8”; if another agent already wrote version 8, the update is rejected or merged through a defined resolver. Never assume that the last write is the correct write.
Conflict patterns and controls
| Conflict | Safer response |
|---|---|
| Two agents assign different statuses | Preserve both proposals and route to a resolver with evidence |
| An old retry overwrites new state | Require version or idempotency key |
| Sources disagree | Store both references and escalate; do not average facts |
| Parallel actions duplicate a write | Use a unique operation ID and confirm the system-of-record result |
| Memory contains a secret or excess data | Apply field-level access and retention rules |
The resolver should be explicit. It may apply a deterministic rule, ask a specialist agent for comparison, or stop for a human decision. Record why the conflict was resolved and which sources were accepted.
Orchestration and message design
Pass structured task contracts rather than entire chat histories. A contract can include objective, inputs, constraints, expected output, evidence required, deadline, and stop condition. The receiving agent should acknowledge the version it used.
Keep the orchestrator responsible for lifecycle and escalation, not for granting broad permissions. Each worker receives only the tools and data required for its task. If a worker returns an incomplete result, the orchestrator should not fabricate a completion to keep the workflow moving.
Acceptance tests
Test simultaneous updates, delayed messages, duplicate delivery, out-of-order events, schema changes, missing evidence, revoked permissions, and a resolver timeout. Verify that the system retains an auditable trace and chooses a safe stop when no rule applies.
Measure conflict rate, stale-read rate, rejected writes, duplicate actions, resolver latency, and human escalations. These are operational measures, not proof that a particular architecture will improve revenue or cost.
When a single agent is better
If one owner, one data source, and one reversible action are enough, use a single tool-using agent or deterministic workflow. More agents create more messages, state, credentials, monitoring, and failure modes. The architecture should solve a demonstrated separation-of-duties or integration problem.
Frequently asked questions
Should all agents share the same conversation history?
Usually not. Share a versioned task state and the evidence needed for the next step. Full histories increase context, privacy, and instruction-conflict risk.
What happens when the agents cannot agree?
Preserve the alternatives, show their evidence, apply a documented resolver if one exists, or escalate. Do not hide the disagreement in a single confident sentence.
Is a vector database enough for shared memory?
No. Retrieval storage does not define ownership, versioning, write authorization, event ordering, or conflict resolution. Those are workflow and governance decisions.
Practical rollout
A worked coordination pattern
Imagine a procurement workflow with a document agent, a policy agent, and a buyer-review agent. The document agent may append extracted line items with page references. The policy agent may append a match result and the policy version, but it cannot overwrite the extraction. The review agent may accept or reject the recommendation, while the orchestrator owns the case status. Each write includes the version it read and an idempotency key.
If the document agent later corrects a quantity, the policy recommendation is marked stale and recomputed; it is not silently edited in place. If the buyer rejects the recommendation, the rejection and reason become part of the case history. This design makes a disagreement observable and prevents a later retry from reviving an old action.
Test the state store itself, not only the prompts. Inject a delayed message, duplicate event, rejected version, partial outage, and a payload that exceeds the schema. Confirm that the resolver preserves both proposals, that retries do not duplicate external writes, and that a human can export the complete timeline. These tests often justify a simpler sequential workflow when parallelism adds little value.
Memory should also have a lifecycle. Define which fields are temporary task state, which become a business record, and when intermediate content is deleted. Limit who can read raw evidence versus a derived status. If an agent must retain a correction, append it as a new event with an author and reason instead of mutating the original event. This is especially important when a later decision depends on the history of a conflict.
Use a failure budget for coordination. Set a maximum number of retries, a timeout for the resolver, and a clear manual queue for unresolved cases. If the system cannot establish a consistent state, stop the workflow and tell the operator what is missing. “Eventually consistent” is not an acceptable explanation for a duplicate payment, account change, or other irreversible action.
Start with read-only coordination and an explicit state schema. Add one worker at a time, test retries and conflicting evidence, and keep writes behind approval until the trace and rollback path are reliable. For a scoped architecture discussion, see Faltara’s AI agent development services or contact the team.
Choose a state store and messaging pattern that your operations team can inspect. The technology is less important than the guarantees: durable event IDs, ordered updates where required, explicit schema versions, and a way to replay or quarantine a bad event. Document what happens when the state store is unavailable; a safe fallback may be a manual queue rather than a second, less controlled store.
References: NIST AI Risk Management Framework and AWS Builders’ Library: Making Retries Safe with Idempotent APIs.
Make ownership and versioning executable
For each shared field, name one writer, allowed readers, schema version, and conflict rule. A coordinator may own workflow status while a specialist owns an extracted invoice field; neither should overwrite the other’s state because it has a newer message timestamp. Use an event ID and idempotency key so a retry can be recognized, and keep the previous value when a human resolves a conflict.
Acceptance tests should include out-of-order events, duplicate delivery, a worker that retries after a successful write, incompatible schema versions, and a state store outage. The safe result may be quarantine and human review. Only after these cases are traceable should a multi-agent workflow receive permission to change an external system.
