Course contentsShow
← Machine Learning and Deep Learning
Lesson 1899 of 3,53840. Advanced Prompting TechniquesFree lesson

ReAct Prompt Structure

Crafting prompts with Thought-Action-Observation cycles to enable systematic problem decomposition.

ReAct Prompt Structure

What you'll learn: How to format prompts with explicit Thought-Action-Observation cycles to guide models through structured problem-solving.

The Core Idea

ReAct prompts structure the model's reasoning and actions into three distinct, repeating phases:

  1. Thought: The model reasons about what it knows and what to do next
  2. Action: The model takes a specific action (query a tool, search, calculate, etc.)
  3. Observation: The model receives and acknowledges the result of that action

This cycle repeats until the model reaches a final answer. By explicitly labeling these phases in your prompt, you teach the model to show its work systematically rather than jumping to conclusions.

Anatomy of a ReAct Prompt

Question: [Your question here]

Thought 1: I need to find X before I can determine Y.
Action 1: Search[specific query]
Observation 1: [Result from search]

Thought 2: Based on the observation, I now know Z. Next I should...
Action 2: Lookup[specific detail]
Observation 2: [Result from lookup]

Thought 3: I have enough information to answer.
Action 3: Finish[final answer]

The structure forces explicit decomposition: each thought must justify the next action, and each observation informs the subsequent thought. This creates an audit trail of reasoning.

Why This Structure Works

Think of it like a detective's case notes—each piece of evidence (Observation) leads to a deduction (Thought), which determines the next investigative step (Action). The format prevents the model from making logical leaps without grounding.

The labels "Thought:", "Action:", and "Observation:" act as cognitive scaffolding, telling the model what type of content to generate next, reducing ambiguity about how to proceed.

Key Takeaway: ReAct prompt structure explicitly separates reasoning (Thought), tool use (Action), and feedback (Observation) into labeled cycles, enabling transparent, step-by-step problem decomposition that's easier to debug and validate.