LangChain introduces dynamic subagents in Deep Agents, a feature that lets AI agents write short orchestration scripts (JavaScript) to dispatch and manage subagents programmatically rather than through sequential tool calls. This approach solves two key problems: deterministic coverage at scale (e.g., processing 300 pages via a loop instead of 300 tool calls) and reliable complex orchestration with fan-out, branching, and multi-phase pipelines. The post covers six orchestration patterns — classify and act, fanout and synthesize, adversarial verification, generate and filter, tournament, and loop until done — with live traces for each. Setup requires installing the QuickJS middleware and using the CodeInterpreterMiddleware with create_deep_agent, or using the dcode terminal agent which ships with the feature enabled out of the box.

9m read timeFrom langchain.com
Post cover image
Table of contents
Why dynamic subagents?QuickstartHow it worksCommon Orchestration PatternsConclusion