DEV Community

Cover image for A Successful Tool Call Doesn’t Mean an AI Agent Did the Right Thing
Caterfli
Caterfli

Posted on

A Successful Tool Call Doesn’t Mean an AI Agent Did the Right Thing

A Successful Tool Call Doesn't Mean an AI Agent Did the Right Thing

There's a small green check mark that can hide a surprisingly big problem.

An AI agent calls an API. The server returns HTTP 200. The database accepts the update. The tool reports success.

Everything looks good.

Except the agent just changed the wrong customer's shipping address.

Or issued a refund that nobody authorized.

Or updated an inventory quantity based on an outdated report.

Technically, the tool call succeeded. Operationally, the result was wrong.

This is one of the things I think we need to talk about more as AI agents move beyond answering questions and start changing real business systems.

A successful operation proves that the system accepted the request. It doesn't prove that the request was correct, authorized, or appropriate.

Those are separate questions, and treating them as the same thing is a mistake.

What does a successful tool call actually tell us?

Imagine an AI agent connected to an order management API.

Someone asks:

"Change the delivery address for order 1842 to the new address the customer sent us."

The agent calls the update endpoint.

The API responds:

{
  "success": true,
  "order_id": 1842,
  "status": "updated"
}
Enter fullscreen mode Exit fullscreen mode

Great. The API did what it was asked to do.

But let's look at what this response doesn't tell us.

  • Was order 1842 actually the order the customer meant?
  • Was the new address verified?
  • Was the person making the request allowed to change delivery details?
  • Was the order already shipped?
  • Did the agent accidentally use an address from a different conversation?

The response answers a technical question: did the requested operation complete?

It doesn't answer the business question: should this operation have happened?

That's the gap.

Example one: the refund that shouldn't have happened

Picture a small online store that uses an AI assistant to handle routine customer support requests.

A customer writes:

"My package never arrived. Please refund my order."

The agent searches for the customer's orders, finds one marked as delivered, and submits a refund request.

The payment provider processes the refund successfully.

A few minutes later, the operations manager discovers that the customer actually had two orders. The missing package belonged to the second order, but the agent refunded the first one.

Nothing failed at the API level.

The payment provider did not malfunction. The refund endpoint worked exactly as designed.

The mistake happened earlier, when the agent interpreted the request and selected the target order.

This is why checking the final tool response isn't enough. By the time a successful response arrives, the wrong action may already be complete.

A safer workflow would verify the order identity, check the applicable refund policy, confirm the requested amount, and require approval when appropriate before executing the transaction.

The agent should not get credit for a successful refund if it refunded the wrong purchase.

Example two: a report that looks right but isn't

Not every harmful tool call involves a destructive action.

Suppose a sales manager asks:

"How much revenue did we generate last month?"

The AI agent queries the database and returns a figure of $86,000.

The SQL query runs without an error. The database returns valid rows. The agent calculates the total correctly based on those rows.

But the query included cancelled orders and excluded several completed orders because the agent misunderstood the company's status labels.

The arithmetic is correct. The answer is wrong.

This kind of failure can be harder to notice because nothing changes in the database. There is no failed transaction or alarming error message.

Someone might even copy the number into a board presentation.

For reporting tasks, correctness depends on more than successful execution. It also depends on understanding the data model, applying the right business definitions, and communicating uncertainty when the available information is incomplete.

A reliable AI system needs to validate the meaning of results, not merely whether a query ran.

Five different kinds of success

I find it useful to separate tool execution into five questions.

1. Did the call execute?

Did the API, database, or connected tool return a response?

2. Was the caller authorized?

Was this person allowed to perform this action on this resource?

3. Was the request valid?

Did the arguments match the expected schema and business rules?

4. Was the intended target correct?

Did the agent select the right customer, order, account, or record?

5. Was the outcome appropriate?

Did the action achieve the user's actual goal without violating policy or causing an unintended side effect?

A system can pass the first four checks and still need more context to evaluate the fifth. And some checks, such as authorization, must happen before execution rather than after it.

This isn't a claim that every business action can be perfectly verified. It means we should stop using one green check mark to represent five different things.

The problem gets bigger when agents chain tools together

A single tool call is relatively easy to inspect.

Now imagine an agent performing an entire workflow:

  1. Search for a customer.
  2. Find their recent orders.
  3. Identify an unpaid invoice.
  4. Update the invoice.
  5. Send a notification.
  6. Generate a report.

Every call could succeed individually while the overall workflow goes wrong.

Perhaps the agent identifies a customer using an outdated email address. The invoice update then applies to the wrong account, and the notification sends confidential information to an unintended recipient.

The system might log six successful operations.

From an operational perspective, though, the workflow has failed.

This is why multi-step AI automation needs validation between steps. The agent shouldn't blindly trust every result simply because the preceding tool returned successfully.

It should verify relevant identifiers, confirm assumptions, and stop when the evidence no longer supports the intended action.

For consequential workflows, the system should also consider whether the entire operation can be rolled back or whether compensating actions are needed if a later step fails.

Why permissions must be checked independently

There's another subtle issue here.

A tool may accept an operation because the underlying API credential has broad permissions. That doesn't necessarily mean the person chatting with the AI has permission to perform the same operation.

For example, a company might connect an AI assistant using a service account that can update every customer record.

A junior support employee asks the assistant to change a customer account.

The API accepts the request.

But should the employee have been allowed to make that change?

The answer cannot depend only on what the connected credential permits.

A well-designed system needs to evaluate the acting person's permissions, the agent's assigned capabilities, and the relevant application policy before passing the operation to the connected system.

This is a core consideration when connecting business systems to AI agents.

What should developers measure instead?

Successful execution rates are still useful. We need to know whether tools are reliable and whether integrations are failing.

But they should be part of a broader set of measurements.

I'd track at least the following:

  • Execution success: How often do tool calls complete without technical errors?
  • Authorization denials: How often does the system correctly block an unauthorized action?
  • Target accuracy: How often does the agent select the intended record or resource?
  • Policy compliance: How often do completed operations satisfy the applicable business rules?
  • Outcome quality: Did the action actually accomplish the user's goal?
  • Recovery rate: When something goes wrong, can the system detect it and recover safely?

These metrics tell a much more useful story than execution success alone.

They also help teams discover where the real problem lies. Is the model choosing the wrong records? Is the API returning ambiguous information? Are permissions too broad? Are business rules poorly defined?

Without that distinction, teams may optimize the wrong thing.

A better approach to tool execution

The design doesn't need to be complicated to be meaningful.

Before an operation, validate the requested tool, arguments, target, permissions, and policy.

For sensitive changes, present the actual proposed action to an authorized person before execution.

After execution, verify the result where possible. Check the updated record, confirm the transaction identifier, and ensure the result matches the expected state.

Finally, record the complete chain: the original request, the proposed operation, the checks performed, the approval decision, the tool response, and the verified outcome.

If the result is ambiguous, don't pretend it succeeded just because the API returned a response.

Tell the user what happened and what remains uncertain.

That's much more useful than a confident green check mark.

Final thoughts

I think one of the biggest mistakes in AI automation is confusing activity with achievement.

An agent can call tools quickly, produce clean logs, and complete hundreds of operations without errors. That doesn't automatically make it useful or safe.

What matters is whether it did the right thing, for the right person, on the right resource, under the right conditions.

Technical success is a necessary part of reliable automation. It's just not the finish line.

The next time someone tells you their AI agent has a 99% successful tool-call rate, ask one more question:

Successful at what, exactly?

That answer will tell you much more about the system than the percentage ever could.

Top comments (0)