Race Conditions on Shared Tool Resources
Anti-pattern: let concurrent agents perform read-modify-write on shared external resources without locking, producing silent data corruption.
Problem
When two agents read the same baseline, modify independently, and write back, the last writer wins and the first writer's change is lost. Without explicit locking (compare-and-swap, optimistic concurrency control, lease), corruption is silent — both writes 'succeed' from the agent's perspective. The corruption surfaces hours or days later as missing fields or wrong totals.
Solution
Use the backing store's CAS or ETag mechanisms. Where unavailable, route writes through a dedicated single-writer agent (consumer of an event queue). For non-mutating reads, allow parallelism freely. Pair with quorum-on-mutation when the resource is high-stakes (financial, identity). Detect lost-writes via background reconciliation jobs and alert on divergence.
When to use
- Never. Cite when reviewing parallel-write agent designs.
- Use CAS/ETag/lease on every concurrent write.
- Funnel through a single-writer agent when backing store has no CAS.
Open the full interactive page →
Diagram, neighbourhood map, code examples, related patterns and full provenance.