Heuristic Mode
LangChain Nov 26, 2026 tutorial default-text

What Are Subagents? Explained in 4 Minutes

Summary

LangChain's Deep Agents harness treats subagents as a context-management primitive: the main agent delegates a scoped task, the subagent burns its own fresh context window on the messy intermediate work, and only the distilled result is returned upstream. This keeps the orchestrator's window focused on planning rather than tool noise, and lets work fan out in parallel or in the background. Engineers care because it turns context budget into an architectural decision instead of a prompt-tuning problem.

Key takeaways

  • Delegate by task boundary, not by tool call: a subagent should own a self-contained job whose intermediate steps the main agent never needs to see.
  • Subagents are an isolation mechanism first and a parallelism mechanism second — each one gets a clean context window, which caps how much noise leaks back into the orchestrator.
  • Parallel and async/background subagents suit independent, latency-tolerant work; specialist subagents suit narrow domains where a focused prompt and toolset outperform a generalist.
  • Subagent context stays lean through offloading large artifacts (e.g., into a sandbox/filesystem) and summarizing prior steps rather than re-reading them.
  • Skip subagents for small or tightly coupled tasks — the handoff and summarization overhead outweighs the context savings.

Key moments