ReActadvanced
Reasoning + Acting
A four-part agentic pattern that forces the LLM to alternate between reasoning and concrete evidence-gathering steps. Best for research and multi-step decisions.
The components
- 1Goal
What the agent is trying to accomplish.
- 2Loop instruction
The Thought → Action → Observation → Thought cycle the agent should run.
- 3Stopping condition
When the agent should commit to an answer.
Worked example
Rough prompt
I want to research whether we should adopt Cloudflare Workers for our edge functions.
Super-prompt produced by ReAct
[Goal] Produce a recommendation on whether we should adopt Cloudflare Workers as the runtime for our edge functions, anchored to evidence rather than personal preference. [Loop instruction] Work through this in alternating Thought / Action / Observation steps until you have enough evidence to recommend. On each Thought, state what you know, what you still need to find out, and which Action will get you there. On each Action, name a specific piece of evidence to retrieve (a documentation page, a pricing detail, a known-customer use case, a benchmark). On each Observation, summarise what that evidence reveals. Repeat the loop. Do not assert anything you cannot tie back to a specific Observation. [Stopping condition] Stop and commit to a recommendation when one of the following is true: (a) three consecutive Observations would not change your recommendation, or (b) you have run six full Thought/Action/Observation cycles. Whichever happens first. End with a section titled "Final recommendation" containing the answer in one sentence, followed by the three Observations that most strongly supported it.