
"How to stop your sub-agents from stepping on each other"
The day two agents did the same work twice I had two agents running in parallel, both doing research. Separate context windows, shared state file. Both finished. Both reported success. The state file looked fine. Except Agent B had completed about 90 seconds after Agent A and written its findings to the same key. Agent A's work was gone. No error. Nothing in the logs said "overwrite occurred." The swarm just moved on with half the data and no idea anything had happened. That's the failure mode. A silent overwrite that registers as success on both sides. You won't find it until the final output doesn't add up, and by then the run is long finished. What shared state actually needs A flat dict will give you collisions eventually. Two agents, same key, one finishes later - the later one wins and nothing complains. The fix that worked for me: agent-specific namespaces. Each agent writes to its own slot. Instead of state["findings"] , you get state["agent_A"]["findings"] and state["agent_B"]
Continue reading on Dev.to Python
Opens in a new tab



