Agent Planning, Tool Selection and Failure Modes

How agents plan: the three kinds of tools (knowledge augmentation, capability extension, write actions), plan generation and validation, decoupling planning from execution, planning granularity, control flow in plans (sequential, parallel, if, loops), reflection and error correction, choosing a tool inventory — and how to evaluate the failure modes unique to agents: planning failures, tool failures and inefficiency.

On this page

Simple definition#

An agent is defined by two things: the environment it operates in and the tools it can use. Planning is how it turns a goal into a sequence of tool calls; reflection is how it notices mistakes and corrects them.

Because an agent takes many steps, it has many more ways to fail than a single model call. Good agent design means knowing those failure modes and measuring each one.

Tools: what an agent can do#

Category Purpose Examples Risk
Knowledge augmentation Fetch information the model lacks Retrievers, SQL queries, internal APIs, web search, email and calendar readers Low (read-only), but watch data access and indirect prompt injection
Capability extension Compensate for model weaknesses Calculator, code interpreter, unit converter, translator, date/time, OCR Low to medium (code execution needs a sandbox)
Write actions Change the world Send email, update CRM, create ticket, transfer funds, deploy code High — side effects may be irreversible

Tools also make a model multimodal: a text-only model with an image-captioning or transcription tool can work with images and audio.

Planning#

Generate, validate, execute#

Decouple planning from execution
flowchart LR
    T["Task"] --> PG["Plan generator<br/>LLM proposes steps"]
    PG --> V{"Validator<br/>tools exist? params valid?<br/>within budget and policy?"}
    V -->|"invalid"| PG
    V -->|"valid"| H{"Needs human<br/>approval?"}
    H -->|"yes"| A["Approve / edit"]
    H -->|"no"| X["Executor<br/>runs tool calls"]
    A --> X
    X --> R{"Reflect<br/>goal met?"}
    R -->|"no"| PG
    R -->|"yes"| D["Done"]

Separating planning from execution lets you check a plan before running it: reject plans that call tools that do not exist, exceed a step budget, or include forbidden actions. Validators can be heuristics (a whitelist of tools, a maximum length) or an AI judge. Several plans can be generated in parallel and the best one chosen.

Intent classification helps planning too: knowing the request is a billing question narrows the tools to consider; knowing it is out of scope stops planning early.

How models plan#

Foundation models plan by being prompted with the task, the tool inventory (names, descriptions, parameters) and examples of good plans. Native function calling makes the output structured: the model returns tool names and arguments that your code executes.

Planning granularity#

Granularity Example step Trade-off
High level “Get last quarter’s top products” Easy to plan, needs translation into executable calls
Low level / exact get_sales(start="2026-07-01", end="2026-09-30", sort="revenue", limit=5) Directly executable, harder to plan and brittle when tools change

A common approach is hierarchical: plan in natural language at a high level, then translate each step into exact tool calls — keeping the plan readable for humans and robust to tool changes.

Control flow in plans#

Flow Example
Sequential Get the order, then get the shipment
Parallel Fetch prices from three suppliers at once
If statement If the refund exceeds €50, ask for approval; else issue it
For loop For each invoice in the batch, validate and post

Parallel steps cut latency. Conditionals and loops need care: bound every loop, and make the executor — not the model — enforce the limits.

Reflection and error correction#

An agent should check its work after receiving the task (is it feasible?), after generating a plan (is it sensible?), after each step (did that work?) and at the end (is the goal met?).

Patterns:

  • ReAct — interleave reasoning, action and observation so each result informs the next step. See ReAct.
  • Reflexion — after a failed attempt, an evaluator scores the outcome and a self-reflection step writes down what went wrong; the next attempt uses that lesson.
  • External verification — the strongest form: tests, validators, database checks or a separate judge model. Self-assessment alone is unreliable.

Reflection costs tokens and latency; apply it where errors are costly. See reflection and evaluator–optimizer.

Tool selection: what goes in the inventory#

More tools give an agent more capabilities — and make it harder to choose correctly.

  1. Start small and add tools only for observed gaps.
  2. Run ablations: remove a tool and measure the effect. If performance does not drop, the tool is not earning its place.
  3. Track usage: which tools are called, how often, and which fail most. Distributions differ by model.
  4. Study tool transitions: which tool usually follows which. Frequent pairs can be merged into one composite tool.
  5. Hard tools: improve their descriptions and examples, simplify their parameters, fine-tune, or replace them.
  6. Large inventories: group tools, load them on demand, or split work across specialised agents.

Some agents learn to create tools — writing and saving code as reusable skills. See agent harnesses and skills.

Agent failure modes#

To evaluate an agent, list its failure modes and measure how often each occurs.

A taxonomy of agent failures
flowchart TB
    F["Agent failure"] --> P["Planning failures"]
    F --> T["Tool failures"]
    F --> E["Efficiency failures"]
    P --> P1["Invalid tool<br/>(not in inventory)"]
    P --> P2["Valid tool,<br/>invalid parameters"]
    P --> P3["Valid tool,<br/>wrong parameter values"]
    P --> P4["Goal failure<br/>wrong goal or<br/>constraints violated"]
    P --> P5["Reflection error<br/>claims success<br/>when it failed"]
    T --> T1["Tool returns<br/>wrong output"]
    T --> T2["Translation error<br/>plan → command"]
    T --> T3["Missing tool<br/>for the task"]
    E --> E1["Too many steps"]
    E --> E2["Too costly"]
    E --> E3["Too slow /<br/>missed deadline"]

Planning failures#

Failure Example
Invalid tool Calls web_search, which is not in its inventory
Invalid parameters Calls convert_currency with two arguments when it needs three
Incorrect parameter values Right tool and shape, wrong value — converts 100 when the order was 120
Goal failure Solves a different task, or ignores a constraint (books a trip over budget, or to the wrong city)
Time-constraint failure Completes the work after it stopped being useful
Reflection error Insists the task is complete when it is not — assigns 40 of 50 people to rooms and reports success

Measure with a planning dataset of (task, tool inventory) pairs. For each task, generate several plans and compute:

  • the share of plans that are valid, and how many attempts it takes on average to get one;
  • the share of tool calls that are valid;
  • how often invalid tools, invalid parameters and incorrect values occur;
  • which task types and which tools fail most — and why.

Tool failures#

The plan was right but the tool’s output was wrong: an OCR tool misreads an invoice, a text-to-SQL step writes a wrong query, a translator garbles a plan step into the wrong command — or the agent simply lacks a tool the task needs. Test every tool independently, log every tool call with its input and output, and ask domain experts which tools they would use for tasks where the agent fails often.

Efficiency failures#

A valid plan can still be wasteful. Track, on average per task: steps, cost, time per action, and which actions are unusually slow or expensive. Compare against a baseline — another agent, or a human doing the task — remembering that efficiency differs: reading 100 web pages is slow for a person and trivial in parallel for an agent.

Common mistakes#

Review questions#

What are the three categories of agent tools? Knowledge augmentation (retrieve information), capability extension (calculators, code interpreters, converters) and write actions (change external systems). Write actions carry the most risk.

Why decouple planning from execution? So a plan can be validated — tools exist, parameters are valid, budgets and policies are respected, approvals obtained — before any side effects occur, and so several plans can be compared.

What is planning granularity and how do you choose it? The level of detail in plan steps. High-level plans are easier to generate and robust to tool changes but need translation; exact plans are directly executable but brittle. A hierarchical approach combines both.

List the planning failure modes of an agent. Invalid tool, valid tool with invalid parameters, valid tool with incorrect values, goal failure (wrong goal or violated constraints), time-constraint failure and reflection errors where it falsely claims success.

How would you decide which tools to give an agent? Start small; add tools for observed gaps; run ablations to confirm each tool helps; monitor usage, failures and transitions; simplify or replace hard tools; split large inventories across specialised agents or load tools on demand.

Summary#

  • Tools are knowledge augmentation, capability extension or write actions; write actions need guardrails first.
  • Generate, validate, then execute plans; choose granularity deliberately; bound loops in the executor.
  • Reflect after the task, the plan, each step and the end — with external verification where possible.
  • Curate the tool inventory with ablations and usage data.
  • Measure planning failures, tool failures and efficiency separately; each has a different fix.

References#