Evaluating Tool-Using Agents for Fault Diagnosis: Failure Modes and Engineering Practices

    This article analyzes a pipe leak troubleshooting case to examine the strengths and weaknesses of tool-using diagnostic agents. It identifies key failure modes such as goal drift, runaway tool calls, and loss of task state after context compression, and proposes a five-dimension evaluation framework along with practical engineering solutions including evidence ledgers, call budgets, task state machines, structured compression summaries, and auditable permission management. Readers will gain a concrete methodology for assessing and building more reliable agentic troubleshooting systems.

    Evaluating Tool-Using Agents for Fault Diagnosis: Failure Modes and Engineering Practices

    1. Case Study: What a “Pipe Leak Investigation” Reveals

    The original scenario can be abstracted as follows: a user asks an agent to investigate a pipe leak. The diagnostic agent, equipped with tool-calling capabilities, performs a full inspection, point detection, flow-rate measurement, equipment localization, and environmental audio sensing, while repeatedly stating that “weak evidence cannot be treated as decisive evidence” and that “this does not allow us to infer the material or root cause.” After its context is compressed, the agent continues processing interference factors for a while. Only when the user interjects—“Is the leak fixed yet?”—does it return to the main task, propose a minimal fix, and request full access permissions in order to coordinate with an external organization.

    This case cannot simply be judged as “good” or “bad.” It demonstrates both sides of tool-using agents: on one hand, it shows evidence-graded reasoning that avoids mistaking correlation for causation and emphasizes minimal fixes; on the other hand, it exhibits goal drift, runaway tool-call budgets, loss of task state after context compression, and delayed permission requests. Therefore, such agents should be evaluated using a multi-dimensional framework rather than only whether the issue was ultimately fixed.

    Five recommended dimensions for evaluation:

    1. Task effectiveness: Does the agent solve the user’s original problem, and is the fix minimal and verifiable?
    2. Evidence rigor: Does it distinguish observations from hypotheses, evidence, and conclusions, and does it attach confidence levels?
    3. Task persistence: After long workflows, context compression, or tool failures, does it keep advancing toward the main goal?
    4. Tool and permission security: Are tool calls constrained by budgets, and are permissions minimal, auditable, and revocable?
    5. Human-agent collaboration efficiency: When should the agent ask the user for confirmation, when should it proactively report, and when should it stop unproductive exploration?

    2. Notable Strengths: Evidence Grading and Minimal-Fix Mindset

    Throughout the case, the agent repeatedly used statements such as “this only indicates the direction is worth pursuing, not that the root cause is confirmed,” “the presence of running water does not mean there is a leak,” and “localization results cannot be taken directly as the on-site location.” This reflects good evidence-grading awareness. In complex fault diagnosis, the most common mistake is upgrading a single observation directly into a conclusion—for example, seeing elevated humidity and concluding there is a leak, or seeing abnormal flow and concluding a pipe rupture. Clearly separating observations from conclusions reduces the risk of misdiagnosis and unnecessary repairs.

    The agent also proposed “making a minimal change rather than only fixing the surface, to avoid continued leaking.” This aligns with fundamental incident-repair principles: first locate the root cause, then restore service with the smallest possible change while preserving rollback and verification paths. For production systems, a minimal fix is safer than a large-scale refactor, which can introduce new uncertainties.

    Additionally, the agent requested permissions to coordinate with an external organization rather than attempting to bypass the process. This is commendable. Tool-using agents should respect clear boundaries: information obtainable through read-only tools should not require write access, and cross-organization coordination should request explicit authorization and record audit logs.

    3. Primary Failure Modes: Goal Drift, Ineffective Loops, and Lost State

    The most prominent problem in the case is goal drift. The user’s goal was “fix the leak,” but the agent pivoted to magnetic-field interference after flow measurement failed, switched to multiple localization systems after localization failed, and then chased environmental audio clues after obtaining coordinates. Each step had a plausible rationale, yet the overall trajectory departed from the main line of “repair the leak.” The root cause is not a single incorrect inference but the absence of global task-state management.

    A simplified task state machine describes the desired behavior:

    1. State: INIT -> LOCALIZE -> CONFIRM_ROOT_CAUSE -> MINIMAL_FIX -> VERIFY -> DONE
    2. Constraints:
    3. - Every state must have explicit exit conditions
    4. - A tool failure must not automatically turn into unlimited exploration
    5. - N consecutive tool calls yielding no new evidence trigger escalation or asking the user
    6. - After context compression, these must be preserved: user goal, confirmed facts, open questions, current hypothesis, prohibited actions

    In the case, the agent repeatedly measured and localized during the “confirm root cause” phase without maintaining a ledger of “confirmed facts” and “open questions.” As a result, after context compression it resumed processing interference factors. Another issue is the runaway tool-call budget: the agent worked in stretches of 10–30 minutes, and after failures kept trying similar tools without limits on call count, time, or cost. Engineering-wise, a tool-call budget should be enforced—for example, allow only a limited number of read-only probes per hypothesis, after which the agent must summarize the evidence and ask the user for a decision.

    4. Context Compression: “Task Anchors” Must Be Preserved

    Long-running agents commonly use context compression to control the window size. Compression itself is not the problem; the problem is a compression strategy that keeps only recent conversation turns and discards task anchors. In the case, after “context compressed,” the agent continued handling interference factors, indicating the summary did not include the user’s original goal, the current phase, excluded hypotheses, or stopping conditions.

    A structured compression summary template is recommended:

    1. [User goal] Fix the pipe leak and verify it no longer leaks
    2. [Current phase] Root-cause confirmation
    3. [Confirmed facts] Point detection showed elevated humidity; running water exists in the corresponding pipe section
    4. [Open questions] Whether the running water is caused by a leak; whether the external water supplier needs to be involved
    5. [Excluded/downgraded] Environmental audio cannot serve as evidence of location or root cause
    6. [Prohibited actions] Do not treat localization results directly as root cause; do not measure flow rate indefinitely
    7. [Next step] Request user credentials and contact the water supplier; execute the minimal fix

    Only by preserving these anchors will the post-compression agent avoid mistaking “interference-factor investigation” for the main task.

    5. Permission Requests and External Dependencies: Minimal, Phased, and Auditable

    Late in the case, the agent requested “full access” to interface with an external organization. The request itself is reasonable, but “full access” should be treated with caution. A safer approach is phased permission requests: first request read-only access to view tickets and credentials, then request restricted communication permissions, and only then request write operations within a clearly defined scope. Every grant should carry a purpose, scope, expiration, and audit record. The agent must never attempt to bypass operators or use unauthorized credentials.

    In general cloud environments such as Baidu AI Cloud, logging services, monitoring and alerting, and audit logs can serve as data sources and audit carriers for tool calls. The key, however, is not the specific product but a unified evidence model and clear permission boundaries. When an external dependency is blocked, the agent should proactively report the blocking point, the required credentials, and available options, instead of continuing internal unproductive exploration.

    6. Evaluation Metrics and Implementation Recommendations

    Recommended metrics for tool-using troubleshooting agents include: root-cause hit rate, minimal-fix ratio, average number of tool calls, ineffective-call ratio, goal-drift rate, task-persistence rate after context compression, permission-request compliance rate, number of user corrections via interruption, and end-to-end recovery time.

    For implementation, combine an evidence ledger + call budget + state machine + audit log:

    • The evidence ledger records observations, hypotheses, confidence levels, and conclusions.
    • The call budget limits exploration depth.
    • The state machine ensures forward progress through defined phases.
    • The audit log guarantees traceability.

    The ultimate goal is an agent that both rigorously distinguishes evidence levels and maintains task anchors through complex workflows—achieving auditability, stoppability, and effective human-agent collaboration.