AI Agent Evaluation: How to Measure Task Success, Tool Use, and Cost in Production

An agent can sound confident while quietly failing. It books the wrong date, calls the wrong tool three times, or burns through tokens on a task a script could have done in seconds. None of that shows up in a demo. AI agent evaluation is how you catch it in production: you measure whether the agent finished the task, how it used its tools, and what each completed task cost. Without those three numbers, you are guessing about quality and paying for the privilege.

What AI agent evaluation actually covers

Most teams start with a vague question: is the agent good? That question has no answer. Break it into three smaller ones. Did the agent complete the task correctly? Did it use tools well? And what did it cost to get there? Each needs its own metric, because an agent can pass one and fail the other two.

Task success is the outcome. Tool use is the behaviour. Cost is the price of both. An agent that always succeeds but calls a paid API twelve times per task is a different problem from one that fails half the time but costs almost nothing. You need all three numbers before deciding whether to ship a change or roll it back.

Separate two kinds of evaluation. Offline evals run a fixed set of test tasks against a new prompt or model before you ship. Production monitoring watches live traffic after you ship. The two feed each other: the failures you see live become the test cases in your offline set. If you have not built an offline eval set yet, the process for testing an AI feature with eval sets and human review is a solid starting point.

Define task success before you measure it

Task success sounds simple until you try to score it. “Draft a reply to this customer” has no single right answer. “Cancel order 1042 and refund the card” does. The more concrete the task, the easier it is to judge.

Sort tasks into two groups. Verifiable tasks have a checkable outcome: a record updated, a file created, a message sent to the right address. Judged tasks need a human or a second model to decide whether the output was good enough, like a summary or a draft email. Score them separately. Mixing them into one average hides where the real failures live.

For verifiable tasks, write the check as code. A refund task passes when the order status is “refunded” and the amount matches. A lookup task passes when the returned value matches the database. These checks run on every production run and give you the agent task success rate: completed tasks divided by attempted tasks, split by task type.

For judged tasks, sample 20 to 50 runs a week and grade them on three points: correct, complete, and safe to send. A three-point rubric beats a ten-point one, because graders actually agree on three points. Record the grades next to your automated checks so you see both numbers side by side.

Measure tool use, not just final answers

An agent’s final answer can be right for the wrong reasons. It might have called the search tool five times with the same query, pulled a huge document it never used, or guessed an ID instead of looking it up. Those habits cost money and break under load, even when the answer looks fine.

Agent tool use deserves its own metrics. Track four of them per task type:

  • Calls per task. Average tool calls to finish one task. A sudden rise after a prompt change usually means the agent is looping or re-checking work it already did.
  • Wrong-tool rate. How often the agent picks a tool that cannot help with the current step, or passes it bad arguments. A high rate points at unclear tool descriptions, not a bad model.
  • Retry rate. How often a tool call fails and the agent tries again. Some retries are normal. Repeated identical retries are a bug in the agent’s logic.
  • Unused context. How often the agent fetches data it never uses in its answer or its next tool call. Large fetches that go nowhere are pure cost.

These numbers also tell you where to fix things. If the wrong-tool rate is high on one tool, rewrite that tool’s description with concrete examples of when to use it and when not to. For agents that answer from documents, our guide to RAG evaluation shows how to check whether retrieved passages support the answer.

Cost per task is the number that matters

Token prices are easy to quote and hard to act on. What matters is the agent cost per task: total spend on a task type divided by the number of tasks of that type, including failed and retried ones. A task that costs 40 cents when it succeeds and $2.40 when it fails twice first has a real cost closer to the second number.

Break the cost into four buckets: model calls, tool calls, retries and loops, and human review time.

Once you have cost per task, you can make trade-offs with numbers instead of opinions. A smaller model that succeeds 85 percent of the time at 10 cents a task may beat a large model that succeeds 95 percent at 90 cents, if a human catches the failures cheaply. Or it may not, if failures reach customers. For the mechanics of tracking spend, see our walkthrough on tracking AI API costs, and for the logging setup that feeds all of this, the guide to monitoring LLM apps in production covers what to record per run.

Set a cost ceiling per task type and alert on it. When cost per task doubles, something changed: a prompt grew, a loop appeared, or traffic shifted to harder tasks. Find out which before the invoice arrives.

Build an eval set from real production traffic

Your best test cases already exist in your logs. Every week, pull the runs that failed, the runs that cost the most, and a random sample of ordinary runs. Turn each one into a test case: the input, the tools available, and the expected outcome. Keep the set small, 50 to 100 cases, and refresh it monthly. A stale eval set tests yesterday’s problems.

Include edge cases on purpose: the angry customer, the order with two items missing, the request in a second language. If your agent only gets tested on clean inputs, it will only pass clean inputs. Label each case with its task type so a regression in one area does not hide behind a good overall score.

Run the eval set against every change that could affect behaviour: a new prompt, a new model, a new tool, a new tool description. Record the success rate, the tool use numbers, and the cost per task for each run. A change that raises success by two points while tripling cost is not an improvement until you decide the trade is worth it.

Set thresholds that trigger action

Metrics without thresholds are decoration. For each task type, pick three levels: investigate, roll back a change, and page someone.

Start with the investigation threshold. If the agent task success rate for refunds drops below 95 percent in a day, someone looks at the failed runs that same day. If cost per task rises more than 25 percent week over week, someone finds out why.

The rollback threshold belongs to your deploy process. Before you ship a prompt or model change, write down the numbers that would make you revert it: success below X, cost above Y, wrong-tool rate above Z. Run the eval set first, then watch production for a day. If a threshold trips, revert first and investigate second.

Finally, decide who owns the numbers. Evaluation is nobody’s job by default, which means it becomes nobody’s job in practice. One person should review the dashboard weekly, even if that takes fifteen minutes.

A starter scorecard

If you track nothing else, track these six numbers per task type, weekly:

Metric What it tells you Good starting target
Task success rate Whether the agent finishes the job correctly 95%+ for verifiable tasks
Calls per task Whether the agent works efficiently Stable week over week
Wrong-tool rate Whether tool descriptions are clear Under 5%
Retry rate Whether the agent recovers or loops Under 10%
Cost per task What each completed task really costs Within 25% of baseline
Human review rate How much oversight the agent still needs Falling over time

The targets are starting points. A research agent that drafts long reports will cost more per task than a lookup agent, and that is fine, as long as you know the number and chose it on purpose.

Evaluation is a habit, not a project: define success, measure tool use, watch cost per task, and feed real failures back into your test set. Start with one task type and the six numbers above.

Ditulis oleh

Firdaus Safari Putra

Founder, PT FirKaizen Digital Solutions

Firdaus Safari Putra adalah founder PT FirKaizen Digital Solutions. Ia membangun dan mengoperasikan infrastruktur server di balik panduan ini, dan menulis berdasarkan apa yang benar-benar ia jalankan, uji, dan ukur — bukan teori.