Running multiple GitHub Copilot agents at the same time — VS Code agents, Cloud agents, and GitHub.com agents — is becoming common in agentic development workflows. But letting 10+ agents loose in one repository without a plan is a recipe for merge conflicts, stale branches, and PR chaos. Here's a layered architecture pattern that keeps things sane.
Availability: Copilot Pro, Pro+, Business, and Enterprise plans.
The core problem: uncontrolled parallelism
By default, each Copilot coding agent follows the same lifecycle:
Task → Branch → Commits → Draft PR → Human Review → Merge
That works fine for a single agent. But when multiple agents run concurrently, they collide:
| Agent | Branch | Touches |
|---|---|---|
| Agent A | feature/add-api |
api.py |
| Agent B | feature/add-logging |
api.py |
| Agent C | feature/refactor-auth |
auth.py |
When Agent A merges first, Agent B's branch becomes stale. CI starts failing on both, and the reviewer queue fills up fast. Git was built for humans working sequentially — not parallel autonomous agents operating at machine speed.
Layer 1 — Planner Agent: coordinate before you act
The first fix is a Planner Agent that decomposes the overall task before any worker agent touches the repo. Think of it as a project manager that assigns non-overlapping work packages:
| Task | Assigned Agent |
|---|---|
| API logging | Agent-Backend |
| UI component | Agent-Frontend |
| Tests | Agent-Test |
| Documentation | Agent-Docs |
The Planner produces a task graph that prevents two agents from being assigned the same files. This single step eliminates most conflicts before any code is written.
Layer 2 — Domain ownership: partition the repo
Give each agent an exclusive path in the repository. A CODEOWNERS file enforces this at the PR level:
/frontend/* @agent-frontend
/backend/* @agent-backend
/infrastructure/* @agent-infra
/tests/* @agent-tests
/docs/* @agent-docs
With domain ownership in place, agents can work in parallel without stepping on each other. File-level conflicts drop dramatically because no two agents are allowed in the same directory.
Layer 3 — PR queue: serialize the merge
Even with domain ownership, merging all agent PRs simultaneously can break the integration branch. A PR queue serializes the process:
Agent PRs → PR Queue → Auto-Rebase → CI Validation → Merge
Each PR waits its turn. Before merging, it's automatically rebased onto the latest main and validated by CI. A minimal pipeline step looks like this:
git fetch origin main
git rebase origin/main
./run-tests.sh
The queue prevents the "last PR standing" problem where two agents both think they're merging onto a clean base.
Layer 4 — Worktrees: isolate the filesystem
For agents that run locally (VS Code agents, CLI agents), use Git worktrees to give each agent its own working directory:
repo/
├── worktree-agent1/
├── worktree-agent2/
└── worktree-agent3/
Worktrees share the same .git database but operate on separate branches and filesystems. No agent can accidentally overwrite another's in-progress changes, and branch management stays clean.
Layer 5 — Keep PRs small
Large PRs are statistically more likely to fail CI and get rejected. Enforce strict size limits for agent-generated PRs:
| Metric | Recommended limit |
|---|---|
| Files modified | < 5 |
| Lines changed | < 300 |
Small PRs are faster to review, easier to rebase, and less likely to conflict with parallel work.
Recommended branch strategy
Avoid letting agents open PRs directly to main. Use an integration branch as a buffer:
copilot/feature-x → integration → main
Agent PRs target integration. Once validated in batch, integration merges to main. This protects production from any individual agent mistake and allows bulk CI validation before anything reaches the default branch.
Putting it all together: 10-agent architecture
Planner Agent
│
┌───────────┴───────────┐
│ │
Backend Agents (3) Frontend Agents (3)
│ │
Test Agents (2) Docs Agent (1)
│
Infra Agent (1)
Each group of agents operates in its own domain. The Planner coordinates task assignment. Agent PRs flow through the queue. CI validates. Humans review and merge.
Known limitations
Even with this architecture in place, multi-agent development has real constraints:
- Agents don't coordinate with each other — there's no shared state between running agents.
- Git assumes sequential commits — the rebase step is essential but adds latency.
- PR review becomes the bottleneck — more agents means more PRs landing simultaneously.
- CI instability — concurrent PRs can surface flaky tests that appear only under parallel load.
Multi-agent coding is an emerging paradigm. These patterns reduce friction significantly, but they don't eliminate the need for human oversight on the merge queue.
Key takeaways
- Introduce a Planner Agent to decompose tasks before agents start.
- Enforce domain ownership with
CODEOWNERSto prevent file-level collisions. - Use a PR queue with auto-rebase to serialize merges safely.
- Use Git worktrees for filesystem isolation when running agents locally.
- Keep agent PRs small (<5 files, <300 lines) to improve merge success rates.
- Route agent PRs through an integration branch before touching
main.
Together, these layers typically reduce merge conflicts by 60–80% compared to uncontrolled parallel agent execution.