Critic and Reviewer Agents
Earn 25 points (50 with Pro) in two steps
- ① Read through the lesson — each section gets a ✓ as you scroll through it.
- ② When every section has a ✓, tap Complete lesson.
0 of 10 read · keep scrolling
✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro
Module: Multi-Agent Coordination
Lesson: Critic and Reviewer Agents
Introduction: The Necessity of Reflection in AI Systems
In the early days of large language model (LLM) implementation, developers often treated AI interactions as linear, single-shot processes. You provided a prompt, the model generated a response, and the system accepted that output as the final truth. However, as we move toward building autonomous systems capable of complex reasoning, coding, or content generation, this linear approach reveals its limitations. AI models, while powerful, are prone to "hallucinations," logic errors, and stylistic inconsistencies. They lack an inherent mechanism to self-correct during the generation process.
This is where the concept of Critic and Reviewer agents becomes critical. By introducing a hierarchical structure where one agent generates content and another evaluates it, we simulate a professional editorial workflow. Much like a junior writer sends a draft to a senior editor, or a developer submits code for a peer review, Critic and Reviewer agents provide a structured feedback loop. This architecture allows the system to identify flaws, verify facts, and iterate on quality before the final output reaches the end user.
Understanding these roles is essential for anyone looking to build reliable, high-performing multi-agent systems. It shifts the burden of accuracy from a single, potentially flawed generation to a collaborative, multi-stage verification process. In this lesson, we will explore how to define these roles, how to design their interactions, and how to implement them in your own agentic workflows.
Not read yet
Understanding the Roles: Generator vs. Critic
To implement a successful multi-agent system, we must first clearly define the responsibilities of each participant. The division of labor is rarely just about who does the work; it is about the specific cognitive framing we provide to each agent through system prompts and context.
The Generator Agent
The Generator is the creative engine. Its primary directive is to produce content, code, or data based on the user's initial requirements. It operates with a "get it done" mindset. Because its primary goal is output, it may occasionally sacrifice depth or precision for speed or creative flow. It should be encouraged to explore ideas, but it does not need to be perfect on the first attempt because it knows a reviewer is waiting to catch its mistakes.
The Critic/Reviewer Agent
The Critic (sometimes called a Reviewer or Evaluator) is the analytical engine. Its directive is not to create, but to inspect. The Critic is provided with a set of criteria—a rubric—that defines what "good" looks like. This agent is tasked with finding gaps, pointing out errors, and providing actionable feedback. It should be adversarial in a constructive way, looking for edge cases that the Generator might have overlooked.
Callout: The "Four-Eyes" Principle In professional engineering and publishing, the "four-eyes principle" dictates that two people must approve a decision or piece of work. In AI architecture, this is the fundamental justification for the Critic agent. By separating the generation phase from the evaluation phase, we prevent the model from being trapped in its own logical biases during the drafting process.
Not read yet
Designing the Workflow
A simple generator-critic loop typically follows a four-step process. Designing this loop effectively requires careful orchestration of the agents' prompts and the data shared between them.
- Initial Generation: The Generator receives the user prompt and produces an initial draft.
- Evaluation: The Critic receives the draft along with the original prompt and a rubric. It generates a critique.
- Iteration: The Generator receives the critique and the original draft. It is instructed to revise the content based on the feedback provided.
- Final Approval: The system evaluates if the revision meets the quality threshold. If it passes, it outputs the final result; if not, it loops back to the evaluation stage.
Defining the Rubric
The effectiveness of your Critic agent is entirely dependent on the quality of the rubric you provide. A vague instruction like "Check for quality" will result in a vague critique. Instead, use specific, binary, or scale-based criteria.
- Accuracy: Does the code run without syntax errors? Are the facts verifiable?
- Completeness: Did the agent answer all parts of the user's multi-part question?
- Tone and Style: Does the output meet the brand voice requirements?
- Constraint Satisfaction: Did the output stay within the required word count or format (e.g., JSON only)?
Not read yet
Practical Implementation: A Code Review Example
Let’s look at a concrete example. Imagine we are building an agentic system that writes Python functions for a data processing pipeline. We need a Generator to write the code and a Critic to ensure the code is optimized and follows best practices.
Step 1: The Generator Prompt
The Generator's prompt should be focused on capability and logic.
System Prompt: You are an expert Python developer. Your goal is to write clean, efficient, and well-documented Python code.
Always include type hints and docstrings.
Input: [User Request]
Output: [Code Snippet]
Step 2: The Critic Prompt
The Critic's prompt should be focused on standards, security, and performance.
System Prompt: You are a Senior Software Engineer. You are reviewing code generated by a junior developer.
Your job is to identify:
1. Potential security vulnerabilities (e.g., SQL injection, insecure imports).
2. Performance bottlenecks (e.g., inefficient loops or memory usage).
3. Violations of PEP 8 style guidelines.
4. Missing edge-case handling.
If the code is acceptable, respond with "APPROVED".
If not, provide specific, numbered feedback on what needs to be fixed.
Step 3: The Orchestration Logic
In your application code, you need a loop to manage this interaction. Here is a simplified Python-like structure to demonstrate the logic:
def agent_workflow(user_request):
max_iterations = 3
draft = generator_agent.generate(user_request)
for i in range(max_iterations):
critique = critic_agent.review(user_request, draft)
if "APPROVED" in critique:
return draft
# If not approved, send the critique back to the generator
draft = generator_agent.revise(user_request, draft, critique)
return draft
Note: The
max_iterationsvariable is essential. Without a limit, an agentic system can get stuck in an infinite loop of minor revisions. Always set a hard stop to ensure the system returns a result within a reasonable timeframe.
Not read yet
Best Practices for Agent Coordination
When working with Critic and Reviewer agents, several best practices can significantly improve your results.
1. Provide Examples (Few-Shot Prompting)
Do not just tell the Critic what to look for; show it. Include examples of "bad" code and the corresponding "good" critique in the system prompt. This helps the agent understand the level of scrutiny you expect.
2. Keep the Critic's Scope Narrow
If you have a very complex task, do not use one "Master Critic." Instead, use multiple specialized critics. One agent can focus on security, another on style, and a third on logical correctness. This division of labor prevents the model from "forgetting" instructions due to context window limitations or attention dilution.
3. Log the Interaction History
Always store the history of the conversation between the Generator and the Critic. This allows you to audit the process later. If the final output is poor, you can look back to see if the Critic missed a specific error or if the Generator failed to incorporate the feedback.
4. Human-in-the-Loop Integration
For high-stakes applications, the final step in the chain should be a human review. You can design your workflow so that the Critic acts as a filter, and only if the Critic is "unsure" or gives a low confidence score, does the system escalate the task to a human for final approval.
Not read yet
Common Pitfalls and How to Avoid Them
Even with a strong design, developers often encounter common hurdles when implementing these agents.
The "Feedback Loop of Doom"
Sometimes, the Generator and the Critic get into a cycle where the Generator makes a change that the Critic dislikes, and then the Critic asks for a change that reverts the code to a previous state.
- Solution: Ensure the Generator is aware of the full history of the conversation, not just the last piece of feedback. Additionally, instruct the Critic to be constructive—if they ask for a change, they should explain why it is necessary in the context of the overall goal.
Over-Critiquing (The "Nitpicking" Problem)
Some agents, when given a "critical" persona, tend to find faults where none exist just to fulfill the role. This leads to endless, unnecessary revisions.
- Solution: Include a "confidence threshold" in your prompt. Tell the Critic: "Only provide feedback if the issue is a functional error or a significant style violation. Do not comment on stylistic preferences that do not impact code quality."
Prompt Drift
As the conversation progresses through multiple iterations, the agents may lose sight of the original user requirements.
- Solution: Re-inject the original user prompt at every step of the loop. Never assume the agents remember the original context once the conversation history gets long.
| Feature | Generator Agent | Critic Agent |
|---|---|---|
| Primary Goal | Create, build, draft | Evaluate, check, refine |
| Cognitive Bias | Over-optimistic, creative | Over-cautious, analytical |
| Key Input | User requirements | Draft content + Rubric |
| Success Metric | Completeness, speed | Accuracy, adherence to standards |
Not read yet
Advanced Techniques: Self-Reflection vs. External Review
There are two primary ways to implement the Reviewer role. It is important to distinguish between them as they serve different purposes.
Self-Reflection (Internal Review)
In this model, the same agent acts as both the Generator and the Critic. After generating an output, you prompt the agent: "Look at your own response. Are there any errors? How could it be improved?"
- Pros: Lower latency, lower cost (fewer API calls).
- Cons: The agent is biased toward its own initial output and may fail to see its own mistakes.
External Review (Multi-Agent)
This is the model we have been discussing, where two distinct agents (or even two different model versions, e.g., using a smaller, faster model for generation and a larger, smarter model for review) interact.
- Pros: Higher quality, objective evaluation, better at complex tasks.
- Cons: Higher latency, higher cost.
Tip: Start with a self-reflection model during development to save costs. Once you have a working prototype, transition to a multi-agent, external review model to boost the final output quality.
Not read yet
Designing for Failure: The "Fallback" Strategy
What happens when the Critic rejects the Generator's work three times in a row? A well-designed system should not simply crash. You need a fallback strategy to handle persistent failures.
- Context Reset: If the system reaches max iterations, have the system start over with a fresh context, perhaps with a slightly different "temperature" setting to encourage a new approach.
- Human Escalation: If the system fails twice, trigger a notification to a human operator. The human can provide manual guidance, which you can then feed back into the system to unblock the agents.
- Simplification: If the task is too complex, have the Critic instruct the Generator to break the problem down into smaller, more manageable sub-tasks. This "divide and conquer" approach often resolves issues that a monolithic task cannot.
Ethical Considerations in Agent Coordination
When we automate the review process, we are essentially delegating editorial control to an AI. This carries risks, particularly in fields like medicine, law, or finance.
- Bias Reinforcement: If the Critic agent has an inherent bias, it may consistently reject valid, non-biased outputs from the Generator. Regularly audit your Critic’s feedback for patterns of bias.
- Accountability: If a Critic agent approves an incorrect or harmful piece of content, who is responsible? Always maintain a "human-in-the-loop" for high-stakes decisions. The AI should assist in the review process, not be the final arbiter of truth.
Not read yet
Step-by-Step Implementation Guide
If you are starting from scratch today, follow these steps to build your first Critic-Reviewer system:
- Define the Task: Choose a task with clear, objective success criteria (e.g., writing a summary of a document, writing a Python unit test).
- Draft the System Prompts: Write the Generator prompt first. Then write the Critic prompt, focusing on the specific constraints of the task.
- Build the Loop: Use a simple orchestration framework (like LangGraph, CrewAI, or even a basic Python loop) to manage the message passing.
- Test with Edge Cases: Purposefully feed the Generator "bad" inputs to see if your Critic catches them. If the Critic misses them, refine the Critic's prompt.
- Optimize for Latency: If the process is too slow, try using a smaller model (like GPT-4o-mini or Haiku) for the Generator and a larger model (like GPT-4o or Claude 3.5 Sonnet) for the Critic.
- Monitor Performance: Keep a log of how many iterations it takes to get to an "APPROVED" state. If the number of iterations is consistently high, your Generator prompt needs to be more specific.
Not read yet
The Future of Critic Agents
We are moving toward a paradigm where Critic agents are not just text-based, but tool-enabled. Imagine a Critic agent that doesn't just read code, but actually runs it in a sandboxed environment to verify its performance. Or a Critic agent that checks a piece of writing against a database of verified facts to ensure there are no hallucinations.
This is the next evolution of multi-agent coordination. The "Reviewer" of the future will be a bridge between the generative power of LLMs and the deterministic world of software tools and databases. By mastering the basic Critic-Reviewer loop today, you are preparing yourself for this transition to more capable, tool-augmented systems.
Key Takeaways
- Decouple Generation and Evaluation: Separating these roles prevents cognitive bias and mimics the professional editorial process, leading to higher quality results.
- Specificity is Key: The quality of the Critic is directly proportional to the clarity and detail of the rubric provided. Avoid vague instructions; use specific, measurable criteria.
- Manage the Loop: Always implement a maximum iteration limit to avoid infinite loops and wasted resources.
- Use Specialized Critics: For complex tasks, consider using multiple, focused Critics rather than a single, generalist evaluator.
- Monitor and Audit: Log the interaction history between agents to identify where the process breaks down and to ensure the system is not developing unintended biases.
- Start Simple, Scale Up: Use self-reflection for initial development and move to multi-agent external reviews for production-grade quality.
- Human-in-the-Loop: For critical applications, ensure that the final output is verified by a human, using the agents to handle the heavy lifting of initial filtering and refinement.
By following these principles, you will be able to build systems that are not only more accurate but also more resilient and easier to debug. The transition from linear prompting to multi-agent coordination is the most significant step in moving AI from a "chat" tool to an "agentic" system capable of performing real-world work.
Not read yet
Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.
No GH-600 practice exam yet
Your points already work on 76 Amazon, CompTIA and Microsoft exams.
See the exams