Prompt Recipes
Roo Iyer4 min read12 views

ReAct Prompting: 6 Copy-Paste Recipes That Ship (2026)

ReAct prompting interleaves reasoning and tool calls: Thought, Action, Observation, repeat, until the model has enough to answer. It is how a plain prompt becomes an agent. Six copy-paste ReAct recipes below, each with the failure mode that bites first. Tested July 2026.

Minimalist poster of a yellow three-node cycle on white, the reason-act-observe loop behind ReAct prompting
Minimalist poster of a yellow three-node cycle on white, the reason-act-observe loop behind ReAct prompting
On this page

Chain-of-thought lets a model think. ReAct lets it check.

ReAct prompting interleaves two things: reasoning and actions. The model writes a Thought, takes an Action (a search, a tool call, a calculation), reads the Observation that comes back, then thinks again. It loops until it can answer. That loop is the whole difference between a prompt and an agent.

The pattern comes from the 2022 ReAct paper by Yao et al. Six paste-ready recipes below. Each one lists the failure mode that bites first.

Scroll to see more

ModelWhere these were tested
Claude Claude Opus 4.x, native toolsrecipes 1 to 6
OpenAI OpenAI o-series, function callingrecipes 1, 3, 5

Modern models have native tool calling. ReAct is still the mental model underneath it: think, act, observe, repeat.

1. The Core Loop

The scaffold everything else hangs on.

Solve the task by alternating these steps. Never skip a step.

Thought: reason about what you need next.
Action: one of [search(query), lookup(id), calc(expression)]
Observation: 
... repeat Thought/Action/Observation as needed ...
Final Answer: the answer, once you have enough.

Task: 
Begin with a Thought.

Why it works: the fixed labels force the model to expose its plan and to name a concrete action instead of hand-waving. You can parse the Action line and actually run it.

Fails when: the model writes its own fake Observation. See recipe 4. Never let it fill in an Observation itself.

2. The Tool Roster

A loose action space produces invalid actions. Pin it.

You may use only these actions. Any other action is forbidden.

search(query: string)   -> returns top 3 snippets
get_order(id: string)   -> returns order JSON or NOT_FOUND
calc(expr: string)      -> returns a number

Always write the Action as name(arg). If no action fits, write
Action: none and go straight to Final Answer.

Why it works: an explicit, typed roster cuts the model's temptation to invent tools it wishes it had. The Action: none escape hatch stops it from forcing a bad call.

Fails when: two tools overlap. If search and get_order could both answer, the model picks randomly. Give each tool one clear job. First-party guides help here: Anthropic's tool use docs and OpenAI's function calling guide.

3. The Stop Condition

The most common ReAct bug: it never stops.

Stop rules, in priority order:
1. If the last Observation answers the task, write Final Answer now.
2. Never take the same Action with the same args twice.
3. Hard cap: 6 steps. At step 6 you MUST write a Final Answer
   using whatever you have, and say what is still uncertain.

Why it works: models will happily loop, re-searching the same query, chasing certainty they will not reach. An explicit cap plus a no-repeat rule ends it.

Fails when: you set the cap too low for a real multi-hop task. Six is a sane default; measure and raise it only if answers get cut off mid-chain.

4. The Observation Discipline

The rule that keeps ReAct honest.

You do NOT write Observations. After each Action, stop generating
and wait. The system inserts the real Observation. Then continue
with your next Thought based only on what was actually returned.

Why it works: if the model writes its own Observations, it hallucinates tool results and the whole loop becomes theater. Stopping generation after the Action line and feeding back the true result is what makes ReAct grounded instead of imaginary.

Fails when: your harness does not actually pause on the Action line. Test it: give a tool a wrong answer on purpose and confirm the model's next Thought reacts to the wrong answer, not to a guessed right one.

5. The One-Shot Trace

One worked example locks the format better than any description.

Follow this format exactly. Example:

Task: What is the shipping status of order A-1004?
Thought: I need the order record.
Action: get_order("A-1004")
Observation: {"status":"shipped","eta":"2026-07-15"}
Thought: I have the status and ETA. That answers it.
Final Answer: Order A-1004 shipped and arrives around July 15, 2026.

Now do the same for this task: 

Why it works: one clean trace teaches the labels, the tool syntax, and the stop behavior in a single shot. It is few-shot prompting applied to the ReAct loop itself.

Fails when: your example uses a tool that is not in the roster, or a format you do not actually parse. The example must match your real harness exactly.

6. The Failure Guardrail

Tools fail. Say what to do when they do.

If an Observation is empty, an error, or NOT_FOUND:
- Thought: note the failure explicitly.
- Retry once with a different query or tool.
- If it fails again, write a Final Answer that states what you
  could not determine and why. Do not invent the missing value.

Why it works: without this, a failed tool call makes the model either loop forever or quietly fabricate the answer. One retry plus an honest fallback is the safe middle.

Fails when: you allow unlimited retries. That is recipe 3 all over again. One retry, then answer with what you have.

The rule under all six

ReAct is just a disciplined loop: think, act, observe, decide. The model supplies the reasoning; you supply the tools, the stop condition, and the honesty rule that it must not invent observations. Get those three right and the rest is plumbing.

It builds directly on chain-of-thought-prompting-examples-that-ship, so read that first if the Thought step feels thin. The full technique roster lives in the prompt-engineering-cheat-sheet.

Think, act, observe, stop. In that order, every time.

Cost to test: $0.09 across all six on Claude Opus, one task each.

R

Written by

Roo Iyer

Roo Iyer writes terse, tested prompt recipes for PromptAttic. Fewer tokens, fewer words, ship it.

FAQ

What is ReAct prompting?

ReAct prompting tells the model to alternate between reasoning and acting. It writes a Thought, takes an Action such as a tool or search call, reads the Observation that comes back, and loops until it can give a final answer. The name is short for Reason and Act, from the 2022 ReAct paper.

How is ReAct different from chain-of-thought?

Chain-of-thought reasons in one shot with no outside input. ReAct adds actions, so the model can fetch real data mid-reasoning instead of guessing. Use chain-of-thought for closed problems and ReAct when the answer depends on something the model has to look up or compute.

Do I still need ReAct if my model has native tool calling?

Native tool calling handles the plumbing, but the ReAct pattern is still the mental model underneath: think, call a tool, read the result, decide again. On models without structured tools you write the loop by hand; with them you shape the same Thought and stop-condition behavior in the system prompt.

Why does my ReAct agent loop forever?

It has no stop condition. Add an explicit rule that once the model has enough information it must emit a Final Answer and stop, and cap the number of steps. Recipe 3 below is exactly this.