Single agent
Reflection
Draft, critique your own draft, then revise.
1 agentCore
How it works
- 1Produce a first attempt.
- 2In a separate step, critique it against explicit criteria — find concrete flaws, don't rubber-stamp.
- 3Revise using the critique.
- 4Repeat for 1–2 rounds, stopping when critique finds nothing material.
Use it when
Quality-sensitive output — code, writing, analysis — where a second look catches real errors. A cheap way to raise quality without a second model.
Reach for something else when
Simple factual tasks where critique just adds cost, or when the model can't actually judge the domain.
Where you stay in the loop
The agent both drafts and critiques, but you own the criteria it judges against. Spot-check that the self-critique is honest rather than rubber-stamping — a flattering critic improves nothing.
In the wild
Write a function → critique it for edge cases and style → rewrite addressing each point.
Hand this to your agent
Use a reflection loop. Step 1 — Draft: produce a first version. Step 2 — Critique: switch hats and critique your own draft harshly against these criteria: <e.g. correctness, edge cases, clarity>. List specific, actionable flaws — no vague praise. Step 3 — Revise: rewrite to fix every flaw. Do up to 2 rounds, then give the final version and a one-line note on what improved. Task: <...>
Replace the <…> placeholders, paste it into your agent, and it'll scaffold the workflow with you.