How to Use Multiple Agents in VS Code — Agents Window, Worktrees, and Subagents

How to Use Multiple Agents in VS Code — Agents Window, Worktrees, and Subagents

Summary — VS Code multi-agent work means three things: (1) running several agent sessions at the same time in the Agents window, (2) letting a main agent hand work to subagents inside one conversation, and (3) using different agents side by side, such as Copilot, Claude, and Codex. This guide shows how to turn each one on, what you gain, and what to watch for, based on official documentation and published research. (Accurate as of November 2026. Some features are in preview or experimental, so names and behavior may change.)

0. The short version

What you want Feature How to turn it on
Work on two or three unrelated tasks at once Agents window + New Worktree Open in Agents in the title bar → New Session → choose New Worktree
Keep long research or review out of the main chat Subagents Ask “use a subagent to investigate…” or define a dedicated agent in .github/agents/*.agent.md
Use Claude or Codex alongside Copilot Agent harness choice Pick Copilot, Claude, or Codex when you start a session
Run several Claude Code agents inside VS Code Claude Code extension Install the extension → Open in New Tab for more conversations, or claude --worktree <name> in the terminal

The rule to remember: a separate conversation does not separate files. To change the same repository in parallel, give each session its own worktree.


1. Why run more than one agent

With a single agent, you wait. You watch the screen for ten minutes while tests run, or you get impatient and slip a second request into the same conversation. Now two tasks share one context, and the agent forgets the first task or mixes the files of both.

Multi-agent work addresses this from two directions.

  • It removes your waiting time. Independent tasks go to their own sessions, and you move to reviewing results.
  • It keeps the agent’s context clean. Work with lots of intermediate output, such as exploration, runs in a separate context and returns only a summary.

Our multi-agent systems post covered the same principle as “separate the author from the reviewer”. This post focuses on how to actually switch it on in VS Code.

2. Three things “multi-agent” means in VS Code

The terms get mixed up, so here is the distinction first.

Three multi-agent modes in VS Code: parallel sessions in the Agents window, subagents inside one session, and a choice of Copilot, Claude, or Codex harness
Mode Structure Context File isolation Good for
Parallel sessions You start several sessions Fully separate per session Only if you choose a worktree Features and fixes that do not depend on each other
Subagents The main agent delegates a subtask The subagent works in its own context and returns a result Same folder by default Codebase research, comparing approaches, reviewing changes
Harness choice A different agent runtime per session Per session Depends on session settings Matching work to a model’s and toolset’s strengths

A harness is the runtime around a model that performs tool calls, file edits, and permission checks. The VS Code documentation draws the line clearly: changing the model does not change the harness. We covered the concept itself in What Is Harness Engineering?.

3. What you need

  • A current VS Code. The Agents window ships in recent releases, so update first.
  • An account. Signing in with a GitHub Copilot plan is the default path. According to the docs, a supported provider account or an API key can also grant access, and requirements vary by harness.
  • A Git repository. Worktrees need a Git repository with at least one commit.
  • Working tests. You need a way to verify what the parallel sessions produce. Without tests, more output only means more review.
  • A policy check. On a company account, administrators may restrict agents, models, and tools. Claude and Codex harnesses are disabled when enterprise-managed settings apply.

4. Method A — Parallel sessions in the Agents window

This is the most direct route. The Agents window is a dedicated window for delegating tasks and reviewing the results in one place.

1) Open the Agents window in one of three ways.

  • Open in Agents in the title bar
  • Chat: Open Agents window from the Command Palette (Ctrl+Shift+P)
  • code --agents from the command line

2) Create a session. Select New Session (Ctrl+N) and pick the folder.

3) Choose the isolation. For a Git repository you choose between two options.

Option Edits go to Requirement Uncommitted files
Branch Your current folder A clean working tree when switching branches Available
New Worktree A separate Git worktree A repository with at least one commit Not copied

For parallel work, choose New Worktree. A worktree is a Git feature that gives you a separate working folder and branch on top of the same repository history. The sessions.useWorktree setting controls the initial choice.

4) Describe the task. State the outcome, constraints, and verification steps, then send. You can change the harness, agent, or model here. Alt+Enter starts the session in the background without leaving the composer.

5) Start the second session. Select New Session again; you do not need to wait for the first one. Right-click a session and choose Open to the Side to see two at once.

6) Review and integrate. Open Changes in the Secondary Side Bar to see each session’s edits. You can select a range in a diff and leave feedback for the agent, and run tests from that session’s terminal. For a worktree session, merge the reviewed branch or use Create PR.

Six things to put in each brief

The official guide on delegating two tasks recommends a short brief per task.

Item Content
Outcome The observable change
Allowed files Implementation and test files the agent may edit
Acceptance criteria Behavior or test results that prove completion
Behavior to preserve Existing behavior that must not change
Out of scope Files to avoid, including the other task’s area
Validation Test commands and manual checks

Put the two briefs side by side and confirm that the allowed files do not overlap. That is where parallel work starts.

Parallel workflow: split the work, create a worktree per session, delegate in parallel, review each session, merge one at a time, retest the integration branch

Where people get stuck

  • Ignored files are missing from the worktree. Files Git ignores, such as node_modules or .env, are not copied into a new worktree. Install dependencies in each worktree, or list files to copy with git.worktreeIncludeFiles.
  • Ports and databases are shared. A worktree only separates files. Two sessions starting a dev server on the same port, or using the same test database, will collide.
  • The Commit button skips hooks. According to the docs, Commit in the Agents window runs git commit --no-verify. Run your required checks yourself before committing.
  • Check the session before you type. Confirm which session is active before sending feedback or running a command.

5. Method B — Delegating to subagents inside one conversation

Subagents exist to protect the main conversation’s context. A subagent works in its own context and returns a focused result to the main agent. The trail of dozens of files it read never lands in your main chat.

The easiest way is simply to ask.

Use a subagent to find how authentication works in this codebase.
Do not modify any files. Return the relevant file paths and a summary of the flow.

The official docs say a Local-harness subagent does not inherit the main conversation history (check the docs for other harnesses). Either way, it is safer to state four things when you delegate: the goal, context, allowed actions, and expected result.

For roles you reuse, define a dedicated agent. Create an .agent.md file under .github/agents/ in your workspace.

---
name: Config Auditor
description: Locate configuration files and summarize how settings are loaded
user-invocable: false
tools: ['read', 'search']
---
Locate configuration files relevant to the requested topic.
Do not modify any files.
Return file paths, how each setting is loaded, and open questions.
Property Meaning
tools Tools this agent may use. Read and search only gives you a research agent with no edit rights
user-invocable Whether it appears in the agents dropdown (default true)
disable-model-invocation Whether other agents are blocked from invoking it as a subagent (default false)
agents Which subagents a coordinator may call. [] prevents subagent use
model The model, or a prioritized list of models, for this agent

Assigning a lighter model to research agents and a stronger one to design and judgment helps control cost.

Behavior depends on the harness. The Copilot harness delegates through its own task tool, and the Claude and Codex harnesses use each provider’s subagent system. The older Local harness and its runSubagent tool are scheduled for removal in February 2027, so build new workflows on the Copilot harness.

6. Method C — Multiple agents with the Claude Code extension

If Claude Code is your main tool, the VS Code extension alone gives you a multi-agent setup. Installation is covered in Setting Up an AI Agent Practice Environment, so this section covers only the parallel parts.

  • Install. Search for “Claude Code” in the Extensions view (Ctrl+Shift+X). You need VS Code 1.94.0 or later and a paid Claude plan or a Console account.
  • Open several conversations. Use Claude Code: Open in New Tab (Ctrl+Shift+Esc) or Open in New Window from the Command Palette. Each conversation keeps its own history and context.
  • Read the status. A colored dot on the tab icon tells you the state: blue means a permission request is pending, orange means Claude finished while the tab was hidden.
  • See the subagents. When a conversation has subagents, an agent count appears below the prompt box. Click it for a tree with status, elapsed time, and token count. /tasks opens the same view.
  • Isolate with a worktree. Run this in the integrated terminal with a name.
claude --worktree feature-auth

By default the worktree is created under .claude/worktrees/<name>/ at the repository root, on a new branch named worktree-<name>. Run the command again with a different name in another terminal for a second isolated session. To always run a subagent in its own worktree, add isolation: worktree to its definition in .claude/agents/. To carry ignored files such as .env into each worktree, add a .worktreeinclude file at the project root.

7. What you gain

1. Waiting time turns into review time. Independent tasks progress together, so you spend less time waiting for one to finish. Anthropic reports that parallel tool calls and subagents cut research time by up to 90% for complex queries in its own research system. Note that this figure is for research work.

2. The main conversation’s context stays clean. Files read during exploration and failed attempts do not pile up in the main chat; only the subagent’s summary comes back. A less crowded context is generally thought to make earlier instructions less likely to get buried in a long task (a general design principle, not a figure measured in the sources cited here). This is the same context management we discussed in Prompt Engineering vs. Context Engineering.

3. Splitting roles lets you split permissions. Give the research agent read and search tools only, and give edit rights to the implementation agent alone. That is least privilege applied to agents.

4. You can separate the author from the reviewer. An agent reviewing its own code tends to wave through its own assumptions. Handing the review to an agent with a different context, or a different model, separates the viewpoints.

5. Changes are physically separated. With worktrees, each task has its own branch and folder. If one task fails, you discard that worktree only, and you can review task by task.

6. You can pick the agent that fits the job. Copilot, Claude, and Codex sessions appear together in one place, so you spend less effort tracking state across tools.

There is performance evidence too. In Anthropic’s internal research evaluation, a multi-agent system with a lead agent and subagents outperformed a single agent by 90.2%. The gain comes from subagents exploring in parallel in their own context windows and returning only the condensed, important findings.

8. Costs and limits — it is not all upside

Limit What it means What to do
Token cost According to Anthropic, agents use about 4× the tokens of chat, and multi-agent systems about 15× Use it only when the task’s value exceeds the cost, and run research subagents on a lighter model
Coding parallelizes less The same article notes that most coding tasks have fewer truly parallelizable parts than research Parallelize only tasks whose files do not overlap
Shared-file conflicts Two tasks touching dependency manifests, API contracts, generated files, or shared styles will conflict Finish and validate the shared change first, then parallelize the rest
A worktree is not a security boundary It separates files only; the agent can still reach your machine and external services Set a permission level per session, and do not copy production credentials into worktrees
Passing alone ≠ passing together Tests passing in each worktree does not prove the combined change works Merge one at a time and retest on the integration branch
The review bottleneck More agents do not make you review faster Start with two or three at once and run only as many as you can review

The last one is the wall teams hit first. When five agents finish together, you have five diffs to read. Before adding more parallel sessions, automate verification (tests, lint, type checks) so the gain from parallelism survives. Note that “start with two or three” is the author’s starting recommendation, not a figure from the official docs.

9. When to use it and when not to

Situation Recommendation
A one-line fix or quick lookup Ask one agent directly
Exploring an unfamiliar codebase, comparing approaches Subagent
You need an independent review after implementation Subagent (review only, read access only)
Two or three features with no overlapping files Parallel sessions + worktrees
Two tasks must design the same new API shape Go sequentially — settle the shared part first
Work must continue with your laptop closed Consider cloud sessions (experimental) or remote sessions

10. Checklist before you start

  • [ ] VS Code is up to date and you are signed in
  • [ ] The repository has commits and a clean working tree (git status --short prints nothing)
  • [ ] Existing tests pass
  • [ ] Each brief lists allowed files and out-of-scope items, and they do not overlap
  • [ ] Each session uses New Worktree (confirm different paths with git worktree list)
  • [ ] Dependencies are installed per worktree, and ports and databases do not collide
  • [ ] You reviewed each session’s diff and ran the tests yourself
  • [ ] You merged one at a time and retested on the integration branch
  • [ ] You did not delete a session or worktree that still holds unpreserved work

11. Takeaways

  • VS Code multi-agent work comes in three forms: parallel sessions, subagents, and harness choice. They serve different purposes, so choose rather than mix.
  • The key to parallel sessions is the worktree. Opening or forking a conversation does not separate files.
  • The key to subagents is context isolation. Move research and review out to keep the main conversation clean.
  • The gains are less waiting, a protected context, split permissions, cross-review, and separated changes.
  • The price is token cost and review load. Start with two or three independent tasks, and automate verification first.

12. References

The claims above are the author’s summary and interpretation of the sources below. Feature names and behavior vary by version, so check the originals.

This post is based on public documentation as of November 2026. Preview and experimental features may change in name and behavior, and some may be unavailable under your organization’s policies.

질문이나 지적할 부분이 있으면 문의로 알려주세요.

Questions or corrections? Let us know via Contact.

AI

AI map Ontology

기업 IT·데이터 조직에서 20년 넘게 실무를 해온 사람이 씁니다. 모든 사례는 익명화·일반화합니다. 소개 보기 →

AI

AI map Ontology

Written by someone with 20+ years in enterprise IT and data. All cases are anonymized and generalized. About us →

다음으로 읽어볼 글

개념을 이해했다면, 실제 설계와 활용 방법을 이어서 살펴보세요.

온톨로지 Foundry AIP 기업 AI 전략

Keep reading

Once you understand the concept, continue on to real design and usage patterns.

Ontology Foundry AIP Enterprise AI Strategy