◈ KROMALOCA ACADEMY · MODULE 33 (MASTERCLASS AUTONOMOUS SYSTEMS)
MASTERCLASS · TOPIC 33⏱️ 9 MIN READ⚡ 10-QUESTION SCENARIO CHALLENGE

The ReAct Loop: Observe, Plan, Act, Reflect

Mastering the synergy between Reasoning and Acting to conquer complex, unpredictable multi-step objectives.

← View Academy Curriculum HubCurriculum Track: Masterclass Autonomous Systems

The Flaw in Pure Thinking: Why CoT Isn't Enough

In Topic 15, we covered Chain-of-Thought (CoT): having the AI "think step-by-step". While CoT dramatically improves logic and arithmetic, it suffers from a fundamental limitation: it is closed off from the physical world.

If an LLM hallucinates an incorrect fact at step 2, steps 3 through 7 will build on that hallucination with total confidence. The model has no way to ground its thoughts against reality. Enter the ReAct (Reason + Act) framework, first formalized by Yao et al. in 2022.

The ReAct Quad-Step Engine

ReAct introduces a rhythmic heartbeat to autonomous problem solving:

1. Thought: The model articulates what it currently knows, what is missing, and what step makes logical sense next.
2. Action: The model executes a specific tool call with explicit arguments.
3. Observation: The runtime environment performs the action and returns the raw factual response.
4. Reflection: The model evaluates the observation against the overarching goal and decides the next Thought.

A Real-World ReAct Trace in Action

Imagine asking an AI: "Find the founder of the company that acquired Figma's competitor in 2021 and tell me where they went to university."

User: Find the founder of the company that acquired Figma's competitor in 2021...

Thought 1: I need to identify Figma's primary competitor in 2021 and see who acquired them.
Action 1: search_web(query="Figma competitor acquired 2021")
Observation 1: In 2021, InVision was widely considered Figma's chief competitor. In 2021, InVision acquired design system company Brandfolder. Wait, InVision itself wasn't acquired then. Let me re-verify competitors.

Thought 2: The observation clarified InVision acquired Brandfolder, but what about InVision or Sketch? Let me search for direct acquisitions.
Action 2: search_web(query="design software company acquired 2021 Figma competitor")
Observation 2: In August 2021, Miro acquired Runroom... wait, Framer wasn't acquired. In 2021, Adobe announced intention to buy Figma (which later failed in 2023). Let me search who acquired InVision's assets.
...
Thought 4: The data shows InVision's design collaboration assets were sold to Miro. Miro was founded by Andrey Khusid. Now I must find where Andrey Khusid attended university.
Action 4: search_web(query="Andrey Khusid university education degree")
Observation 4: Andrey Khusid graduated from the Higher School of Economics (HSE) and State University of Management in Moscow.
Thought 5: I have all required information to fulfill the user's objective.
Final Answer: The competitor assets were acquired by Miro, founded by Andrey Khusid, who studied at the State University of Management and HSE.

Loop Guardrails: Surviving the Chaos of the Real World

Because external APIs fail, return empty payloads, or return conflicting data, unguided ReAct loops can rapidly burn tokens running in circles. Every production ReAct implementation must enforce:

  • Hard Step Limits: If iteration >= 8, force the model into synthesis mode with whatever partial data it has.
  • Duplicate Call Deduplication: If the model requests search_web("same query") twice in a row, intercept it with an error: "System: You already queried this. Try a different search angle."
  • Early Exit Tokens: Provide an explicit tool or token (e.g., give_up_and_ask_user) if the required data is fundamentally inaccessible.

TEST YOUR PROMPTING INSTINCTS

Topic 33 Scenario Challenge.

10 real-world scenarios designed to test how you apply the techniques from this lesson.

🎯
PASSING REQUIREMENT: 60% (6 OF 10 SCENARIOS)

You must achieve a minimum score of 60% on this challenge to unlock Lesson 34. Answers and technical rationales remain locked until all 10 scenarios are submitted.