Intermediate questions: ReAct and reasoning patterns
What it is
Mechanism questions. For each pattern, be ready with how it works, when it helps and how it fails.
Why it matters
Say each answer aloud before reading it.
- The first sentence should be a complete answer on its own.
- The rest adds one example or one trade-off.
- If an answer here surprises you, the module named in the question's topic is where to go back.
In the real world: The commonest coding task at this level is 'write a ReAct loop'; the commonest follow-up is 'now make the tool fail and show me what happens'.
Q: How does ReAct work?
The model alternates a thought, an action and an observation. It reasons about what it needs, requests one tool, reads the real result, and reasons again, until it answers or a limit stops it. Each thought is grounded in a real observation rather than a guess.
Q: How would you implement ReAct?
A loop over a message history: call the model with tools; if it returns a final answer, stop; otherwise validate and run the requested tool, append the result, and repeat up to a step limit. With function calling the action is structured; in the original form it is parsed from text, with generation stopped before the word 'Observation'.
Q: What are ReAct's failure modes?
Loops and repeated calls, drifting from the goal over a long history, hallucinated tools or arguments, ignoring an observation, and cost that grows faster than step count because the history is resent.
Q: ReAct versus plan-and-execute?
ReAct decides one step at a time, adapts instantly, and pays a large-model call per step. Plan-and-execute plans once, allows parallel and cheaper execution and review, and needs replanning when surprised. They are usually nested: a plan outside, short ReAct loops inside.
Q: What is chain-of-thought?
Having the model reason step by step before answering, which improves multi-step accuracy. Current models often do it internally as extended thinking, controlled by a setting rather than a prompt.
Q: What is reflection?
A critique-and-revise pass on a draft. It works when there is something concrete to check against, such as tests, evidence or a rubric, and needs a separate critic and a cap on rounds.
Q: What is Tree of Thoughts?
A search over several lines of reasoning: propose options, score them, expand the best, back up from dead ends. It helps on problems with dead ends and costs many times more, so it is mostly used offline.
Q: How do you choose a reasoning pattern?
Start with one call, add a ReAct loop if tools are needed, add a plan for long predictable tasks, add one round of reflection if output is testable. Keep each addition only if the evaluation set shows it pays for its cost.
Explaining ReAct as a prompt format instead of a loop your code runs.