The Critic Agent Pattern: A Second Opinion on Every Draft
A critic agent reads another agent's output and reports problems. Because it is a separate call with its own instructions and no memory of how the output was produced, it catches mistakes the author tends to miss. The critic should find issues, not fix them, and it should return feedback in a form your code can act on.
Why a separate critic helps
When a model reviews its own answer inside the same conversation, it has already committed to that answer and tends to defend it. A fresh call with a reviewer prompt starts without that commitment. You can also give the critic a different model, a stricter prompt or access to verification tools such as a test runner or a search tool.
Writing a critic prompt
A critic prompt should state what to check, how to report it and when to stay silent. Without a threshold, critics invent trivial complaints to look useful.
- List the criteria: accuracy, completeness, tone, format, whatever the task needs.
- Require evidence: the critic must quote the exact text it objects to.
- Allow approval: say that returning no issues is correct when there are none.
- Rank issues by severity so the author can fix the important ones first.
Structured critic output
Ask for JSON with a verdict and a list of issues. Each issue has a severity, a quote and a suggested direction. Your code can then loop only while blocking issues remain.
import json
import re
import anthropic
client = anthropic.Anthropic()
CRITIC = """You review a technical explanation for developers.
Check: factual accuracy, missing key points, unclear wording.
Only report real problems. If there are none, return an empty list.
Reply with JSON only, in this shape:
{"issues": [{"severity": "high|low", "quote": "exact text", "problem": "what is wrong"}]}"""
def critique(text: str) -> list[dict]:
r = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=2000,
system=CRITIC,
messages=[{"role": "user", "content": text}],
)
raw = "".join(b.text for b in r.content if b.type == "text")
match = re.search(r"\{.*\}", raw, re.DOTALL)
if not match:
return []
try:
return json.loads(match.group(0)).get("issues", [])
except json.JSONDecodeError:
return []
sample = "TCP is a connectionless protocol that guarantees delivery of every packet."
for issue in critique(sample):
print(issue["severity"].upper(), "-", issue["problem"], "| quote:", issue["quote"])
For the sample sentence, which contains a clear error (TCP is connection-oriented), you should see a high-severity issue quoting the sentence. For a correct sentence, the list should be empty.
Acting on the critique
Send the issues back to the author agent, not to the critic's own output. The author rewrites; the critic checks again. Stop when there are no high-severity issues or when you reach a round limit. The next patterns build on this loop.
Failure modes
- Rubber stamp. The critic approves everything. Test it with deliberately flawed inputs to confirm it catches them.
- Nitpicker. The critic always finds something, so the loop never ends. Add severity levels and stop on low-only.
- Shared blind spot. If critic and author are the same model with similar prompts, they can miss the same error. Give the critic tools or different instructions, and verify facts with sources where possible.
- Role leak. The critic starts rewriting the text. Forbid it in the prompt and ignore any rewrite.
Quick checklist
- One clear rubric per critic.
- JSON output with severity and quotes.
- A test set of good and bad examples for the critic itself.
- A round cap in the surrounding loop.
Giving the critic evidence
A critic that only reads the draft can judge style and logic, but not truth. To check facts, give it the source material or a tool. For instance, a critic reviewing a summary should receive the original document along with the summary, and should be told to flag any statement that the document does not support. A critic reviewing code should be able to run the tests. The more the critic can verify instead of opine, the more reliable its feedback becomes.
Critic placement
You can place a critic at several points. After a worker, it validates each piece before it reaches the orchestrator. After the synthesizer, it checks the final answer. Before an irreversible action, such as sending an email or running a migration, it acts as a gate. Each placement has a cost, so put critics where an error is expensive and where the critic can actually detect it. A critic on every step of a cheap, low-risk pipeline mostly adds latency.
Testing the critic itself
Build a tiny test set: five texts with known, planted errors and five clean texts. Run the critic and count how many planted errors it finds and how many clean texts it flags. If it misses half the errors, tighten the rubric or add tools. If it flags most clean texts, add the "only report real problems" rule and a severity threshold. Treat the critic like any other component and measure it, because an unmeasured critic gives false confidence.
Comments
No comments yet. Have a question or a tip? Be the first to share it.