βImplement the Writer Agent in LangGraph to transform verified research, source citations, and identified conflicts into structured, academic-grade AI research reportsβ
In Part 10 of our Autonomous Deep Research Agent series, we implement the Writer Node, the final component of our multi-agent research architecture.
So far, we've implemented three core agents:
Planner Agent: Creates the research strategy and breaks down the research question.
Researcher Agent: Searches the web and gathers relevant information, sources, and citations.
Critic Agent: Verifies sources, evaluates evidence, and identifies conflicting claims.
Now, we bring everything together through the Writer Agent.
The Writer Agent needs more than raw research data. We prepare structured source context containing:
Source IDs and titles
Source types and URLs
Confidence scores
Citation references
Matching research snippets
We also prepare a separate conflict context containing claims, competing sources, and descriptions of identified conflicts.
This gives the LLM the necessary evidence to generate a well-supported report.
We create a dedicated system prompt instructing the LLM to behave as an expert research writer.
The output follows a structured JSON format containing:
Executive summary
Multiple report sections
Section headings and content
Inline citation references
This structure allows the frontend to render the generated report section by section.
We parse the LLM response using JSON and map the generated sections into our Pydantic ReportSection model.
We also implement exception handling and fallback responses to prevent report-generation failures from breaking the workflow.
This ensures that the application maintains a predictable report structure even when the LLM returns an invalid response.
With the Writer Node implemented, all four core agents are now ready:
Planner
Researcher
Critic
Writer
The next step is to connect these individual agents into a complete execution pipeline using LangGraph.
The following diagram illustrates how the four agents contribute to the final research report.
Generating Architecture Diagramβ¦
What's Next?
In Part 11, we'll connect the Planner, Researcher, Critic, and Writer agents using LangGraph to create the complete autonomous research workflow.
Subscribe to sn dev for more practical AI Engineering, Agentic AI, LangGraph, and full-stack AI projects.
Continue following "Deep Research Agent" with Building a Multi-Agent Workflow with LangGraph | Deep Research Agent β Part 11.
Ask questions, discuss architecture, and share insights with other developers.
Sign in to join the discussion and share your thoughts with other developers.
Sign In to Comment