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.
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.
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.
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.
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:
Harald's "Loop" orchestrator pattern demonstrates strategic model selection:
This approach optimizes for speed, cost, and quality—avoiding the "everything in Opus" anti-pattern.
"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."
| Time | Topic |
|---|---|
| 00:00 | Introduction and Overview |
| 03:01 | Understanding Agents and Context |
| 08:04 | Sub-Agents and Context Isolation |
| 13:51 | Daily Development Practices |
| 17:52 | Custom Agents and Orchestration |
| 24:22 | Model Selection and Performance |