Agentic Engineering from First Principles All chaptersLecturesLabDownload the book
Part III · Making Agents Think and Work

Chapter 13: Reflection

Central questionDoes letting an agent critique its own output actually improve the result?

Lecture

Chapter principle

Reflection adds another probabilistic component. Its errors must be measured just like the errors of the original generator. Or, more briefly: a critic is another fallible component, not an oracle.

Key takeaways

Experiments

Every experiment in the book is small, runnable and printed with its real output. In the Lab you can replay a recorded real run of each one, with no programming, and watch what the model and the agent do.

Experiment 25: Reflection with a check

Does asking a model to criticize an answer make the answer better?

A shop buys 417 items at 35 dollars and sells them at 47 dollars, but 62 stay unsold. The profit is 355 × 47 − 417 × 35 = 2090 dollars, and a calculator can confirm it. Two drafts are written by hand: a wrong one that ignores the unsold items (5004) and a correct one (2090). A real model then criticizes each draft under two instructions. The careful critic checks the answer step by step. The hasty critic is told the answer contains a mistake. Each pairing runs three times. Two policies decide what to do with each proposed number: always accept it, or accept it only when the calculator agrees. This is a recorded run of a real model. A new run may give different numbers.

All the code for this chapter: github.com/agentic-engineering-book/code

This is Chapter 13 of Agentic Engineering from First Principles: thirty chapters, a case study and fifty-nine executable experiments, from a single model call to controlled, self-improving agents.
Download the bookBrowse all chapters
← Chapter 12: PlanningChapter 14: Search and Tree Reasoning →