# Parallel sessions and subagents

> An engineer can run several tasks at once by starting several agents, each in its own copy of the repository. Inside a session, specialized subagents take on part of the work. At software factory scale, an orchestrator agent hands out the tasks.

A parallel session is a full instance of the agent, on its own task, in its own worktree, with no knowledge of the others. A subagent runs inside a session, with its own context window and limited tools. It checks the app, simplifies code or explores the codebase without cluttering the main agent.

The useful number of sessions depends on how much one person can review properly. Start with two or three and add more only if review keeps up. Tasks that touch the same files stay in a single session. The work-in-progress limit applies (see Agile, Lean and DevOps with agents): finish one task before starting another.

In a factory, an orchestrator agent plans, delegates to specialized agents (debugging, impact analysis, code generation, testing) and tracks their progress. It is called a swarm when agents cooperate and an orchestrator merges their results. Tasks that are just launched side by side each run on their own.

More sessions produce more code. Hooks and permissions therefore belong in the repository configuration, so they apply to every session.

**When**: When someone often sits waiting for an agent to finish, or when a task splits into independent parts.

**Trade-offs**: Throughput goes up, and so do review load and merge conflicts. An orchestrator coordinates better than one person can, at the cost of behavior that is harder to follow.

## Where to start

- Split the plan into tasks that touch separate files
- Open one worktree per task
- Start with two or three sessions
- Define subagents for repeated tasks in the repository

## Common mistakes

- Running more sessions than review can absorb
- Having two sessions work on the same files
- Confusing parallel tasks with agent coordination

## Metrics

- Concurrent sessions per team at steady review quality
- Changes merged per week, weighed against the rework rate

## Sources

- [Anthropic, The AI-native SDLC playbook](https://claude.com/fr/resources/articles/the-ai-native-sdlc-playbook)
- [Warp, The Factory Stack](https://www.warp.dev/blog/the-factory-stack)
- [Potpie, vendor site (layered agent architecture)](https://potpie.ai/)
