If you ask an LLM a complex question that requires an external tool, it will often hallucinate an answer immediately or execute the wrong tool. The ReAct (Reason + Act) paradigm, introduced by researchers at Princeton and Google, forces the model into a strict cognitive loop. The model is prompted to first output a `Thought:` detailing its current understanding of the problem and what it needs to do next. Only then does it output an `Action:` (like querying a database). Once the database returns an `Observation:`, the model loops back to `Thought:`. This explicit externalization of the planning process drastically reduces hallucinations and gives developers a clear trace of the agent's logic.

How It Works

The agent is trapped in a loop until it outputs an answer:
  • Thought: The agent assesses the current state. (e.g., 'I need to find the CEO's email. I should search the directory.')
  • Action: The agent calls a tool. (e.g., search_directory("CEO"))
  • Observation: The system returns the tool's output. (e.g., 'Result: jane.doe@company.com')
  • Thought: The agent evaluates the observation. (e.g., 'I have the email. I can answer the user now.')

Common Use Cases

  • Building autonomous web-research agents.
  • Creating conversational interfaces for complex internal databases.

Related Terms