Skip to content

Systems and records

Agent memory update arbitration: who wins when two agents write the same fact?

By SourceX Editorial · Updated

10 sections

Short answer

Resolve conflicting agent memory updates with a written conflict policy, not write order. Attach a version precondition to every write so collisions are caught, keep each value as a dated, sourced claim, then rank colliding claims by withdrawal, permission, human correction, source authority, valid time and evidence strength. Keep the loser as superseded history, and escalate true ties to the record owner.

Agent run

Agent memory update

This page covers agent memory update arbitration: who wins when two agents write the same fact.Illustrative

Key takeaways

  • Arrival order reflects latency, so last write wins lets the fastest agent decide what a business believes.
  • A version precondition on every write turns a silent overwrite into a detected collision the agent must re-read.
  • Many collisions are duplicates, different attributes or sequential changes; only overlapping, differing values need ranking.
  • Rank true conflicts by withdrawal, permission, human correction, source tier, valid time and evidence, in that order.
  • Keep losing claims as superseded history and route unresolved ties to the record owner instead of guessing.

How do you resolve conflicting updates by multiple agents to shared memory?

Resolve them with a written policy, not with whichever write happens to land last. Every write carries the version it was based on, so a collision is detected instead of silently overwritten. The colliding claims are then ranked by withdrawal, permission, human correction, source authority, valid time and evidence strength, in that order, and the losing claim is kept as superseded rather than erased.

That answer has three parts, and teams usually build only one of them. Detection is a storage problem: you need a precondition on each write. Arbitration is a records problem: you need to know which system is authoritative for which attribute and when each value became true. Escalation is a people problem: some ties should reach the person who owns the record, and the agent should stop asserting the fact until they answer.

The rest of this guide gives the fields a memory write needs, a precedence ladder you can adopt as a conflict policy, a worked scenario with two agents and one customer, and the cases where no ladder decides for you.

Why arrival order is a poor judge of which memory is true

The order in which two writes reach a store reflects network latency, queue depth and model speed. It says nothing about which value is correct or current. A billing agent that finishes a nightly sync a second before a support agent finishes reading a ticket wins a last-write-wins race for reasons that have no bearing on the customer.

Agent frameworks expose this problem in different ways. In LangGraph, a state key backed by the default LastValue channel accepts at most one value per step; when two nodes write it in the same step, it raises an error and tells the developer to declare an annotated key that says how multiple values combine. That is a useful refusal, but the developer still has to supply the combining rule.

Other stores accept both writes and leave the decision for later. The Mem0 project describes its current extraction as single-pass and ADD-only, with no UPDATE or DELETE operations, so memories accumulate and nothing is overwritten. Contradictions then surface at retrieval time, where the reader needs a rule for choosing between two remembered values.

Some stores resolve the collision quietly. Anthropic's documentation for memory stores used from self-hosted sandboxes says that when a memory file changed in the store since the last sync, the worker keeps the store's version, and the agent's own write and edit calls still report success. The agent learns about the overwrite only by reading the file again. Each of these behaviors is reasonable for its system; none of them is a business conflict policy.

What must a memory write carry before it can be arbitrated?

A write can be arbitrated only if it carries the evidence a person would ask for: what the value is about, when it became true, where it came from and who was allowed to say it. Without those fields, any policy collapses back into last write wins.

Two ideas from existing standards and tools are worth borrowing. Graphiti, an open-source temporal graph library, stores each fact edge with valid_at for when the fact became true, invalid_at for when it stopped being true, and expired_at for when the stored edge itself was invalidated. The W3C PROV-O ontology separates revision from invalidation: wasRevisionOf links a newer entity to the one it revises, and invalidatedAtTime records when an entity stopped being usable.

What must a memory write carry before it can be arbitrated?
FieldWhat it recordsWhy arbitration needs it
subject_id and attributeThe entity and the property the value describes, for example account 4471 and billing_contact_emailTwo writes conflict only when they target the same subject and attribute; different attributes merge without a contest
value and value_typeThe asserted value in a normalized formLets the policy spot duplicates that differ only in case, spacing or formatting
valid_from and valid_toWhen the fact became true in the business and when it stopped, if knownRanks claims by business time instead of arrival time; supports scheduled future changes
recorded_atWhen the memory store accepted the writeAudits the sequence of writes; never used on its own to pick a winner
source_ref and source_tierThe record the value came from (CRM field, invoice, ticket comment, call note) and its authority tier for this attributeLets a system-of-record value outrank an inference from a conversation
writer and permission_scopeWhich agent or person wrote it and which attributes that writer may changeRejects writes from agents that are not allowed to change this attribute
base_versionThe version of the record the writer read before decidingDetects a collision when the stored version has moved on
status and supersedesactive, scheduled, contested, superseded or withdrawn, plus a link to the claim it replacedKeeps the losing claim and its history instead of erasing it

How do you tell a real collision from two compatible updates?

Use a version precondition on every write, then compare the colliding claims field by field. HTTP already solved the detection half: RFC 9110 describes conditional requests such as If-Match as the way to prevent the lost update problem, where one client overwrites a parallel change it never saw, and a server whose If-Match condition is false must not perform the method and may answer 412 Precondition Failed.

Memory APIs are adopting the same pattern. Anthropic's managed agents memory documentation says a memory update can pass a content_sha256 precondition so that it applies only if the stored content still matches the version the client read, and that on a mismatch the client should re-read the memory and retry. The retry step is where your arbitration policy belongs: after the re-read, the agent knows exactly which value it collided with.

Once a collision is detected, sort it before applying any precedence rule. Many collisions are not contests at all.

  • Duplicate: both writes assert the same normalized value with overlapping valid times. Keep one claim and attach both source references.
  • Different attributes on the same subject: for example one agent changes the billing contact while another changes the service address. Merge both; nothing needs to be ranked.
  • Sequential in business time: the values do not overlap in valid time, such as a current contact and a contact scheduled from next month. Keep both with their own valid_from and valid_to.
  • True conflict: same subject, same attribute, different values and overlapping valid times. Only this case goes to the precedence ladder.

The concurrent memory conflict policy, rule by rule

Apply the rules in order and stop at the first one that separates the two claims. The order matters more than any single rule: putting recency first, for example, lets a fast agent with weak evidence beat a slower agent reading the system of record.

Write the policy down per attribute family, because authority differs by attribute. The billing system may be authoritative for billing contacts while the field service system is authoritative for site access notes, and a single global ranking of sources will be wrong for one of them.

The concurrent memory conflict policy, rule by rule
OrderRuleWinnerWhat happens to the other claim
1Withdrawal or deletion applies to this subject or sourceThe withdrawalBoth values stop being served; the claims are marked withdrawn and handled under the retention rule
2A writer lacks permission for this attributeThe permitted writerRejected write is logged with the writer and reason, never stored as active
3One claim is an explicit correction by an authorized personThe human correctionSuperseded, with a link to the correction
4Source tiers differ for this attributeThe higher tier, usually the system of recordSuperseded; if the lower tier is newer in valid time, it becomes a pending change to confirm
5Same tier, different valid_fromThe later valid_from (business time, not recorded_at)Closed with valid_to set to the winner's valid_from
6Same tier and valid time, one claim is direct and one inferredThe direct statement or field valueSuperseded and flagged as an inference that lost
7Still tiedNeither claimBoth marked contested; the agent stops asserting the fact and the record owner receives both claims with sources

Worked scenario (illustrative): two agents change one billing contact within a minute

This scenario is invented to show the policy at work; the company, people and addresses are fictional. An account has a remembered billing contact, ap@ at the customer's domain, stored as version 7 with the billing system as its source and a valid_from in March.

At 10:02 a support agent reads version 7 while handling a ticket. The customer writes that invoices should go to finance@ starting November 1. At 10:03 a billing agent, also holding version 7, finishes a sync and finds that an account manager changed the billing contact in the billing system to controller@ on October 15. The billing agent's write lands first and becomes version 8. The support agent's write, still based on version 7, fails its precondition.

Worked scenario (illustrative): two agents change one billing contact within a minute
StepEventPolicy rule appliedResult in memory
1Billing agent writes controller@, valid_from October 15, source billing systemNo collision; base version matchesVersion 8 active; ap@ closed with valid_to October 15
2Support agent writes finance@, valid_from November 1, source ticket comment, base version 7Precondition fails; agent re-reads version 8Nothing stored yet
3Re-read shows controller@ valid from October 15 and finance@ requested from November 1Sort: valid times do not overlap, so this is sequential, not a true conflictBoth values kept; finance@ stored as scheduled
4Billing contact is an attribute whose system of record is the billing systemRule 4: a ticket comment is a lower tier than the billing systemfinance@ stays scheduled, not active, and becomes a pending change for billing staff to confirm
5A backfill job imports ap@ with today's recorded_at but valid_to October 15Rule 5 uses valid time; the import is older in business timeKept as history only; it does not replace controller@
6By November 1 the billing system shows finance@Rule 4 now favors finance@ from the system of recordfinance@ active from November 1; controller@ closed with valid_to November 1

What the scenario shows, and the exception that changes the answer

The question who wins had a different answer for each date. Asked on October 20, memory should return controller@ and mention the scheduled change. Asked after November 1, it should return finance@ only if the billing system confirmed it. A store that kept one value per key would have lost either the customer's request or the authoritative current value.

The exception is a correction that arrives from an authorized person directly. Suppose the customer's controller calls and says the October 15 change was a mistake and invoices must keep going to ap@. If your policy treats a verified customer administrator as an authorized corrector for this attribute, rule 3 applies before source tier: ap@ becomes active again, controller@ is superseded with a link to the call note, and billing staff get a task to fix the system of record. If you cannot verify that the caller holds that role, the correction is a lower-tier claim and the billing system value stands until someone checks.

This is the same pattern Graphiti's contradiction handling follows in code: when a new fact contradicts an older edge, the older edge is invalidated only if its valid_at is earlier than the new fact's valid_at, and its invalid_at is then set to the new fact's valid_at. Business time decides, and the older fact stays in the graph as history.

When should an agent update, forget or stop using a remembered fact?

Update when equal or higher-tier evidence shows a later valid time; forget when permission or the source is withdrawn; stop using a fact while it is contested. Each action leaves a different trace, and mixing them up is how deleted or disputed values come back.

At a glance

When should an agent update, forget or stop using a remembered fact

  • Update: a new claim wins under the ladder. Close the old claim with valid_to and a supersedes link; keep it queryable for audits.
  • Expire: the fact had a known end, such as a temporary contact while someone is on leave. Set valid_to at write time so it ends without anyone remembering to remove it.
  • Forget: a deletion request, a revoked permission or a deleted source record applies. Stop serving the value immediately, then remove or retain the stored claim according to the retention rule for that record type, and remove derived summaries that repeat it.
  • Quarantine: rule 7 left a tie. Mark both claims contested, answer with the uncertainty if asked, and do not act on either value until the record owner decides.
  • Re-verify: the source system changed after the memory was written, for example the CRM field was edited again. Treat the memory as stale until the agent re-reads the source.

Cases the precedence ladder cannot settle on its own

Some conflicts are not about which claim is better but about whether the inputs can be trusted at all. Route these to the record owner instead of letting an agent decide.

  • Two systems both claim to be authoritative for the same attribute, such as a CRM and an ERP that each hold a billing address. Decide ownership per attribute first; the ladder assumes that decision exists.
  • Valid times were inferred by a model from text such as next month or after renewal. Store the inference and the phrase it came from, and treat the date as lower confidence than a field timestamp.
  • The two claims may describe different subjects, for example after an account merge or with two contacts who share a name. Resolve identity before ranking values.
  • The record is under a legal hold or a dispute. Changing or deleting it may have obligations outside the memory system, so counsel and the records owner decide.
  • One writer is an agent acting outside its usual permission because a human delegated a task. Record the delegation, or rule 2 will reject a legitimate write.

Testing an arbitration policy against real correction histories

A policy like this is only as good as the cases it has been tested on, and invented collisions tend to be tidy. Real field histories in CRM, billing and ticketing systems contain the hard parts: backdated changes, corrections that were later reversed, values entered by people without authority, and long gaps between a customer's request and the system update. Replaying those histories as concurrent writes, with the final confirmed value as the answer key, shows which rule misfires.

Field histories with backdated changes and reversed corrections can be requested from SourceX, which holds no ready-made datasets and instead finds U.S. businesses whose CRM, billing or ticketing records match a request's scope, volume, language, format, timing and licensing needs. For a memory replay, the request should name the attributes, the change and correction events and the timestamp fields involved. SourceX qualifies the supplier and handles rights review, contracting, preparation and delivery, and no data reaches it before the supplier has approved the scope and signed.

Frequently asked questions

Is last write wins ever acceptable for agent memory?

It is acceptable for low-stakes preferences that one writer owns, such as a display setting. For shared business facts written by several agents, it lets latency pick the winner and silently discards the losing value. Use a version precondition and an explicit ranking instead.

Should the most recent update always win?

Only when recency means business time and the sources are equally authoritative. A value recorded a minute ago from a chat can describe an older state than a system-of-record field, and a backfill can arrive late with old data. Compare valid_from, not the time the store accepted the write.

What is the difference between valid time and recorded time in agent memory?

Valid time is when a fact was true in the business, such as the day a billing contact changed. Recorded time is when the memory store accepted the write. Arbitration should rank by valid time and keep recorded time for auditing the sequence of writes.

Where should a contested memory go while it waits for a decision?

Keep both claims, mark them contested and stop the agent from acting on either. Send the record owner both values with their sources and valid times. When the owner decides, the losing claim is superseded with a link to the decision.

Does deleting a memory also delete what other agents derived from it?

Not automatically. Summaries, embeddings and other memories that restate the value can keep it alive after the original claim is withdrawn. Track derivation links so a withdrawal can find and remove the copies.

Sources

  • LangGraph's LastValue channel stores at most one value per step and raises an error when a key receives several, pointing developers to an annotated key. Source
  • Mem0 describes its extraction as single-pass and ADD-only, with no UPDATE or DELETE, so memories accumulate and nothing is overwritten. Source
  • For memory stores in self-hosted sandboxes, a conflicting edit is resolved in favor of the store's version while the agent's write still reports success. Source
  • Graphiti entity edges record valid_at, invalid_at and expired_at for each fact. Source
  • Graphiti invalidates a contradicted older edge only when it became valid before the new fact, and sets its invalid_at to the new fact's valid_at. Source
  • W3C PROV-O defines wasRevisionOf for revised entities and invalidatedAtTime for when an entity stopped being usable. Source
  • RFC 9110 describes If-Match conditional requests as preventing lost updates and allows a 412 Precondition Failed response when the condition is false. Source
  • Anthropic's managed agents memory guide describes a content_sha256 precondition on memory updates that applies the update only if the stored hash still matches, and on a mismatch the client re-reads and retries. Source

Tell us what data you need

Share scope, volume, format, timing and licensing needs. Datasets are sourced on request.

See if your company qualifies