AdvancedAgent DesignFree prompt

Decompose a Goal into a ReAct Reasoning-and-Tool Loop

Plan how an agent should alternate between reasoning and tool calls to reach a goal, with explicit halting logic to avoid infinite loops.

Design the think→act→observe loop for a task so the agent makes progress every step and knows exactly when it is done.

ReActreasoning loopplanninghaltingtool use

At a glance

Access

Free prompt

Open to copy — no account or payment needed.

Prompt objective

Design the think→act→observe loop for a task so the agent makes progress every step and knows exactly when it is done.

Real use case

An engineer is building a research agent that keeps calling the same search tool forever. They need a structured loop with a budget and a clear definition of "done."

Customize these fields first

GOALTOOL NAME: WHAT IT RETURNSIF ANY

Replace the placeholders with your own context before you run the prompt. That usually improves the first output more than adding more instructions later.

Prompt

You are designing the control loop for a tool-using AI agent that follows a reason→act→observe pattern.

Goal the agent must achieve: [GOAL]
Available tools: [TOOL NAME: WHAT IT RETURNS] (repeat)
Hard limits: max [N] tool calls, max [N] minutes, budget [IF ANY]

Produce:
1. A step-by-step trace of how an ideal run would look: for each step show THOUGHT (what to reason about), ACTION (which tool + arguments), and EXPECTED OBSERVATION.
2. The explicit "done" condition: how the agent decides the goal is met.
3. Loop guards: how to detect and break out of (a) repeated identical tool calls, (b) no-progress loops, (c) hitting the call/time budget.
4. A fallback plan when a tool fails or returns nothing useful.
5. The final answer format the agent should return to the user.

Keep the reasoning concise and bias toward fewer tool calls. Note where a cheaper or cached path could replace a tool call.

Open directly in an AI — the text is pre-filled:

How to use this prompt

  1. 1Replace the key placeholders first: GOAL, TOOL NAME: WHAT IT RETURNS, IF ANY.
  2. 2Replace any bracketed placeholders like [this] with your own context.
  3. 3Add extra background information when you want more tailored results.
  4. 4Combine multiple prompts in one conversation when you need a richer output.
  5. 5Save your best-performing prompts so they are easy to reuse later.

Next best step

Open the guide first, then branch only if you still need more.

A guide for technical builders choosing between prompts, coding workflows, and agent-based implementation.

If this prompt is close but not quite right, generate variants next. If the job is recurring, move into the course library after the guide.

Related prompts

View all

Explore other prompt categories

Move sideways into adjacent libraries when the current category is not the full answer.

Every prompt here is free. The course teaches the thinking behind them.

Copy as many prompts as you like. When you want to move from single prompts to a repeatable AI workflow, Learn AI in 30 Days walks through it, one day at a time.

Get the courseSee the 30-day curriculum first

Buy the course once ($15/$20 by length), or go all-access for $10/mo with a verifiable certificate.