Reviewer Agent
A reviewer agent checks the output of worker agents for quality, accuracy, and completeness. It either approves the output or sends it back with revision instructions.
8 min•By Priygop Team•Updated 2026
Reviewer Design
- Clear acceptance criteria: the reviewer must know exactly what 'good enough' looks like
- Scoring: quantify quality with a numeric score (0-10) to enable consistent decisions
- Specific feedback: if the output is rejected, the reviewer must explain exactly what needs to change
- Revision limit: set a maximum number of revisions to prevent infinite review cycles
- Approval threshold: define the minimum score required for approval (e.g., score >= 7)
Reviewer Agent Implementation
Reviewer Agent Implementation
# Reviewer agent with scoring and revision tracking
class ReviewerAgent:
def __init__(self, approval_threshold: int = 7, max_revisions: int = 2):
self.approval_threshold = approval_threshold
self.max_revisions = max_revisions
def review(self, content: dict, revision_count: int = 0) -> dict:
"""
Review agent output. Returns decision and detailed feedback.
"""
print(f" [Reviewer] Reviewing (revision {revision_count}/{self.max_revisions})")
# Quality checks
issues = []
score = 10
# Check completeness
required_fields = ["topic", "key_findings", "sources"]
for field in required_fields:
if field not in content or not content[field]:
issues.append(f"Missing or empty: '{field}'")
score -= 2
# Check source quality
sources = content.get("sources", [])
if len(sources) < 2:
issues.append("Fewer than 2 sources — add more citations")
score -= 1
# Check finding quality
findings = content.get("key_findings", [])
if len(findings) < 3:
issues.append("Fewer than 3 key findings — research more thoroughly")
score -= 2
score = max(0, score)
approved = score >= self.approval_threshold
if not approved and revision_count >= self.max_revisions:
return {
"decision": "escalate",
"reason": f"Max revisions ({self.max_revisions}) reached. Score: {score}/10",
"score": score
}
return {
"decision": "approved" if approved else "revise",
"score": score,
"issues": issues,
"feedback": "; ".join(issues) if issues else "Output meets quality standards"
}
# Test reviewer
reviewer = ReviewerAgent(approval_threshold=7, max_revisions=2)
content = {
"topic": "Python AI frameworks",
"key_findings": ["TensorFlow is popular", "PyTorch is flexible", "JAX is fast"],
"sources": ["https://example.com/1", "https://example.com/2"]
}
result = reviewer.review(content)
print(f"Decision: {result['decision']}, Score: {result['score']}/10")Key Takeaways
- A reviewer agent checks the output of worker agents for quality, accuracy, and completeness.
- Clear acceptance criteria: the reviewer must know exactly what 'good enough' looks like
- Scoring: quantify quality with a numeric score (0-10) to enable consistent decisions
- Specific feedback: if the output is rejected, the reviewer must explain exactly what needs to change