Two workers run in parallel and both write the same results file.
Half the work is missing.
- ATell both workers in the prompt not to overwrite each other
- BAdd a retry - the lost half will be rewritten
- CKeep them parallel but have each worker re-read the file right before writing and append only what is missing, so neither overwrites the other
- DGive each worker its OWN output, and merge them deterministically in the orchestrator
Answer: D
Give each worker its OWN output, and merge them deterministically in the orchestrator
Why
Parallel workers must not share a mutable destination. Sequential execution also "works" - by throwing away the parallelism you wanted. Isolated outputs plus one deterministic merge keep both.
- Multi-agentA worker returns an excellent answer, and the next worker in the chain immediately redoes the same research.
- Multi-agentA swarm of 900 agents returns 4,000 «findings» from scanning a dataset.
- Multi-agentA teammate wants to split a simple, strictly sequential 3-step task into three separate agents that hand off to each other.
- Multi-agentYour orchestrator spawns worker agents but sends each only its narrow subtask - none get the shared spec.
More on Way of the Agent
- Course programThe first three modules are free: start in the browser or the app, no card needed.
- Library: guides, skills and promptsReady prompt templates, grouped into collections.
- AI ChroniclesSourced stories from the history of AI.
- ConceptsPlain-language explainers of agent engineering.
- Learn AI agentsApps and courses for learning AI agents, compared honestly.
Real situations from building agents - with the answer and why.
Solve a new one every day on the Path