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
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. You catch it by periodically checking whether your current actions still align with your original objective.
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.
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.
The tool-call-counting approach is wrong because 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.
The context-window-size monitoring approach is wrong because 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.
The maximum-execution-time-limit approach is wrong because 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.