Why AI Agents Fail to Converge on Diagnostic Tasks—and How to Fix It

    This article examines why tool-using AI agents often fail to converge on open-ended diagnostic tasks, using a "fix the leak" scenario to illustrate goal drift, task tree explosion, missing evidence grading, and over-broad permission requests. It then presents five engineering constraints—goal anchoring with testable acceptance criteria, evidence grading with confidence accumulation, failure classification, minimal and rollback-safe fixes, and action-level authorization—plus observability and review practices to keep agents on track.

    1. A “Find the Leak” Scenario: How Agents Typically Go Off Track

    Consider a scenario that comes up repeatedly: a user hands an agent with tool-calling capabilities the instruction “There’s a leak at home—fix it.” Instead of acting directly, the agent starts with semantic clarification—what counts as a “home system,” what qualifies as a “pipe,” and what threshold defines a “leak.” That step is reasonable on its own. The problem is what follows.

    It first runs an exhaustive search. When that fails, instead of recording “search failed” as an unknown, it prepares to switch to targeted probing. It then detects elevated humidity at a certain coordinate and immediately constrains itself: “This is only a directional clue, not decisive evidence.” Next it confirms flow inside the pipe and goes on to measure flow rate. When the measurement fails, it attributes the cause to a possible external magnetic field. To rule out magnetic interference, it checks the geographic location; when positioning fails, it switches to a different satellite navigation system and obtains a latitude and longitude—but refuses to treat that as the real location and instead observes the facilities outside the window. Hearing an accent outside, it declares that the accent can neither prove the location nor infer the speaker’s origin, and certainly cannot be used to judge geomagnetic intensity. After the context is compressed, it is still “continuing to work on the geomagnetic field intensity problem.” Only when the user interjects “Is the leak fixed yet?” does it return to the main thread, provide a root cause, make a minimal change, and then get stuck at “the water supplier refuses to shut off the supply, insufficient credentials.” It then requests full access from the system, on the grounds that it “needs to coordinate with the other party’s personnel.”

    This flow packs in nearly every pitfall agents most easily fall into in engineering practice: the goal is continually refined into subproblems, and subproblems spawn further subproblems; every intermediate conclusion is over-cautiously downgraded to “non-decisive,” so the evidence chain never closes; the tool-call budget is consumed by irrelevant branches; and finally, at the permission layer, it makes a one-time request for the broadest possible authorization.

    2. Abstracting Three Core Risks

    2.1 Goal Drift and Task Tree Explosion

    The original request was “fix the leak,” but execution evolved into an exploration tree rooted at “geomagnetic intensity.” The technical cause is that the agent treats “reducing uncertainty” as the goal itself, rather than treating “restoring the system to a working state” as the goal. Uncertainty management is a means, not an endpoint. When the solution to a subproblem does not feed into the decision conditions of the main path, it should be pruned.

    2.2 Missing Evidence Grading Leads to Reasoning Stalls

    “Elevated humidity does not prove a leak,” “flow does not mean a leak,” “successful positioning does not mean being there”—these judgments are all methodologically correct. The problem is the absence of a mechanism to combine weak evidence into a strong conclusion. Real diagnosis never relies on a single decisive piece of evidence; it relies on the cross-convergence of multiple independent weak signals. If every clue is rejected on its own, the system stays forever in a “worth chasing” state.

    2.3 The Tendency to Overreach on Permissions and Credentials

    When blocked by an external dependency, the agent tends to request the broadest possible access or to push forward by bypassing the process. This is behavior that must be prohibited by hard constraints: credentials may only be provided explicitly by the user, permission requests must follow the principle of least necessity, and they must be bound to a specific action rather than to “the entire task.”

    3. Engineering Solutions

    3.1 Goal Anchoring: Express Acceptance Criteria as Decidable Expressions

    Define “done” clearly at task initialization, and map every action to an acceptance criterion.

    1. goal: restore_service
    2. acceptance:
    3. - id: leak_stopped
    4. check: flow_outside_pipe == 0 for 30min
    5. - id: no_collateral
    6. check: pressure_within_range and water_quality_ok
    7. budget:
    8. max_tool_calls: 40
    9. max_branch_depth: 3
    10. prune_rule: prune a subproblem if it does not change the value of any acceptance criterion

    With prune_rule, a branch like “geomagnetic intensity” is cut at the first level, because it does not affect the evaluation of leak_stopped.

    3.2 Evidence Grading and Confidence Accumulation

    Classify observations into three levels: environmental (humidity, temperature, noise), system (flow inside the pipe, pressure), and root cause (pipe body damage point, joint failure). Allow weak evidence to raise confidence cumulatively, but require at least two mutually independent pieces of evidence at the same level before allowing an upgrade to an “actionable conclusion.”

    1. def update(evidence, level, prior):
    2. w = {"env": 0.2, "sys": 0.5, "root": 0.9}[level]
    3. post = prior * (1 + w) / (1 + w * prior)
    4. return post if post >= 0.85 else prior # below threshold does not enter the decision

    The key constraint is that a conclusion below the threshold can only be used to “rank the next probing location.” It cannot be used to “declare a root cause,” nor to “trigger an irreversible operation.”

    3.3 Failure Classification: Distinguish Unknown, Negative, and Tool Errors

    The biggest waste in the original case is conflating three kinds of failure. In engineering, they should be modeled explicitly:

    • Unknown: no observation; retain the prior.
    • Negative: the observation is valid and the target was not found; can be used for pruning.
    • Invalid: a tool or environment error; the observation does not enter the evidence pool and only triggers a retry or a change of approach.

    “An exhaustive search failed” is invalid, and can never lead to “no pipe exists.” “Flow measurement failed” is likewise invalid and cannot lead to a flow rate of zero.

    3.4 Minimal, Rollback-Safe Fixes

    Once the root cause is confirmed, the change surface must be minimal and rollback-safe: first isolate the faulty segment, then replace or seal it, and finally run a regression check against the acceptance criteria. Refactoring unrelated parts opportunistically is prohibited, and irreversible actions are prohibited before verification. A representative flow:

    1. locate root cause -> isolate impact scope -> generate change list (with rollback steps) -> execute -> regression acceptance -> archive evidence

    3.5 Human Collaboration and Least-Privilege Permissions

    Break permissions into action-level grants rather than a one-time grant of full access:

    1. {"action": "contact_external_party", "scope": "read_work_order", "ttl": "15m", "require_user_credential": true}

    When an external dependency is blocked, the correct approach is to tell the user what credential is missing, why it is needed, and at which step it will stop being used—not to try to bypass the process. This is both a compliance requirement and the basis for auditability.

    4. Observability and Retrospectives

    Write the input summary of every tool call, its return status (valid/invalid), its increment to confidence, and the budget consumed into a unified logging service. Combined with monitoring and alerting, set up three dashboard metrics: “branch depth,” “invalid call ratio,” and “single-task duration.” In retrospectives, look at only two things: whether the proportion of pruned branches is too low (indicating the pruning rules are too loose), and whether acceptance criteria are satisfied only at the final stage (indicating the early probing order is unreasonable). When running in a container platform or function-computing environment, also set a per-task timeout and call limit to avoid open-ended exploration occupying resources continuously.

    5. Conclusion

    The capability ceiling of open-ended diagnostic tasks does not depend on how many tools an agent can call, but on whether it can hold the goal boundary, organize weak evidence into actionable conclusions, and request human intervention with least privilege when blocked. Making acceptance criteria, evidence grading, failure classification, minimal fixes, and action-level authorization into default constraints is what allows an agent to move from “always investigating” to “actually fixing it.”