Skip to content

Instantly share code, notes, and snippets.

@tydev-new
tydev-new / sys2_ch.4_reflection.js
Last active January 3, 2026 16:24
Agent Design Playground - Ch.4 Reflection (by sys2)
/**
* CHAPTER 4: REFLECTION (VANILLA JS)
*
* This pattern forces the agent to critique and refine its own output in a loop before showing the final answer to the user. It is used to catch hallucinations, logic errors, or safety violations that often occur in a "first draft" generation.
*
* The agent generates an initial output, explicitly critiques it
* to identify flaws (bugs, tone, edge cases), and then generates
* a refined version based on that self-correction.
*
* This improves robustness compared to a "zero-shot" generation.
@tydev-new
tydev-new / test.js
Created January 3, 2026 01:33
Agent Design Playground
test