AI Agent Goal Drift and the Minimal Fix Principle

    As tool-using AI agents move into production, even a simple task can turn into a long detour. Using the metaphor of calling a plumber to fix a leak, this article reconstructs four typical failure modes in long-horizon agent tasks—goal drift, evidence misuse, budget overrun, and privilege escalation—and presents a set of constraints that can be implemented directly in engineering. It includes an evidence grading table, a hypothesis ledger, minimal-change and rollback practices, least-privilege access rules, and three acceptance metrics.

    When an AI agent with tool-calling capabilities enters production, a task that looks simple often turns into a long detour. This article uses a real-world scenario—calling a technician to fix a leaking pipe—as a metaphor to reconstruct four typical problems that agents run into during long-horizon tasks: goal drift, evidence misuse, budget overrun, and privilege escalation. It then lays out a set of constraints that can be implemented directly in engineering.

    1. Scenario Replay: How “Fixing a Pipe” Becomes a Marathon

    Imagine a pipe is leaking at home, and you call in a repair technician. Instead of looking at the pipe first, he starts with a round of “semantic clarification”: what “pipe,” “water,” and “leak” each refer to. Ten minutes later, he reports that an exhaustive search failed, switches to checking a specified location, and makes a point of stating that “failing to find something does not mean the house has no pipes.”

    Twenty minutes after that, he produces his first observation: humidity is elevated at a certain coordinate. Here he does one thing right—he defines the humidity anomaly as a “directional clue,” not “decisive evidence.”

    He then finds that there is indeed flow inside the pipe, so he prepares to measure flow rate, explicitly distinguishing “there is flowing water” from “there is a leak,” and refusing to infer pipe material directly from the flow. But the flow measurement fails. He speculates that an external magnetic field may be involved, while stressing that “magnetic interference is only a possible explanation”—he cannot infer that the flow meter itself is broken, and certainly cannot conclude that the geomagnetic field is abnormal.

    Next comes a chain of failures in the localization step. After one satellite positioning attempt fails, he correctly points out that this does not imply “I am not on Earth,” nor that other positioning systems are equally broken. He switches to another positioning system and obtains a set of latitude and longitude coordinates, but again refuses to equate the coordinates with “where I am,” and instead goes to observe the facilities outside the window. When he hears a regional dialect outside, he likewise refuses to draw a conclusion from it.

    At this point the context is compressed, yet he is still working on “geomagnetic field strength.” You cut in and ask whether the leaking pipe has been fixed. He apologizes and promises to converge: confirm the root cause, do a minimal fix, and stop measuring flow rate, stop localizing, and stop worrying about the magnetic field. Another thirty minutes pass, and he delivers the root cause—part of the factory water flow is overflowing outside the water supply system. He then tries to contact the water supplier, is rejected for “insufficient credentials,” so he asks you for credentials, and goes further to request “full access,” on the grounds that he will need to coordinate with the supplier’s staff.

    This whole process can serve as a textbook case of agent failure: every single step looks “cautious,” yet the overall task barely advances.

    2. Problem Abstraction: Four Systemic Defects

    2.1 Goal Drift and Constraint Expansion

    The task goal is “stop the leak,” but execution keeps spawning new subproblems: pipe material, flow rate, geomagnetism, positioning, dialect. Each subproblem may be legitimate on its own, but its relevance to the main goal is never quantified, so the task boundary keeps expanding. In engineering terms, every subproblem should be annotated with its “gain toward the main goal,” and anything below a threshold should be discarded outright.

    2.2 Missing Evidence Grading

    Elevated humidity, water flowing in the pipe, coordinates, and dialect are observations of completely different evidential strength, yet in the narrative they are flattened into equally important “findings.” Without evidence grading, the model is prone to keep spending budget on weak evidence.

    2.3 Missing Budget and Convergence Criteria

    Each stage consumes 10 to 30 minutes, total duration spirals out of control, and there are no hard constraints such as “maximum steps,” “maximum tool calls,” or “exit on no progress.” Without convergence criteria, an agent mistakes “continuous action” for “continuous progress.”

    2.4 Privilege Escalation and Credential Risk

    Requesting “full access” at the end is a textbook violation of least privilege. In real systems, such requests must be blocked: when external coordination is needed, the agent should go through a controlled authorization process rather than demanding full privileges or user credentials.

    3. Engineering Constraints: Turning Caution into Executable Rules

    3.1 Evidence Grading Table

    It is advisable to explicitly classify observations into four levels and require that reasoning only be used in the “strong to weak” direction:

    1. L1 Direct observation: leak point located, humidity and flow anomalous at the same time
    2. L2 Strong correlation : flow inside the pipe + water traces outside the system
    3. L3 Weak clue : elevated humidity at a single point, dialect outside the window, a single coordinate
    4. L4 Noise : failed measurements, rejected external requests
    5. Rule: L3/L4 cannot support a conclusion on their own; they can only be used to generate hypotheses to be verified

    3.2 Hypothesis Ledger

    Maintain a readable and writable ledger to avoid “thinking and forgetting at the same time,” and to make it easy to restore state after context compression:

    1. {
    2. "goal": "stop the leak",
    3. "hypotheses": [
    4. {"id": "H1", "claim": "pipe damage causes overflow", "evidence": ["L2"], "status": "confirmed"},
    5. {"id": "H2", "claim": "geomagnetic interference causes abnormal flow rate", "evidence": ["L4"], "status": "dropped"}
    6. ],
    7. "budget": {"max_steps": 12, "max_tool_calls": 8, "used": 9}
    8. }

    3.3 Minimal Fix

    Once the root cause is confirmed, change only what is necessary: replace the damaged pipe section and restore the seal, rather than re-piping the entire house. Mapped to a software system, this means a “minimal change set + rollback capability + post-change verification,” avoiding opportunistic refactoring that introduces new risk.

    3.4 Least Privilege

    External collaboration must be done through controlled interfaces and short-lived tokens; permissions should be requested on demand and revoked after use. Any request for “full access” should be denied by default and escalated to a human for confirmation. Credentials must never be written into logs or context.

    4. Implementation Recommendations

    When building this kind of system on platforms such as Baidu AI Cloud, you can combine general-purpose capabilities: use a container platform to host the agent runtime, use logging and monitoring/alerting to observe step counts, tool calls, and latency distribution, use a message queue to decouple long-running tasks, and use object storage to archive hypothesis ledgers and execution traces for retrospectives and evaluation.

    For acceptance, three metrics are worth tracking: main-goal achievement rate, average share of ineffective steps, and interception rate of privilege-escalating requests. Only by folding these three into regression testing can “caution” truly turn into “reliability.”