Evaluating AI Agents: From Tool Calling to Task Closure
A common failure mode in AI agents is rigorous local reasoning paired with ineffective overall action: the agent explains its uncertainty carefully yet never delivers a result. This article examines why the water leak analogy exposes this gap, covering task drift, shallow root cause analysis, minimally invasive fixes, permission handling, context compression, and a complete task-closure execution loop. It concludes with a six-dimension evaluation framework that measures both outcomes and process, so you can judge whether an agent truly moves a user's problem to a verifiable, accountable result.
Evaluating AI Agents: From Tool Calling to Task Closure
1. Don’t Judge an Agent by How Carefully It Talks
Imagine a water leak at home. The repair technician arrives but, instead of containing the damage and locating the leak, keeps explaining his investigative methodology. He traces pipes, measures ambient humidity, investigates whether the flow meter is being interfered with, and verifies his own location. Every step comes with cautious disclaimers: the current evidence cannot directly prove any conclusion, and a failed tool cannot prove something doesn’t exist.
None of these statements is individually wrong. Yet after a long investigation, the leak remains unfixed. To make matters worse, the technician ends up trying to contact the water utility to request broader authorization for larger-impact operations.
This parable exposes a classic agent failure mode: cautious reasoning at every local step, yet overall action drifting away from the goal.
An agent typically consists of a language model, task state, tool interfaces, and execution control. The model analyzes the problem and proposes actions, tools query information or change the environment, and the control layer decides which actions are allowed, when to stop, and when to escalate to a human.
Therefore, evaluating an agent should not stop at whether its answers are fluent, whether it calls tools frequently, or whether it repeatedly states its uncertainty. The more important questions are:
- Does it understand the problem the user actually wants solved?
- Do its chosen actions help narrow down the problem?
- Can it produce a verifiable result within a reasonable cost?
- Does it respect permission boundaries and operational risk constraints?
- Can it correct course promptly when an investigation dead-ends?
Together, these questions determine whether an agent can move from “being able to analyze” to “being able to deliver.”
2. Rigorous Reasoning Is Not Effective Diagnosis
1. Uncertainty disclaimers have value, but they don’t replace action selection
“Anomalous humidity readings do not directly confirm a leak here” is a legitimate statement of evidential limits. Rising humidity could also come from condensation, seepage, or other environmental factors.
But effective diagnosis shouldn’t end at avoiding over-inference. The agent should go further and answer:
- What candidate causes exist right now?
- Which cause is most worth checking first?
- What observation would distinguish between them?
- How long would the next check take, and is it risky?
- How will the check result change the plan going forward?
For example, when suspecting a leaking joint, the agent should first check whether there is persistent moisture near that joint, and if necessary use a safe, localized isolation method to observe changes—rather than first investigating environmental parameters with no direct connection to the leak.
Cautious expression addresses “don’t overstate your evidence”; diagnostic strategy addresses “what should be done next.” Both are indispensable.
2. Evidence doesn’t have to be absolutely certain to justify low-risk actions
Real-world troubleshooting rarely comes with complete information. Developers routinely face incomplete logs, intermittent failures, and environments that are hard to reproduce.
The reasonable approach is not to chase certainty indefinitely, but to make judgments by weighing evidence strength, action risk, and reversibility:
- Read-only queries can be executed even with weak evidence.
- Local, reversible changes should have a clear hypothesis and a verification method.
- Broad-impact or hard-to-undo operations require stronger evidence and authorization.
- High-risk actions with insufficient evidence should be stopped or handed to a human.
In other words, rigor does not mean never drawing conclusions—it means matching the strength of conclusions and the intensity of actions to the quality of the evidence.
3. Task Drift: From Fixing the Failure to Explaining Tool Errors
In the parable, the investigation path drifts from the leak to the flow rate, from the flow meter to instrument interference, then to location analysis and environmental assessment. Each step seems connected to the previous one, but the chain as a whole has drifted away from the user’s goal.
This phenomenon can be called task drift: the agent mistakes new problems produced by intermediate steps for new tasks that must be completed.
1. A tool failure isn’t necessarily worth digging into
When a tool call fails, the first question should be whether that tool is actually necessary for the original task—not an automatic assumption that it must be fixed.
For example, when a diagnostic endpoint becomes temporarily unavailable, there are three possible paths:
- Necessary with no alternative: investigate why the call failed, or explicitly report the blocker.
- Necessary with alternatives: use other sources of evidence and keep moving forward.
- Not necessary: record the limitation, drop the side branch, and return to the main task.
If the leak can be located through direct observation and localized isolation, a failed flow-rate measurement should not automatically trigger a chain of environmental investigations.
2. Every subtask should state its relationship to the main goal
An agent can maintain a concise task dependency structure:
- Main goal: restore normal state and verify the failure is gone.
- Required subgoals: scope the failure, identify the cause, apply the fix, run verification.
- Optional subgoals: gather supplementary evidence, compile long-term improvement suggestions.
- Irrelevant side branches: investigations that cannot affect the diagnosis or the fix.
Before starting a new action, the system should ask: “Which decision will this result change?” If there is no answer, the action should usually be deferred or canceled.
This is more effective than simply telling the agent “don’t go off topic,” because it converts an abstract instruction into a checkable execution condition.
4. Root Cause Analysis Must Not Degrade into Restating the Problem
Describing the leak’s cause as “water left its intended delivery range” does not complete root cause analysis—it merely restates the symptom in different words.
Software systems produce similar statements:
- “The request failed because the service did not return successfully.”
- “Tasks are backing up because processing speed is lower than arrival rate.”
- “Data is inconsistent because the replicas contain different content.”
These statements may be correct, but they don’t guide a fix.
1. An actionable root cause needs mechanism and location
A useful root cause conclusion typically states:
- The failing object: which component, configuration, connection, or processing step went wrong.
- The failure mechanism: through what process it produces the anomaly.
- Trigger conditions: under what input, load, or environment the problem occurs.
- Supporting evidence: which observations support the conclusion, and which hypotheses have been ruled out.
- Fix mapping: why the proposed change would interrupt the failure process.
If evidence is insufficient, the conclusion should be explicitly labeled as a “current hypothesis” or “scoping findings,” rather than claiming the root cause has been confirmed.
2. Mitigation and root cause fixing must be distinguished
Temporary containment is not permanent repair, but it shouldn’t be dismissed either.
A reliable workflow usually proceeds as:
- First contain ongoing loss or spread of impact.
- Then locate the fault and its failure mechanism.
- Apply a targeted fix.
- Verify recovery and monitor for recurrence.
For failures actively impacting a business, an authorized, reversible, localized mitigation may be more valuable than continuing to chase a complete explanation. What matters is reporting accurately whether what has been completed is mitigation or a root cause fix.
5. “Minimal Fix” Must Account for Blast Radius Too
A minimal fix is not the one with the fewest lines changed or the fewest steps executed. It is the fix that, while satisfying the goal, minimizes impact scope, introduced risk, and recovery cost.
Shutting down the entire water supply might take just one operation, but it could affect many normal users—so it cannot be called a minimal fix merely because it is simple.
Similar anti-patterns in technical systems include disabling an entire service to fix a local anomaly, granting sweeping permissions to work around a single access issue, or rebuilding an entire dataset to correct a few erroneous records.
When evaluating a fix, consider:
- Does it directly target the identified failure mechanism?
- Does it affect previously working functionality or users?
- Is there a rollback path?
- Can it be validated on a small scale first?
- Does it mask the problem and make later diagnosis harder?
“Minimal” should be measured in terms of system impact, not command count.
6. Permission Escalation Is Not the Default Escape Hatch
When an agent stalls, it often attributes the blocker to insufficient permissions. But expanded access only solves access restrictions—it cannot compensate for a wrong goal, insufficient evidence, or a flawed plan.
1. Permissions should be tied to specific actions
A well-formed authorization request should include:
- The resource or object to access.
- The specific operation to perform.
- The necessary relationship between that operation and the user’s goal.
- The potential impact.
- The authorization’s valid scope and duration.
- Optional lower-privilege alternatives.
“Please grant full access so I can continue” carries too little information: the user can neither assess the risk nor judge whether the permission is truly necessary.
2. The system should enforce permission constraints independently
Relying on the model’s promise that “it won’t overstep” is not enough. Permission enforcement belongs in the execution layer: differentiate read-only from write capabilities, restrict accessible resources, require confirmation for high-risk actions, and record audit logs.
User authorization is also not a pass for arbitrary operations. Shared resources, external parties, and objects outside the user’s control remain subject to their own access rules and operational constraints.
7. Context Compression Should Preserve Task State, Not Just Recent Topics
In long tasks, context may need to be compressed. If a summary only preserves “currently investigating an environmental parameter” while losing the original goal and the reason for the investigation, the agent may press even more confidently in the wrong direction.
An effective task summary should retain at least:
- The original goal and acceptance criteria.
- Facts already confirmed.
- Hypotheses not yet confirmed.
- Methods already tried and their limitations.
- The current side branches’ relationship to the main goal.
- Remaining budget and stop conditions.
- Permission scope and prohibited operations.
- The most valuable next action.
It should also clearly separate “tool observations” from “model interpretations.” For example, “the measurement failed” is a fact, while “it may be subject to external interference” is a hypothesis. After compression, the two must not merge into a confirmed conclusion.
8. Building an Execution Flow Oriented Toward Task Closure
Developers can structure the agent workflow into the following stages:
1. Define the goal and acceptance criteria
Before acting, translate the natural-language requirement into a verifiable goal. For example, “fix the failure” needs to be clarified into: which function is restored, which behaviors are preserved, and how the fix is confirmed effective.
If the goal is vague, clarify it first; if the situation is urgent, identify safe containment actions first.
2. Build a bounded set of candidate hypotheses
Generate a small number of primary hypotheses from available evidence and assign each a discriminating check. Don’t enumerate every possible cause without bound.
Prefer checks that can rule out multiple hypotheses at once, cost little, and carry controllable risk.
3. Set budgets and course-correction conditions
Budgets cover not only time but also tool call counts, compute cost, the allowed scope of modifications, and conditions for human intervention.
When several consecutive actions produce no meaningful progress, trigger a review: is a hypothesis wrong, is a tool unsuitable, is the goal unclear, or is human help needed? When the budget is exhausted, report the known facts and blockers rather than extending the task indefinitely.
4. Execute, verify, and roll back
Record the necessary state before making changes and run verification mapped to acceptance criteria afterward. If verification fails, choose to roll back, revise the hypothesis, or stop based on risk—rather than treating “the change executed successfully” as “the problem is solved.”
5. Report results and residual risk
The final report should distinguish completed work, verification results, remaining uncertainty, and follow-up recommendations. If the fix was not completed, say so plainly—don’t use lengthy process narration to manufacture a sense of completion.
9. Evaluate Agents on Both Results and Process
A practical evaluation framework can cover six dimensions:
| Dimension | Key Question | Observable Signals |
|---|---|---|
| Goal retention | Does it keep acting around the user’s need | Are irrelevant side branches terminated promptly |
| Diagnostic quality | Does it form testable hypotheses | Can the checks distinguish candidate causes |
| Execution efficiency | Does it control investigation cost | Are useless retries and repeated checks reduced |
| Fix quality | Does it solve the problem without widening impact | Do acceptance checks pass, do regressions appear |
| Safety boundaries | Does it follow required authorization and least privilege | Are high-risk operations confirmed |
| Reporting credibility | Does it accurately separate facts from inference | Does it exaggerate progress or hide failures |
Avoid judging by a single success rate. An agent that completes the task but oversteps its permissions is not trustworthy; an agent that is always safe but never gets anything done is not useful either. Use a well-defined task set under identical constraints, and record outcomes, cost, risk, and human interventions together.
10. Conclusion: The Core of a Reliable Agent Is Constrained, Effective Action
What an agent truly needs to overcome is not “not explaining enough,” but “a lack of constraints between explanation and action.”
A high-quality system knows which evidence is sufficient to justify the next step, which tool failures are worth investigating, which side branches to terminate, which changes must be verified, and which permissions should not be requested.
The ultimate standard for evaluating an agent is not how much reasoning it displays, but whether—within reasonable cost and safety boundaries—it pushes the user’s problem to a verifiable, accountable result. Caution is the foundation; closure is the delivery.
