AI Engineering · Agents In Production
Free preview: the first 2 parts of this 14-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
AI Engineering
Unlock this lesson and the 199 other paid lessons
$49 once, by PayPal
See the AI Engineering courseread the rest of this lesson in
AI Engineering
Unlock this lesson and the 199 other paid lessons
$49 once, by PayPal
See the AI Engineering coursein Agents In Production
This lesson is part of the AI Engineering course. Unlock the full course, a separate one-time payment, for lifetime access.
One-time payment: UPI, card or netbanking
Get Lifetime AccessFoundation lessons of this course are free, no payment needed. Try them now
Two agents finish the same 12-step task correctly. One made 12 reasoning calls to a frontier model to do it. The other made 2. At any real volume that gap is most of your inference bill and most of your tail , and it is decided before the agent runs a single step, by one architectural choice: does the agent think before every action, or think once and then act.
That choice has a name on each side. Thinking before every action is ReAct. Thinking once and then acting is plan-and-execute. Neither is correct in general. They are two shapes with opposite cost curves and opposite failure modes, and picking the wrong one for your task shape is how you end up either broke or brittle.

This lesson is about the trade. The agent loop lesson earlier in this chapter treated the loop as a given and asked how to make it reliable. Here the loop itself is the variable: its shape is what you are choosing, and the shape determines the bill, the latency, and how the agent behaves the moment reality stops matching the plan.
ReAct interleaves reasoning and acting. The model produces a short thought, then one action, the orchestrator runs the action and returns an observation, and the model reasons again with that observation in hand. The pattern comes from Yao et al., ReAct: Synergizing Reasoning and Acting in Language Models, and the point of the paper is that the thought and the action help each other. Reasoning about what to do next produces better actions, and observing the result of an action corrects the reasoning.

The strength is adaptivity. Because the model reasons again after every observation, it can change course at any step. It planned to call the search tool, the search returned nothing useful, so on the next turn it reasons about that emptiness and tries a different query or a different tool. Nothing was committed in advance. The plan, such as it is, exists only one step ahead, and it is rebuilt from the latest evidence every time. For a task where you cannot know the right sequence until you start pulling on threads, that is exactly the behavior you want.