Breaking a Monolithic AI Research Agent into a Multi-Agent System with LangGraph
Multi-agent architectures promise modularity but frequently collapse under coordination overhead. This walkthrough shows a concrete, incremental migration path from a monolithic LangGraph agent to a supervised multi-agent system, with measurable improvements in testability, traceability, and code organization, while explicitly acknowledging when MAS is the wrong call.
The original DeepResearchSystem ran its entire pipeline inside one LangGraph state graph, which violated single-responsibility principles and made testing, reuse, and debugging difficult. The refactor introduces a Multi-Agent System (MAS) with three specialized subgraphs: a main supervisor that handles planning and HITL routing, a research agent that runs the query-search-critique loop, and a writer agent that now follows an outline-draft-review-polish workflow with structured critic feedback and revision loops.
Code organization improves sharply: the research and writer subgraphs become independently mockable, reusable across different applications, and produce clear hierarchical traces in LangSmith. The writer agent gains a dedicated critic that returns structured JSON feedback with severity ratings, and a routing function that either sends the draft back for revision or advances it to final polish once quality thresholds or max revision counts are met.
The piece also grounds the design choice in the broader MAS debate, citing the “Why Do Multi-Agent LLM Systems Fail?” paper’s 14 failure modes and arguing that coordination overhead often cancels out the gains of adding agents. The practical takeaway is a “single first, then split” engineering heuristic: start with one agent, measure where it breaks, and only then introduce additional agents with a clear justification.
Refactoring to MAS is framed as an engineering discipline problem, not an AI capability problem; the driver is code organization, testability, and team-scale development cycles, not better model output.
The writer agent’s outline-draft-review-polish pipeline mirrors a human editorial workflow and introduces a structured critic that produces machine-readable feedback, which is a practical pattern for any system that generates long-form content.
The explicit comparison table between single-agent and MAS architectures surfaces concrete metrics like file line count, mock cost, and trace structure, which are rarely quantified in MAS discussions.
The article’s conclusion that MAS should only be adopted with a clear justification, and that single-agent baselines should come first, pushes against the common hype of adding agents for their own sake.