ReAct: thinking and acting, interleaved
Early tool-using agents either reasoned or acted, never both well. ReAct prompting (short for Reason + Act) fixes that by interleaving them in an explicit cycle: the model writes a Thought, takes an Action, reads the Observation that comes back, then writes the next Thought — repeating until done. Reasoning makes the actions smarter, and the observations keep the reasoning honest. It is the observe–think–act loop from Guide 1, made legible on the page.
A loop diagram cycling through the reason, act, and observe stages of an LLM agent.
Goal: "What is the population of the capital of the country that won the 2022 World Cup?"
Thought: I need the 2022 World Cup winner first.
Action: search("2022 FIFA World Cup winner")
Observation: Argentina.
Thought: Capital of Argentina is Buenos Aires. Now its population.
Action: search("population of Buenos Aires")
Observation: ~3.1 million (city proper).
Thought: I have the answer.
Action: finish("About 3.1 million — Buenos Aires, capital of Argentina.")This visible chain matters for more than accuracy. When an agent misbehaves, the Thought lines tell you why it chose each tool — turning tool selection mistakes from mysteries into readable bugs.
Planning: turning a vague goal into ordered steps
ReAct decides one step at a time, which is nimble but short-sighted. For a goal like "organise a three-day research trip," reacting move-by-move risks wandering. Agent planning adds foresight: the model first drafts an ordered set of sub-goals, then executes them, revising the plan when reality pushes back. Plan-then-act gives structure; ReAct gives adaptivity. Strong agents blend the two — a plan as the skeleton, a ReAct loop as the muscle on each bone.
- Decompose the goal into sub-goals small enough that each maps to a few tool calls.
- Order them by dependency — what must be known or done before what.
- Execute the first sub-goal with a ReAct loop, then check the result against the plan.
- Re-plan when an observation invalidates an assumption — a plan is a hypothesis, not a contract.
Memory: carrying knowledge across the loop
A long task overflows the model's context window — you cannot keep every Thought, Action, and Observation in the prompt forever. Agent memory is how an agent holds knowledge across turns despite that limit. The usual split: short-term memory is the recent loop history sitting in the context window; long-term memory lives outside the model — in a file, a database, or a vector store — and the agent reads relevant pieces back in when needed.
Good memory is what separates an agent that learns from a goldfish that re-asks the same question every loop. Practical patterns: summarise old turns into a compact running note, write important findings to a scratchpad the agent re-reads, and store reusable facts in long-term memory keyed for later retrieval. Without this, autonomous task execution on anything lengthy falls apart.
A retrieval-augmented generation pipeline feeding stored notes back into the model's prompt.
Putting it together
ReAct, planning, and memory aren't rival techniques — they are the three time-scales of one agent. Planning works at the scale of the whole goal (the skeleton of sub-goals). ReAct works at the scale of a single step (Thought → Action → Observation). Memory spans across both, carrying what each step learned forward so the plan can be revised with real knowledge. A capable agent runs all three at once: a plan up top, a ReAct loop executing each piece, and memory threading the results through.
Watch how they interlock on a real job — "summarise this quarter's three competitor launches." Planning splits it into three research sub-goals plus a synthesis step. Each sub-goal runs a ReAct loop (select a search tool, read, refine, repeat). Memory stores each summary so the final synthesis step has all three on hand without re-doing the research. Pull any one strand and the task frays.