Planning and control
CoreBreak a goal into steps, run the loop, and self-check before acting.
Concepts
ReActInterleave reasoning and tool calls in one loop, thinking then acting.
ReAct (Reasoning and Acting) structures an agent loop so that every action is preceded by an explicit thought trace. Instead of calling a tool blindly, the model first writes out what it knows and what it needs, then acts, then observes the result and reasons again before the next step. This interleaving makes the agent's decision path auditable and allows errors to be caught mid-loop rather than discovered only at the final output.
The key production insight is that the reasoning step is not decoration: it forces the model to commit to a plan before each action, which reduces hallucinated tool calls and makes failures easier to diagnose from traces.
Sources
Full definition in the glossaryCodeActLet the agent act by writing and running code, not just JSON calls.
CodeAct replaces the conventional JSON tool-call format with executable Python code as the agent's action language. Rather than emitting a structured payload that a harness then dispatches, the model writes a snippet the runtime runs directly. This collapses the gap between reasoning and execution: the agent can compose multiple operations in one block, inspect intermediate results with print statements, and handle branches that a fixed schema cannot express.
In practice CodeAct agents outperform JSON-call equivalents on multi-step tasks, because code is a richer, more composable action space that the model was already trained to produce and reason about.
Sources
Full definition in the glossaryReflexionHave the agent critique its own output and retry before it commits.
Reflexion adds a self-critique step after each attempt: the agent reads its own output, reasons about what went wrong, and then retries with that verbal feedback incorporated. This is reinforcement without weight updates, using the model's own language as the gradient signal. The approach is especially effective for coding and reasoning tasks where the correctness of an answer can be evaluated and fed back in natural language.
The practical value is a substantial reduction in first-pass failures on hard tasks. Reflexion allows a single agent to self-correct across a small number of retries before surfacing the result, often matching accuracy that previously required much larger models.
Sources
Full definition in the glossaryPlan-and-ExecutePlan the whole route up front, then run the steps without re-planning each time.
Plan-and-Execute separates planning from execution into two distinct phases. A planner model (or a dedicated planning call) decomposes the goal into an ordered list of subtasks before any action is taken. A separate executor then works through those steps in sequence, without revisiting the plan unless it explicitly fails. This avoids the drift that accumulates when planning and acting are interleaved, because the intent is locked in up front.
For long, predictable workflows this pattern produces more consistent and auditable behavior than a fully reactive loop, and it makes cost estimation easier since the step count is known before execution starts.
Sources
Full definition in the glossaryTree of ThoughtsExplore several reasoning branches and keep the most promising one.
Tree of Thoughts (ToT) generalizes chain-of-thought by treating reasoning as a search problem over a tree of partial solutions rather than a single linear sequence. At each step, the model generates several candidate continuations, evaluates each one, and expands only the most promising branches, pruning the rest. This is search, not just prompting, and it lets the model recover from early wrong turns that a greedy linear approach would be committed to.
ToT is most valuable for problems with a clear correctness signal, such as mathematical puzzles or planning tasks, where a beam-search style exploration dramatically outperforms a single-path forward pass.
Sources
In production
The discipline that separates a shipped system from a demo.
Workflow before agentMost tasks ship more reliably as fixed steps; reserve autonomy for open-ended problems (Anthropic).
Anthropic's most-cited practical heuristic: before building an autonomous agent, ask whether the task can be expressed as a fixed sequence of steps with deterministic control flow. If it can, a workflow is almost always faster to ship, cheaper to run, and easier to debug than an agent. Reserve true autonomy for tasks where the path cannot be known in advance and where the cost of occasional wrong turns is acceptable.
The temptation to reach for agents early is real, but most production tasks that teams initially frame as open-ended turn out to have implicit structure that a workflow captures cleanly. Starting with a workflow also gives you a performance baseline to justify the added complexity of an agent if you eventually need one.
Sources
Full definition in the glossaryPlan for compounding errorSuccess decays exponentially with steps; fewer steps, checkpoints, and retries beat a long chain.
Each step in an agent loop has some probability of going wrong. Because steps are sequential and dependent, those probabilities multiply: a ten-step chain where each step succeeds 95% of the time has only a 60% chance of completing cleanly end-to-end. The longer the chain, the more sharply overall reliability decays. This is compounding error, and it is the single strongest argument for keeping agent loops short.
The practical response is a combination of: reducing step count wherever possible, inserting explicit checkpoints where the agent verifies its own state, building in retry logic on individual steps before the whole task is abandoned, and designing tasks so that a partial failure is recoverable rather than catastrophic.
Sources