Back to cookbook

AI Prompt for ReAct (Reason + Act) Prompting to Combine Reasoning With Tool Use

1 views Published

Make this prompt yours

Share

A ReAct prompt (short for Reason + Act) is a prompting pattern that asks a model to alternate between explaining its reasoning and taking a concrete action, instead of jumping straight to an answer. It is built for developers and AI engineers wiring up agents that call tools, APIs, or external data sources, because it forces the model to show why it's about to act before it acts, which makes the whole chain easier to audit and debug.

The pattern works in three repeating steps: Thought (what does the model believe is true, and what should happen next), Action (the specific tool call or lookup to make), and Observation (what came back, which feeds the next Thought). This loop is exactly what sits underneath most modern tool-calling agents, including ones that route actions through MCP (Model Context Protocol) servers — the Thought step decides which MCP tool to call and with what arguments, and the Observation step is the MCP server's response. Writing the ReAct structure explicitly into the prompt, rather than leaving it implicit, measurably reduces cases where a model skips a necessary lookup or acts on a stale assumption.

ReAct prompts are most useful in multi-step tasks: research questions that need several searches, support tickets that need a few different system lookups before a reply, or any agent flow with more than one available tool. Before shipping a ReAct-style agent prompt, it's worth running it through the Prompt Debugger, which flags the vague constraints and missing edge cases that most often cause an agent to skip the Act step or hallucinate an Observation instead of actually calling the tool.

Prompt template

Make this prompt yours

prompt-template
234 tokens
ROLE: You are an agent that solves tasks by alternating between reasoning and taking actions. You have access to a fixed set of tools. AVAILABLE ACTIONS: [LIST_OF_TOOL_NAMES_AND_WHAT_EACH_ONE_DOES] CONTEXT: Task: [DESCRIBE_THE_TASK_OR_QUESTION] Constraints: [ANY_LIMITS_ON_SCOPE_TIME_OR_TOOLS] INSTRUCTIONS: For each step, output exactly these three labeled parts, in order: Thought: explain what you currently know and what you need to find out or do next. Action: name exactly one action from the available list and its input, in the format ActionName[input]. Observation: left blank for the system to fill in with the real result of the action. Repeat the Thought-Action-Observation cycle until you have enough information to answer, or until you reach [MAX_NUMBER] cycles. If a tool call fails or returns an error, say so explicitly in the next Thought instead of inventing a result. OUTPUT FORMAT: When you have enough information, stop the loop and output: Final Answer: [YOUR_ANSWER_BASED_ONLY_ON_WHAT_WAS_ACTUALLY_OBSERVED]

Want it sharper? Optimize this prompt with Prompt Optimizer, check it with the Prompt Debugger or shorten it with the Token Optimizer.

Example input

example-input
258 tokens
ROLE: You are an agent that solves tasks by alternating between reasoning and taking actions. You have access to a fixed set of tools. AVAILABLE ACTIONS: - SearchDocs[query]: searches the internal knowledge base and returns matching snippets - GetOrderStatus[order_id]: looks up the current status of a customer order CONTEXT: Task: A customer says order #48213 hasn't arrived and wants to know what happened and what they should do next. Constraints: Only use information returned by the tools; do not guess shipping details. INSTRUCTIONS: For each step, output exactly these three labeled parts, in order: Thought: explain what you currently know and what you need to find out or do next. Action: name exactly one action from the available list and its input, in the format ActionName[input]. Observation: left blank for the system to fill in with the real result of the action. Repeat the Thought-Action-Observation cycle until you have enough information to answer, or until you reach 4 cycles. If a tool call fails or returns an error, say so explicitly in the next Thought instead of inventing a result. OUTPUT FORMAT: When you have enough information, stop the loop and output: Final Answer: your answer based only on what was actually observed.

When to use it

  • The task needs more than one tool call or lookup before a final answer can be given
  • You're debugging an agent that sometimes answers without actually calling the tool it had access to
  • You want a visible audit trail of why the model chose each action, not just the final output
  • You're building on top of MCP servers and need the model to decide which exposed tool to call and when

Best practices

  • Label each step explicitly as Thought, Action, and Observation so the pattern is unambiguous to the model
  • Give the model a fixed, enumerated list of available actions or tools rather than leaving action names open-ended
  • Cap the number of Thought-Action-Observation loops (e.g. "stop after 5 cycles or when you have enough information") to prevent runaway loops
  • Tell the model explicitly what to output when a tool call errors out, so it reports the failure instead of inventing an Observation

Common mistakes

  • Letting the model skip straight to an Action without writing a Thought first, which removes the auditability the pattern is meant to provide
  • Not telling the model what to do when a tool call fails or returns an error, so it silently fabricates an Observation
  • Mixing ReAct formatting with free-form chat, which confuses smaller models about when to stop reasoning and act
  • Forgetting to cap the loop count, which can lead to the model reasoning in circles on ambiguous tasks

FAQs

What is a ReAct prompt in AI prompting?

A ReAct prompt asks a model to alternate between a Thought (reasoning), an Action (a tool call), and an Observation (the tool's result), repeating that loop until it has enough information to give a final answer. It was designed to reduce hallucinated actions and make an agent's decisions traceable.

How is ReAct prompting different from chain-of-thought prompting?

Chain-of-thought asks a model to reason step by step toward an answer using only its own knowledge. ReAct adds a middle step: the model can pause its reasoning to actually call a tool or look something up, then continue reasoning with the real result instead of a guess.

Does ReAct prompting work with MCP (Model Context Protocol) servers?

Yes. An MCP server simply exposes a set of callable tools to the model; a ReAct-style prompt gives the model a structured way to decide which of those tools to call, when, and how to react to what comes back, which is why most MCP-connected agents use some variant of this pattern under the hood.

Why does my agent sometimes skip the Action step and just answer?

This usually happens when the Thought/Action/Observation format isn't enforced strictly enough in the prompt, or when the model judges (sometimes wrongly) that it already knows the answer. Explicitly requiring all three labeled parts on every cycle, and capping how early it's allowed to stop, usually fixes it.

Which Cuelara tool can help me catch issues in a ReAct-style agent prompt before I deploy it?

Prompt Debugger — scans a prompt for vague stopping conditions, missing error-handling instructions, and edge cases that commonly cause a tool-calling agent to skip a step or hallucinate a result instead of actually invoking the tool.

Found this prompt useful? Share it.

Share

More in Prompt Fundamentals & Techniques

Prompt Fundamentals & Techniques

AI Prompt for Chain-of-Verification (CoVe) Prompting to Reduce Hallucinations

Chain of Verification (CoVe) prompting is a technique for catching a model's own factual slip ups before they reach the reader. Instead of t…

Role: You are a careful fact-checking assistant performing a chain-of-verification pass.

Context:
Topic or question: [TOPIC OR QUESTION]
Intended audience: [AUDIENCE, e.g. internal report, public blog post, client email]

Task (follow these steps in order, showing each step separately):

Step 1 - Draft Answer:
Write a draft answer to the question above in [LENGTH/FORMAT, e.g. 150 words, bullet list].

Step 2 - Verification Questions:
From the draft, extract [NUMBER] specific factual claims (names, dates, numbers, cause-effect statements). For each claim, write one independent, atomic verification question that could be answered without seeing the draft.

Step 3 - Independent Answers:
Answer each verification question on its own, using your own reasoning or stated knowledge, without referencing the draft text. If you are not confident in an answer, say so explicitly rather than guessing.

Step 4 - Revised Answer:
Compare the verification answers to the original draft. List any contradictions found. Then produce a final, corrected answer that resolves those contradictions.

Constraints:
- Do not skip Step 3 or answer verification questions by just repeating the draft
- Flag any claim you cannot verify with reasonable confidence as [UNVERIFIED] rather than deleting it silently
- Keep the final answer within [LENGTH/FORMAT]

Output format:
Return four labeled sections: Draft Answer, Verification Questions & Answers, Contradictions Found, Final Revised Answer.

Make this prompt yours

Prompt Fundamentals & Techniques

AI Prompt for Analogical Prompting to Generate Self-Created Examples Before Answering

Analogical prompting is a technique where, instead of you writing few shot examples by hand, you ask the model to first recall or invent sim…

You are solving a problem using analogical reasoning.

STEP 1: Before solving the problem below, recall or generate 2 related problems that share a similar underlying structure or reasoning pattern. For each one, briefly state the problem and how it would be solved.

STEP 2: Identify what reasoning approach or pattern those examples have in common.

STEP 3: Apply that same reasoning approach to solve the actual problem below. Show your work step by step.

ACTUAL PROBLEM:
[YOUR QUESTION OR PROBLEM HERE]

OUTPUT FORMAT:
- Related Examples: (2 short examples with solutions)
- Shared Pattern: (1-2 sentences)
- Final Answer: (clearly labeled, with step-by-step reasoning for the actual problem)

Make this prompt yours

Prompt Fundamentals & Techniques

AI Prompt for Multi-Persona Debate to Stress-Test an Idea

Multi persona debate prompting is a technique where you ask a model to argue a decision or idea from several distinct, opposing viewpoints b…

You are facilitating a structured debate between multiple expert personas to help evaluate a decision.

DECISION TO EVALUATE:
[DESCRIBE THE DECISION OR IDEA, e.g. "Should we raise our subscription price by 20% for new customers?"]

CONTEXT:
[RELEVANT BACKGROUND: company size, current numbers, constraints, timeline]

PERSONAS:
1. [PERSONA 1 — e.g. "Risk-Averse CFO who prioritizes cash flow stability and customer retention"]
2. [PERSONA 2 — e.g. "Aggressive Growth Lead who prioritizes revenue growth and market share"]
3. [PERSONA 3 — e.g. "Customer Success Manager who prioritizes existing customer satisfaction"]

TASK:
1. Have each persona give a 2-3 sentence opening argument from their specific incentive and priorities
2. Run one round of rebuttal where each persona directly challenges at least one point from another persona
3. After the debate, provide a neutral synthesis that lists the strongest point from each side
4. End with a short, clearly labeled recommendation and the key risk to monitor if that recommendation is followed

CONSTRAINTS:
- Keep each persona's arguments distinct and grounded in their stated priorities, not generic pros/cons
- Do not let the synthesis simply average the positions — it should make an actual call
- Flag any assumption the personas are relying on that isn't confirmed in the context provided

OUTPUT FORMAT:
Label each section clearly: Opening Arguments, Rebuttals, Synthesis, Recommendation.

Make this prompt yours