The ReAct Pattern (Reason + Act)
ReAct loops interleave reasoning ("what should I do next?") with actions (calling a tool, searching, running code), then feed the result back in before reasoning again.
The prompt
You have access to a "search" tool and a "calculator" tool. For the question below, reason about which tool (if any) you need, state the tool call, wait for the result, then reason again before giving a final answer. Question: [your question]
What to replace
Swap these placeholders for your own details before running the prompt:
[your question]your own value
Pro tip: Always give the agent an explicit stopping condition ("stop once you have a final answer" or a max of N tool calls) — open-ended loops are the #1 cause of runaway automation costs.
How to use this prompt
- Copy the prompt using the button above.
- Replace [your question] with your own details — the more specific you are, the better the output.
- Paste it into ChatGPT / Agent tools and run it.
- If the answer feels generic, add constraints: audience, length, tone, and what to avoid. That single change fixes most weak output.
Learn the technique
The ReAct Pattern (Reason + Act)
Module 2 — Building Agent Loops · Loop & Agentic Engineering
Related prompts
Critique-and-Revise Loops — ChatGPT
A loop is simply feeding a model's own output back to it (or to a second prompt) for review and improvement, repeated until a quality bar is met.
ClaudeCritique-and-Revise Loops — Claude
A loop is simply feeding a model's own output back to it (or to a second prompt) for review and improvement, repeated until a quality bar is met.
ClaudeGiving Loops Memory
For loops that run over many steps (research agents, multi-turn assistants), summarize prior steps into a short running memory instead of replaying the full history every time — this keeps context small and cheap..
Any modelPlanner–Worker–Reviewer Teams
The most robust agent architecture is also the simplest: a Planner decomposes the goal into tasks, Workers execute one task each with narrow context, and a Reviewer checks results against acceptance criteria before anything ships.
Any modelLoop Budgets and Failure Handling
Production loops need budgets (max iterations, max cost, max time) and explicit failure paths: what happens when the Reviewer fails a result three times? Options: escalate to a human, fall back to a simpler method, or return a partial result flagged as unverified.
Any modelProject: Draft–Critique–Revise Content Machine
Deliverable: a working 3-role loop (writer, critic, editor) that produces a publishable piece of content on any topic you give it. Steps: 1.
Topics
Related across the site
AI Automation with n8n
Connect AI models to real workflows using n8n — the open-source automation tool. Learn the HTTP Request and AI Agent nodes, and build automations that run on a schedule or trigger.
Human in the loop
Human in the loop means inserting a person at decision points in an automated workflow — typically to approve consequential actions or review low-confidence outputs before they take effect.
n8n and AI: Build Your First Real Automation
A practical walkthrough of wiring an AI model into an n8n workflow — the node structure, the prompt that makes it reliable, and three automations worth building first.
ReAct pattern
ReAct (Reason + Act) is the core agent loop: the model reasons about what to do, takes an action via a tool, observes the result, then reasons again. It repeats until it can answer.
AI Email Triage & Auto-Responder
Trigger: new email in inbox -> AI node classifies intent (support, sales, spam, urgent) -> conditional branches route to auto-reply, Slack alert, or human queue..
Auto Content Repurposing Pipeline
Trigger: new blog post published (RSS or webhook) -> AI node: generate a Twitter/X thread, LinkedIn post, and email blurb from the article -> Route each to the right channel.