# Subagent Isolation

> Run each subagent in its own isolated workspace (git worktree, container, branch) so parallel writes don't collide — the supervisor reconciles results when all are done.

- **Category**: Agentic AI
- **Subcategory**: Multi-Agent
- **Canonical URL**: https://designpattern.fyi/patterns/subagent_isolation/

---

## Description
**Intent**: Run subagents in isolated workspaces so their writes do not collide and parallelism is safe.
**Context**: A coding agent delegates to several sub-agents that should work in parallel — one refactors a module, another updates tests, a third writes documentation. They all want to touch the same repository at the same time.
**Solution**: Each subagent runs in its own workspace (git worktree, container, branch, sandbox). The supervisor reconciles results back to the main workspace on completion (merge, cherry-pick, replay). Only one workspace can land changes at a time.



## Use Cases
- A bounded sub-task has its own tool palette, prompt, or model.
- The parent's context should not bloat with the sub-agent's intermediate turns.
- Sub-agents can run in parallel and their failures must be contained without affecting peers.






## Trade-offs


### Advantages

- True parallelism without write collisions — each agent has its own sandbox.

- Failed subagents leave their workspace as forensic evidence for debugging.




### Considerations & Drawbacks

- Setup latency — provisioning isolated workspaces adds cold-start overhead.

- Reconciliation conflicts when multiple subagents touch overlapping files.







---
**Reference**: [Original Source](https://www.agentpatternscatalog.org/patterns/subagent-isolation/)

