AI Agent Planning and Reasoning: How Agents Decide What to Do
How AI agents plan and reason: chain-of-thought, ReAct, Tree of Thoughts, Reflexion and plan-then-execute, with the trade-offs of each and how to choose.
AI agent planning is how a language-model agent decides which step to take next toward a goal; reasoning is the thinking it does to make that decision. In practice, agents combine a few well-studied techniques: step-by-step reasoning (chain-of-thought), interleaving reasoning with tool calls (ReAct), exploring several options before committing (Tree of Thoughts), and learning from failed attempts (Reflexion). The single most important design rule is that plans must be checked against real results at every step, because a plan that never touches the environment is just a guess.
This explainer focuses on the decision-making layer. For what an agent is and the overall loop, see our complete guide to agentic AI; for the tool-calling mechanics an agent uses to act, see AI agent tools and function calling.
Planning vs reasoning: two jobs, one model
The two words get used interchangeably, but they describe different work:
- Reasoning is the local thinking: interpreting a tool result, working through a calculation, deciding whether an answer is good enough.
- Planning is the global structure: breaking a goal into steps, ordering them, and revising the order when something fails.
In most current agents a single large language model does both. (If you want the underlying mechanics, see how large language models work.) What changes from design to design is where the plan lives and how often it gets revised. Some agents plan the whole job up front; others decide only the next step each turn.
Anthropic's distinction between workflows and agents is a useful anchor here. Workflows are "systems where LLMs and tools are orchestrated through predefined code paths," while agents are "systems where LLMs dynamically direct their own processes and tool usage" [5]. In a workflow, the developer did the planning in code. In an agent, the model plans at run time.
The core techniques
Chain-of-thought: reasoning written out
Chain-of-thought (CoT) prompting, introduced by Wei and colleagues in a January 2022 paper, showed that giving a model a few examples that spell out intermediate reasoning steps improves performance on arithmetic, commonsense and symbolic reasoning tasks [1]. The authors reported that these abilities emerge in sufficiently large models, and that a 540-billion-parameter model prompted with eight chain-of-thought examples reached state-of-the-art accuracy on the GSM8K math word-problem benchmark at the time [1].
CoT is the foundation the other techniques build on. On its own, though, it has a weakness for agents: the reasoning is sealed inside the model. If an early step is wrong, nothing outside the model corrects it.
ReAct: reason, act, observe
ReAct (Yao et al., 2022; published at ICLR 2023) fixed that by interleaving reasoning traces with actions [2]. The model writes a thought ("I need the population of X"), takes an action (calls a search tool), reads the observation, and reasons again. The paper's argument is that the two help each other: reasoning helps the model create, track and update plans and handle exceptions, while actions pull in outside information [2].
The results were concrete. On question answering (HotpotQA) and fact verification (FEVER), ReAct reduced the hallucination and error propagation seen with chain-of-thought alone by querying a simple Wikipedia API [2]. On two interactive benchmarks, ALFWorld and WebShop, it beat imitation- and reinforcement-learning baselines by absolute success-rate margins of 34 and 10 percentage points, using only one or two in-context examples [2].
ReAct's pattern, think then call a tool then read the result, is essentially the loop most agent runtimes now implement. The OpenAI Agents SDK, for example, describes its runner as repeatedly calling the model, running any tool calls or handoffs it returns, appending the results, and looping until the model produces a final output [8].
Tree of Thoughts: explore before committing
Chain-of-thought and ReAct follow one line of reasoning. Tree of Thoughts (ToT), also from Yao and colleagues (NeurIPS 2023), lets the model consider several candidate "thoughts" at each step, evaluate them, and look ahead or backtrack [3]. The full paper breaks this into four design choices: how to decompose the problem into thoughts, how to generate candidates (sampling independently or proposing several in one prompt), how to evaluate states (scoring each one or having the model vote between them), and which search algorithm to use, breadth-first or depth-first search [3].
The headline result is striking. On the Game of 24 puzzle, GPT-4 with chain-of-thought prompting solved 4% of tasks, while ToT reached 74% [3]. The cost is many more model calls per problem, so ToT suits puzzles and planning problems where a wrong early commitment is expensive, not routine tool use.
Reflexion: learning from failure without retraining
Reflexion (Shinn et al., 2023) adds a memory of mistakes. After a failed attempt, the agent writes a verbal reflection on the feedback it received and stores it in an "episodic memory buffer" that guides the next try [4]. No model weights change. The authors reported 91% pass@1 on the HumanEval coding benchmark, compared with the 80% they cited for GPT-4 [4].
Reflexion depends on having a feedback signal, such as failing unit tests or a wrong answer flagged by an evaluator. Where that signal is weak, reflection can just as easily reinforce a wrong belief.
Plan-then-execute and orchestrator patterns
Many production systems separate planning from doing. A planner (often a stronger model) writes a step list; executors carry out each step; the planner revises when results come back. Anthropic describes a version of this as the orchestrator-workers pattern, where "a central LLM dynamically breaks down tasks, delegates them to worker LLMs, and synthesizes their results" [5]. Frameworks expose the idea as a switch: CrewAI agents have a reasoning option, off by default, that makes the agent "reflect and create a plan before executing a task" [9].
How the techniques compare
Technique | What it adds | Cost | Best fit | Main weakness |
|---|---|---|---|---|
Chain-of-thought [1] | Step-by-step reasoning in one pass | Low (one call) | Math, logic, explanations | No outside check on errors |
ReAct [2] | Tool calls between reasoning steps | Moderate, grows with steps | Research, lookups, most tool-using agents | Can loop or wander without limits |
Tree of Thoughts [3] | Multiple candidates, evaluation, backtracking | High (many calls) | Puzzles, constrained planning | Expensive; needs a good evaluator |
Reflexion [4] | Written lessons from failed attempts | Moderate per retry | Tasks with clear pass/fail signals (tests) | Useless without reliable feedback |
Plan-then-execute [5] | Explicit plan, separate executors | Moderate to high | Long, decomposable jobs | Plans go stale if not revised |
Built-in reasoning in today's models
Model providers now build deliberate reasoning into the model API instead of leaving it entirely to prompts. As of November 2026, Anthropic's Claude API offers "adaptive thinking," in which the model decides whether and how much to think on each request, with an effort setting to control depth; the older fixed budget_tokens mode is deprecated and rejected by Claude 4.7 and later models [10]. The same docs describe interleaved thinking, which "lets Claude think between tool calls within a single assistant turn, reasoning about each tool result before determining what to do next" [10]. That is ReAct's think-act-observe cycle, moved inside the model's own turn.
Built-in reasoning does not remove the need for agent design. It makes each decision better informed; it does not decide your stopping rules, permissions or verification steps.
Keeping plans grounded
The research and the vendor guidance converge on one lesson: plans fail when they drift away from reality.
- Check the environment every step. Anthropic says it's "crucial for the agents to gain 'ground truth' from the environment at each step," such as tool results or code execution, to assess progress [5].
- Set stopping conditions. Anthropic recommends limits "such as a maximum number of iterations" [5]. The OpenAI Agents SDK raises a
MaxTurnsExceededexception when a run passes itsmax_turnslimit [8], and CrewAI agents stop after 20 iterations by default [9]. - Write the plan down outside the context window. Long tasks overflow the model's working memory. Anthropic's context-engineering guidance describes agents keeping to-do lists or a
NOTES.mdfile and reloading them later [6]. Our companion piece on agent memory and context management covers this in depth. - Decide how much planning the model should own. OpenAI's documentation frames a real choice: orchestrating via the LLM suits open-ended tasks, while orchestrating via code "makes tasks more deterministic and predictable, in terms of speed, cost and performance" [7].
- Show the plan. Transparency, "explicitly showing the agent's planning steps," is one of Anthropic's three core principles for agents [5]. It also makes human review practical.
Where it goes wrong
- Compounding errors. A wrong early step poisons everything after it. Anthropic notes that autonomy brings "higher costs, and the potential for compounding errors" and recommends testing in sandboxes with guardrails [5].
- Confident but unfounded reasoning. A fluent reasoning trace is not proof. Reasoning that never calls a tool can still hallucinate, which is exactly the failure ReAct targeted [2].
- Cost blowups. Search-based methods like ToT multiply model calls [3]. Retry-based methods like Reflexion multiply attempts [4].
- Manipulated plans. If an agent reads untrusted content, an injected instruction can redirect its plan. See AI agent security and governance.
How to choose a planning approach
- Start with no explicit planner. A ReAct-style loop with good tools and a turn limit handles most tasks. Add structure only when you see it fail.
- If the steps are known, write them in code. Use a workflow, not an agent [5][7].
- If the job is long, externalize the plan as a to-do list or state object the agent updates [6].
- If one wrong commitment is costly and you can score options, consider ToT-style search [3].
- If you have a reliable pass/fail signal, add a Reflexion-style retry with written lessons [4].
- If the work splits into independent parts, consider an orchestrator with workers, and read our explainer on multi-agent systems first.
Outlook
The trend in vendor documentation is clear: reasoning is moving into the model (adaptive and interleaved thinking [10]), while planning structure is moving into frameworks and graphs that developers control (see LangGraph architecture and AI agent orchestration frameworks). Big-tech roadmaps point the same way; for one example, see our coverage of how Google is building out its AI agent ecosystem. Whatever the stack, expect the techniques above to remain the vocabulary for describing what an agent's "brain" is doing.
Frequently asked questions
What is the ReAct pattern in AI agents?
ReAct stands for "reasoning and acting." The model alternates between writing a thought, calling a tool, and reading the result, then reasons again [2]. It reduced hallucination on question-answering tasks compared with chain-of-thought alone, because the model could look facts up instead of guessing [2].
Is chain-of-thought the same as planning?
No. Chain-of-thought is step-by-step reasoning inside one model response [1]. Planning is deciding and revising a sequence of actions over many turns, usually with tool results feeding back in. CoT helps each planning decision, but it doesn't check the plan against the world.
Do AI agents really plan, or do they just predict text?
Under the hood, the model still generates tokens. "Planning" describes the behavior that emerges when those tokens are structured as goals, steps and tool calls, and when a runtime executes them and feeds results back [2][8]. The quality of that behavior depends heavily on grounding each step in real results [5].
When is Tree of Thoughts worth the cost?
When a task needs exploration or lookahead and early mistakes are expensive, such as puzzles or tightly constrained planning. On Game of 24 it raised GPT-4's success rate from 4% to 74% [3]. For routine lookups and tool use, a simple ReAct loop is cheaper and usually sufficient.
How do I stop an agent from looping forever?
Set an iteration or turn limit, which most frameworks support directly [8][9], and add a clear success condition the agent can check. Anthropic also recommends extensive sandbox testing before granting real autonomy [5].
Sources
- Wei et al., "Chain-of-Thought Prompting Elicits Reasoning in Large Language Models," arXiv. https://arxiv.org/abs/2201.11903
- Yao et al., "ReAct: Synergizing Reasoning and Acting in Language Models," arXiv. https://arxiv.org/abs/2210.03629
- Yao et al., "Tree of Thoughts: Deliberate Problem Solving with Large Language Models," arXiv. https://arxiv.org/abs/2305.10601
- Shinn et al., "Reflexion: Language Agents with Verbal Reinforcement Learning," arXiv. https://arxiv.org/abs/2303.11366
- Anthropic, "Building effective agents." https://www.anthropic.com/engineering/building-effective-agents
- Anthropic, "Effective context engineering for AI agents." https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents
- OpenAI Agents SDK documentation, "Orchestrating multiple agents." https://openai.github.io/openai-agents-python/multi_agent/
- OpenAI Agents SDK documentation, "Running agents." https://openai.github.io/openai-agents-python/running_agents/
- CrewAI documentation, "Agents." https://docs.crewai.com/en/concepts/agents
- Anthropic, Claude Platform docs, "Extended thinking." https://platform.claude.com/docs/en/build-with-claude/extended-thinking