A long-running agent started with a goal to refactor authentication code. After 50 tool calls, it is now modifying database schema files unrelated to authentication. What is this phenomenon called, and what is the best way to detect it?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Ever get so deep into organizing your closet that you find yourself cleaning the garage? That's context drift — when a long-running task gradually pulls you away from the original goal. Agents do this too, and you catch it by periodically checking: 'Are my current actions still aligned with my original objective?'
Full explanation below image
Full Explanation
Context drift occurs in long-running agentic tasks when the agent's actions gradually diverge from the original goal. This happens because the agent's context accumulates intermediate outputs, tool results, and reasoning steps that can crowd out or override the original objective.
Why B is correct: The correct detection method is periodic goal alignment checks — the agent (or a monitoring system) periodically compares the current action being taken against the original stated goal. If the actions have diverged significantly, a flag is raised for human review or the agent is reset to its original objective.
Why A is wrong: Counting tool calls detects volume, not drift. An agent making appropriate tool calls can be well-aligned with its goal regardless of call count. Tool misuse is a different problem.
Why C is wrong: Context window size growing is a symptom of long execution, not of drift specifically. Memory overflow is a resource management concern, not the phenomenon described.
Why D is wrong: A maximum execution time limit detects when an agent has been running too long — it does not detect whether the agent is working on the right thing. An agent that has drifted off-goal would be terminated at the time limit regardless of whether it was doing useful work.