A multi-agent document processing pipeline has a coordinator agent and 8 worker agents. Workers process document sections in parallel and must write their results to a shared state store. Two workers may complete processing of adjacent sections simultaneously and write to state at nearly the same time. What shared state pattern prevents data corruption?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Here's the deal — a is correct because optimistic locking handles concurrent writes without blocking: workers operate independently, version checks at write time detect conflicts, and retries handle the rare case of concurrent updates to the same state. This pattern scales well and is the standard approach in distributed systems for low-contention scenarios.
Full explanation below image
Full Explanation
A is correct because optimistic locking handles concurrent writes without blocking: workers operate independently, version checks at write time detect conflicts, and retries handle the rare case of concurrent updates to the same state. This pattern scales well and is the standard approach in distributed systems for low-contention scenarios. B is wrong because an in-memory shared dictionary without locking leads to race conditions — concurrent writes can corrupt the dictionary or lose updates when two processes overwrite each other's changes. C is wrong because serializing all writes through the coordinator creates a bottleneck that eliminates the parallelism benefit of 8 workers — throughput is limited to the coordinator's write speed. D is wrong because file-based state with separate files per worker is a valid pattern but requires a final merge step that cannot be used for cross-worker reads during processing — workers cannot see each other's intermediate results needed for dependency resolution.