βBuild a Critic Agent for an AI Deep Research system using LangGraph, LLM-based conflict detection, claim cross-referencing, and structured conflict flags.β
In a deep research system, collecting information from multiple sources is only the first step. Different sources may present conflicting statistics, disagree on conclusions, report different timelines, or interpret the same findings differently.
Before generating the final research report, we need a mechanism to analyze the collected information and identify potential conflicts.
In this chapter of our Autonomous Deep Research Agent series, we build the Critic Agent β a quality-control component responsible for analyzing research gathered by the Researcher Agent, extracting important claims, identifying potential contradictions, and cross-referencing those claims against our collected sources.
Our Researcher Agent gathers information from multiple sources, including web pages and academic papers. However, simply collecting sources doesn't guarantee that the information is consistent.
For example, two sources may report different statistics about the same subject. One source might claim a technology is widely adopted, while another reports limited adoption. These differences could be caused by different methodologies, publication dates, geographic regions, or genuinely contradictory findings.
Without a dedicated analysis stage, our Writer Agent could combine these conflicting claims into a report without properly highlighting the disagreement.
The Critic Agent introduces a dedicated quality-control step before report generation.
The Critic Agent operates after the Researcher Agent has collected and organized the relevant sources.
Generating Architecture Diagramβ¦
The Critic does not perform the initial research. Instead, it works with the evidence already collected by the Researcher Agent.
Its job is to analyze that evidence and provide structured information about potential conflicts that can be used during report generation.
Rather than sending entire documents to the LLM, we prepare a compact representation of the collected research.
The Critic receives a limited set of source summaries, including:
Source type
Source title
Relevant snippet
Information extracted during the research process
In our implementation, the Critic analyzes the top 12 sources. Each source snippet is limited to approximately 300 characters to keep the input focused and manageable.
This gives the model enough contextual information to compare sources without unnecessarily increasing the context size.
The Critic Agent is guided by a system prompt that defines its role as a research critic.
Its primary responsibilities include identifying:
Contradictory claims
Conflicting statistics
Inconsistent timelines
Differences in reported conclusions
Subtle disagreements between sources
Instead of producing an unrestricted summary, the model is expected to return structured JSON containing key claims and potential conflicts.
This structured output makes it easier for the rest of our pipeline to consume the Critic's analysis programmatically.
LLM-generated criticism can itself be unreliable. A model might identify a conflict that doesn't actually exist in the collected evidence or misrepresent what a source says.
To reduce this risk, we introduce a cross-referencing step.
After the Critic extracts claims and potential conflicts, we pass the claims through our existing cross_reference_claims tool. This tool checks whether the extracted claims appear to be supported by the collected research sources.
Our current implementation uses keyword-based matching. It extracts keywords from a claim and checks for matching terms in source titles and snippets. Claims with at least two matching keywords are considered a potential match.
This is a lightweight verification heuristic, not semantic fact verification. It helps detect unsupported claims but cannot guarantee that a claim is factually correct or that the source genuinely supports its meaning.
Once the Critic has analyzed the research and the cross-referencing step has been performed, we transform the identified conflicts into structured ConflictFlag objects.
Each conflict flag contains information such as:
The conflicting claim
Source A
Source B
A description of the disagreement
This structured representation is important because downstream agents shouldn't have to interpret an unstructured block of text every time they need to understand a conflict.
Instead, the Writer Agent can receive explicit conflict information and use it while generating the final research report.
Generating Architecture Diagramβ¦
The Critic Agent is part of our LangGraph workflow, so it operates on the shared AgentState.
After processing the research, it updates the state with the extracted claims and structured conflict information.
This allows the next node in our graph to access the critic's output without requiring a separate communication mechanism between agents.
The result is a workflow in which every agent performs a specialized task while passing relevant information through a shared state.
The Critic Agent introduces a separation of responsibilities into our research pipeline.
Researcher Agent: Collects and organizes information.
Critic Agent: Analyzes the collected research and identifies potential conflicts.
Writer Agent: Uses research and criticism to produce the final report.
This separation makes the pipeline easier to extend, debug, and improve. It also creates clear boundaries between information gathering, quality analysis, and report generation.
The Critic is not intended to be a definitive fact-checker. Its purpose is to surface disagreements and potential inconsistencies so they can be handled explicitly rather than silently merged into the final answer.
We've now added the Critic Agent to our Autonomous Deep Research Agent.
Our pipeline can collect research, analyze potential conflicts, cross-reference claims against collected sources, and create structured conflict flags.
The next step is to build the Writer Agent, which will transform our collected research, citations, and critic analysis into a structured research report.
We are gradually building a complete autonomous research workflow β one specialized agent at a time.
This project is being built step by step as part of the Autonomous Deep Research Agent series on SN Dev.
YouTube: SN Dev
GitHub Repository: Autonomous Deep Research Agent
Website: sndev.co
Continue following "Deep Research Agent" with Building the Writer Agent β Generating Structured AI Research Reports | Part 10.
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