Stop 15 · AI Agents & OrchestrationTopics · 1/9

Agent Architectures (ReAct, Plan-and-Execute)

Part of the AI Engineer Roadmap

In short

An agent is just an LLM in a loop that can use tools. How you shape that loop decides whether it finishes the job or wanders around burning tokens.

Patterns for how an LLM reasons and acts iteratively — ReAct interleaves reasoning and tool calls step by step, Plan-and-Execute plans a full sequence upfront then executes it.

The blob holds a long written shopping list in one hand and looks around market stalls deciding the next stop.

Think of it like this

Two ways to do Diwali shopping

Mummy writes the full list at home, then buys item by item. That's Plan-and-Execute. Papa walks into the market, sees what's there, decides the next shop on the spot. That's ReAct. Both get the shopping done, in very different styles.

Watch it happen

ReAct vs Plan-and-Execute

ReAct

  • Think, act, observe, repeat
  • Adapts after every tool result
  • Can loop forever without a cap

Plan-and-Execute

  • Write the full plan first
  • Cheaper model can run each step
  • Needs a replan step when things change

Use ReAct for short, unpredictable tasks. Use Plan-and-Execute for long tasks with clear steps, and replan when a step fails.

The big ideas

What you need to know

The agent loop

The model picks an action, your code runs it, the result goes back into the prompt. Repeat until the model says it's done.

ReAct = reason + act

The model writes a short thought before each tool call. That thought keeps it on track and makes the trace easy to debug.

Plan first, then do

A planner writes numbered steps once. An executor works through them. Fewer big-model calls, easier to show progress to users.

Always set a stop rule

Cap the number of steps and tokens. An agent with no limit will happily retry the same failing search twenty times.

See it in code

Walk through the code

text
1Question: Should I carry an umbrella in Pune tomorrow?2Thought: I need tomorrow's forecast for Pune.3Action: get_weather(city="Pune", day="tomorrow")4Observation: {"rain_chance": 80, "temp_c": 24}5Thought: An 80% rain chance is high. I can answer now.6Final Answer: Yes, carry one. Tomorrow's rain chance is 80%.

1/3The model starts by thinking about what it is missing before touching any tool.

A ReAct trace. The model writes Thought and Action lines, your code runs the tool and pastes in the Observation.

Save yourself the pain

Common mistakes

Oops

Building an agent for a task that always follows the same three steps.

Do this instead

If the steps never change, write a plain workflow in code. Agents are for tasks where the next step depends on what you find.

Oops

Letting the loop run until the model decides to stop.

Do this instead

Add a max step count and a token budget, and return a clear 'I could not finish' message when it hits the limit.

Your mission

Trace a ReAct loop by hand

~20 min

Quick check

Your agent must do a 12-step data migration where the steps are known up front. Which design fits best?

Go deeper

  1. 1Read the original ReAct paper's core loop: thought, action, observation, repeat.
  2. 2Implement a minimal ReAct-style agent from scratch before relying on a framework.
  3. 3Compare ReAct's flexibility against Plan-and-Execute's predictability for a specific task.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge