Concepts / Tool Use in AI Agents

Tool Use in AI Agents

Agents can fail in ways beyond those shared by all AI applications, and these failures come from planning, tool execution, and efficiency.

  • Programming

Why a Confident Answer Is Not Proof

Imagine an agent that is asked to plan a task, carry it out using a set of tools, and report back. The answer it gives looks fluent and confident. How would you know whether the agent actually did its job well? A fluent answer does not settle the question, because the report can sound right even when one of the steps behind it went wrong.

The starting point for answering that question is not a score on a leaderboard. It is a list of the specific ways the agent can go wrong. In this sense, evaluation is the work of detecting failures. Before you can measure how well an agent performs, you need to know what failure looks like for it.

This article follows that approach. It names the main categories of agent failure, shows how one planning error is separated from another, and then traces a short plan call by call to find the point where it would break.

Why Agents Need Their Own Failure Categories

The more complex a task an agent performs, the more places there are where something can break. A single model answering one question has relatively few points of failure. An agent, by contrast, decides which steps to take, chooses tools, passes arguments to those tools, and works through many actions in sequence. Each of those decisions is a place where the run can go wrong.

This is why agents need their own treatment in evaluation rather than being judged only by the standards that apply to any AI application. Some failures are shared with every AI application. Agents also have failures that come from three sources: planning, tool execution, and efficiency.

Three Sources of Agent Failure

The three categories are siblings. Each one can be studied and measured on its own. The diagram arranges them as a family tree under the broader heading of agent failure modes. Reading it from the top down shows where planning failures sit, and how the tool use failures that the next sections describe are nested beneath planning.

Agent failure modesFailures shared withall AI applicationsTool use failureTool not in inventoryPlanningValid tool, invalidparametersTool executionValid tool, incorrectparameter valuesEfficiency
Which failures belong under planning, which under tool execution, and which under efficiency, and how they relate to the agent as a whole.

The source gives concrete cases only for planning failures, so this article concentrates there. Tool execution and efficiency are named as categories but are not worked through. The structural point still carries forward: an agent can fail while deciding what to do, while carrying out a chosen action, or while doing either in a wasteful way. Each category needs its own measurement.

Planning Failures and Tool Use

Definition

Planning is the stage where an agent decides which steps to take and which tools to use. The source is direct about how this goes: planning is hard and can fail in many ways.

Definition

A tool use failure is a planning error in which the agent's plan involves a tool incorrectly. It is the most common form of planning failure. It can appear in two broad ways: the agent reaches for a tool that it does not actually have, or it calls a tool that does exist in the wrong way.

Under that second heading the source identifies two distinct errors. A valid tool may be called with invalid parameters, meaning the structure of the call is wrong. Or a valid tool may be called with incorrect parameter values, meaning the structure is right but the content is wrong. Together with the missing-tool error, that gives three specific ways of misusing tools.

Each of the three is a distinct mistake that can appear in a plan. They are worth separating because they are caught in different ways, and because fixing one does not automatically fix the others.

Checking a Plan Against a Tool Inventory

The three planning errors are easier to recognize when the calls are placed side by side. The example below uses a single inventory entry for every call. The inventory defines one tool, set_reminder, which takes one integer parameter called minutes. Read each planned call against that inventory line before deciding whether the call is sound.

Worked example

Three Calls Checked Against One Inventory Entry

Inventory: set_reminder(minutes: int). The task is: remind me in 10 minutes to stretch. The agent's plan contains four calls. Decide which calls are sound and, for each unsound call, name the error.

  1. 1
    Call A: set_reminder(minutes=10)

    The tool exists in the inventory, the parameter name matches the signature, and the value 10 is what the task asked for. This call is sound.

  2. 2
    Call B: fetch_calendar()

    The plan names a tool that is not in the inventory. This is the first kind of tool use failure: the agent reaches for a tool it does not actually have.

  3. 3
    Call C: set_reminder(minutes=10, label="stretch", repeat=True)

    The tool exists, but the call passes parameters the signature does not define. This is a valid tool called with invalid parameters. The structure of the call is wrong, because it has too many parameters and the extra ones are not part of the tool's signature.

  4. 4
    Call D: set_reminder(minutes=100)

    The tool exists, the structure matches the signature, and 100 is a legal integer. The call is well formed, but the value is wrong for this task, which needed 10. This is a valid tool called with an incorrect parameter value.

Result

Only Call A is sound. Call B is a tool that is not in the inventory. Call C is a structural error. Call D is a value error. The two parameter errors look similar on the surface, because both involve a valid tool called with bad arguments, but they are different mistakes.

Structural Errors Versus Value Errors

The two parameter-related errors are easy to confuse because both involve a valid tool called with bad arguments. The distinction is about what is wrong. In a structural error, the shape of the call does not match the tool's required parameters: there are too many parameters or the wrong kind of parameter. In a value error, the shape is right and only the content is wrong.

Too many parametersExtra parameters not insignatureminutes=100 for a10-minute taskLegal integer, wrong forthe taskWrong kind ofparameterDoes not match thesignature
How to tell apart a call that misuses the tool's structure from a call that is well formed but carries a wrong value.
QuestionStructural errorValue error
What is wrong?The shape of the callThe content of the call
ExamplePassing parameters the signature does not definePassing 100 when the task needed 10
How is it caught?Often mechanically, by comparing the call to the tool's signatureOnly by knowing what the task actually needs
What is needed to check it?The tool's signatureA reference of the correct answer

Structural and value errors differ in what is wrong and in how they are detected.

The practical lesson is that a structural error can often be caught mechanically, because the call either matches the tool's required parameters or it does not. A value error is harder to see from the call alone. A value of 100 is perfectly legal as a number; it is only wrong relative to what the task demanded. This is why value errors have to be measured against a reference of the correct answer, not simply checked for form.

Predicting the Kind of Error

What do you think happens?

The task asks for a 10-minute reminder. The plan calls set_reminder(minutes=100). Is this a structural error or a value error?

  • Structural error

  • Value error

Reveal answer
Answer:

Value error

The call has the right structure: the tool exists and the parameter name and type match the signature. The problem is the content. 100 is a legal integer, but it is wrong for a task that needed 10, so it is a valid tool called with an incorrect parameter value.

Tracing a Plan Call by Call

Identifying error types is only part of the work. In practice you often need to find where in a run the plan would break. The sequence below follows a plan for the task remind me in 10 minutes to stretch, and then check my calendar. The plan makes three calls. The agent checks each call against the inventory before running it.

AgentTool inventoryset_reminder tool1. Look up set_reminder(minutes=10)2. Found, signature matches3. Run with minutes=104. Reminder set5. Look up fetch_calendar()6. Not found: run breaks
Where the run breaks, and what the agent and the tools have done before and after each call.

Read the sequence as a series of ordered messages. Before call 1, the state holds only the plan. After call 1 is confirmed and run, the reminder exists and the agent has one successful result. Before call 2, the agent looks up fetch_calendar. The inventory has no such entry, so the run breaks at step 6, which is a tool use failure of the first kind. The third planned call, set_reminder(minutes=100), is never reached. Even if it had been reached, it would have been a value error, because the number does not match the 10 minutes the task asked for.

Mistakes When Reviewing Agent Calls

  • Common mistake

    Treating a well-formed call as a correct call

    What it looks like

    set_reminder(minutes=100) passes every structural check for a task that needed 10 minutes.

    Why it fails

    A call can be well formed and still carry a wrong value. Structure and content are separate questions.

    Do this instead

    After confirming the call matches the signature, ask whether the value matches what the task demanded.

  • Common mistake

    Checking value errors only by form

    What it looks like

    A reviewer confirms that minutes is an integer and stops there.

    Why it fails

    Form checks cannot reveal that 100 is the wrong integer. The value is only wrong relative to the task.

    Do this instead

    Measure value errors against a reference of the correct answer for the task.

  • Common mistake

    Assuming a tool exists because it sounds plausible

    What it looks like

    The plan calls fetch_calendar() when the inventory contains only set_reminder.

    Why it fails

    A tool that is not in the inventory cannot be called, and a plan that names it has a tool use failure.

    Do this instead

    Check every tool name in the plan against the inventory before running any call.

  • Common mistake

    Concluding from one failed run how often a failure happens

Why Failure Modes Must Be Measured

Identifying failure modes is only half of evaluation. The next step is to measure how often each one happens. Knowing that tool use is the most common planning failure is a claim about frequency, and frequency can only be checked by counting occurrences across many runs.

A single failed run tells you that a failure is possible. A count across runs tells you how much it matters. Because each category of failure can be studied on its own, an overall picture of agent quality comes from measuring each failure mode and then looking at them together.

The source points to external resources for this kind of measurement, including the Berkeley Function Calling Leaderboard, the AgentOps evaluation harness, and the TravelPlanner benchmark. It also mentions a simple benchmark that the author built to illustrate these failure modes, available in the book's GitHub repository. The source does not describe how these resources work in detail, so treat them as places to look rather than as descriptions of their methods.

Key Takeaways

  • Agents can fail in ways beyond those shared by all AI applications. These failures come from planning, tool execution, and efficiency, and each category needs its own measurement.
  • Tool use failure is the most common form of planning failure. It includes a plan that names a tool not in the inventory, a valid tool called with invalid parameters, and a valid tool called with incorrect parameter values.
  • Structural parameter errors can often be caught by comparing a call against the tool's signature. Value errors require knowing what the task actually needs, so they must be measured against a reference of the correct answer.
  • Tracing a plan call by call shows where a run would break and what state exists before and after each call. Identifying and measuring failure modes across many runs is what makes evaluation meaningful.

Related concepts

More concepts starting with T