GenAiHub
Agents

LangChain Introduces Forked Subagents for Context Inheritance in Deep Agents

2 min read · 343 wordsAI-curated · Powered by AtmezAI
LangChain Introduces Forked Subagents for Context Inheritance in Deep Agents

LangChain has introduced forked subagents in the latest version of Deep Agents. Isolated subagents start fresh and may repeat work such as file reads. Forked subagents inherit the supervisor's conversation history, which can be faster and cheaper thanks to prompt caching. New context modes specify isolated or fork behavior. Supervisors still receive only the final outcome while subagents use prior context on delegated worker and reviewer tasks.

LangChain has introduced forked subagents in the latest version of Deep Agents, a change that lets subagents inherit a supervisor agent's full conversation instead of beginning with an empty context window. Most harnesses already support a subagents feature so a supervisor agent can spawn new tasks. Subagents enable parallel reasoning and context isolation, allowing a supervisor to delegate work without polluting its own context window. Isolated subagents, which remain the default, typically complete a task in a fresh context window. That design can produce waste, because subagents may redo context-gathering operations such as file reads that the supervisor has already performed. For cases where subagents can benefit from the supervisor agent's context, the company built forked subagents. These inherit the supervisor's full conversation rather than starting fresh. Forking can be faster and cheaper than isolated subagents, since reusing the supervisor's conversation takes advantage of prompt caching and reduces repeated work. To specify what context subagents receive, LangChain added context modes with supported values of "isolated" and "fork". When mode is set to fork, the supervisor's current state propagates to the subagents instead of starting empty. This is effectively a forked continuation of the current thread, with an added directive written by the supervisor, that is finally unwound into a single tool result read by the supervisor. The mechanics are specific. Supervisor agents generate a tool call invoking the subagent with a task description. The subagent receives the entire supervisor agent's state, including conversation history. The trailing tool call is excised, and its task description is formatted into a user message alongside a fixed preamble clarifying its role. When the subagent finishes, the supervisor receives its final message as a response to the originating tool call. The supervisor typically still receives just the outcome of a task; intermediate reasoning stays withheld from its context window. The supervisor pattern, in which a supervisor maintains a plan and delegates work to specialized subagents such as workers for well-scoped implementation or reviewers for independent judgment, remains one of the most generalizable multi-agent architectures adopted by coding harnesses.

Verified sources · 1