A long-running agent is tasked with 'migrate the authentication service to use OAuth 2.0.' After 2 hours and dozens of tool calls, an engineer reviews the agent's current actions and notices it is now modifying the payment processing module's session management code — a task that was never part of the original assignment. The agent's reasoning still references 'authentication improvements' but the actual changes have drifted significantly from the original scope. Which mechanism would BEST detect and correct this context drift?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Context drift is the agentic equivalent of mission creep — you send a team to renovate the kitchen and come back to find they've also redone the bathroom. Periodic intent alignment checks are the project manager who walks through every hour asking 'does this still match the scope of work?' They don't just watch what's happening; they compare it against the original contract.
Full explanation below image
Full Explanation
Context drift occurs when an agent's accumulated intermediate context — tool call results, discovered facts, inferred sub-goals — gradually displaces the original task objective from its effective working context. This is particularly dangerous in long-running agents because:
1. Scope expansion: Each discovered 'related issue' can trigger sub-tasks that seem locally reasonable but collectively produce global scope creep 2. Reference drift: The agent's references to 'the task' increasingly refer to its most recent sub-task rather than the original objective 3. Silent failure mode: The agent appears to be working productively, producing plausible-sounding rationale, while actually executing out-of-scope work
A periodic intent alignment check addresses this by: 1. At regular intervals (e.g., every 20 steps or every 30 minutes), generating a brief summary of what the agent has done in the current period 2. Comparing that summary to the original task specification using a structured similarity evaluation 3. Computing a drift score: If the current actions are more than X% semantically distant from the original task, halt and surface the discrepancy for human review 4. Logging the check: Each alignment check and its result is logged as a durable artifact
Option A (max tool calls) is a blunt instrument that stops the agent but does not distinguish between productive and drifted work. A complex migration legitimately requires many tool calls. Option C (re-reading specification every tool call) addresses in-context anchoring but is computationally expensive and addresses only in-context drift, not the semantic divergence in actual actions. Option D (directory-scoped monitoring agent) is a specific implementation of a guardrail but is brittle — it fails for any legitimate cross-service dependency in the authentication work, and it does not detect drift within the allowed directory. Intent alignment checks are more semantically robust than file-path-based rules.