Back

Subagents: Parallel Execution and Context Isolation

Channel Visual Studio Code
Date February 9, 2026
Duration 29:41
TL;DR

Harald Kirschner from the VS Code team explains how subagents work in VS Code's Copilot—isolated agent loops with their own context windows that can run tasks in parallel without bloating the main agent's context. Subagents enable efficient delegation of specialized tasks like code research, security reviews, and parallel implementation, returning only summarized results to the orchestrating agent.

Key Takeaways

Summary

The Agent Loop Fundamentals

The agentic loop in VS Code starts with a user question, a system prompt defining behavior, and access to tools. The agent reasons about the task, calls tools (like search or file reads), and accumulates results in a conversation—building up the context window. VS Code exposes powerful search tools and allows parallel tool calls, so the agent can efficiently gather information before synthesizing an answer.

How Subagents Differ

A subagent is essentially a "delegate"—like asking a colleague to research a topic and report back. It runs its own agent loop with isolated context, performs the assigned task (file searches, code exploration, hypothesis testing), and returns only a condensed summary. The parent agent sees just the task request and the result, not all the intermediate exploration.

Practical Subagent Use Cases

Code Review Parallelization: Instead of one agent reading all files and running out of context, spawn multiple subagents:

Each returns focused findings without polluting the main context.

Plan Mode Benefits: When using plan mode, exploration already runs in subagents automatically. The planning agent gives research tasks to subagents, which return findings while the main planning context stays clean.

Day-to-Day Development Tips

Custom Agents as Subagents

Create custom agents with specific descriptions like "use when understanding cross-repo dependencies." The main agent will automatically invoke them when the task matches. Key differences from skills:

Model Optimization Strategy

Harald's "Loop" orchestrator pattern demonstrates strategic model selection:

  1. Fast context gathering: Mini model quickly scans files, writes findings to a scratch file
  2. Deep planning: Larger reasoning model (Opus, GPT-5.2 Codex) analyzes the scratch pad
  3. Parallel implementation: Fast code-writing models churn through the detailed plan
  4. Quality review: Larger model reviews all changes, catches divergence from plan

This approach optimizes for speed, cost, and quality—avoiding the "everything in Opus" anti-pattern.

Notable Quotes

"The subagent basically is its own agent loop with its own context. And most often, the best way to describe it is you want to delegate something."

"All you get back is like, this is what I found. And then maybe some confidence with it as well. So that's the sub-agent solution, that context isolation to do a specific task."

"We have this context indicator now. So you see in a conversation, how much context the agent has built up. So it's much easier to understand how that agent loop works."

"If you have something that has to be rock solid and really deterministic and a workflow you really want to get down to the right steps, then that would be a custom agent."

"I just want to see it happening. I don't want Opus building a beautiful coded UI. I just want to figure out what is that critical thing I'm missing and iterate fast."

Chapters

Time Topic
00:00Introduction and Overview
03:01Understanding Agents and Context
08:04Sub-Agents and Context Isolation
13:51Daily Development Practices
17:52Custom Agents and Orchestration
24:22Model Selection and Performance

References & Resources

From Description

Mentioned in Video