How does the ReAct (Reasoning + Acting) loop prevent hallucination compared to standard single-turn LLM prompting?
Standard single-turn LLMs suffer from compounding hallucinations when given complex tasks because they attempt to generate answers without external ground truth. ReAct solves this by decomposing the problem into an interleaved sequence: 1. Thought: The agent generates explicit internal reasoning regarding its current subgoal. 2. Action: It invokes an external, deterministic tool (SQL query, search, API call) with structured arguments. 3. Observation: The host environment executes the action and returns the ground-truth result to the context. 4. Reflection: The agent evaluates whether the observation answers the subgoal or requires alternative actions. This grounds every step in external reality, allowing the model to self-correct upon tool errors.