Reading Intent-Execution Drift From Span Attributes Before the Incident Report Lands
Span attributes can expose agents that drift from instructions.

Intent-aware auditing for AI agents compares the original instructions and declared plan with the actions recorded across a trace. Span attributes hold the evidence, but finding intent-execution drift takes cross-span comparison, semantic evaluation, and grouping across runs. The purpose is to identify a wrong outcome while the workflow still looks technically healthy, before a user complaint becomes the first signal.
Why span-level traces stay green while agents fail
Every span is green, the dashboard is healthy, and the agent reports success. The needed file was never retrieved. An agent can run eighteen steps and call the same search tool six times with slightly different arguments without finishing its task. HTTP-layer monitoring measures successful responses and acceptable latency, leaving progress on the user’s request unassessed. A wrong tool or stale identifier can pass through that monitoring without triggering an alert.
The mismatch begins in the agent’s control flow. Yu et al.’s paper accepted for ICAD 2026 describes control flow generated sequentially inside a context window without explicit state representation. The authors attribute two failure modes to the separation of reasoning context from execution state. Safety Drift erodes declared safety intent across turns until actions violate constraints, while Operational Hallucination produces repetitive tool calls that reflect flawed state perception. Both create a declaration-action gap, so detecting them requires comparing what the agent intended with what it executed.
What span attributes actually record about intent and execution
OpenTelemetry’s GenAI semantic conventions provide a shared vocabulary for model calls, agent workflows, and tool execution. The agent operation types include create_agent, invoke_agent, invoke_workflow, plan, and execute_tool. Each distinguishes a different part of the run. In a well-instrumented trace, the original prompt shows the task intent, while captured intermediate thought text and decision branches show how the agent said it understood that intent. Tool names, arguments, and results then show how that interpretation became action.
LLM call spans record input and output token counts, model ID, temperature, and finish reason, while captured prompt content supports a closer comparison with tool results. Tool invocation spans record the tool name, input arguments, output payload, and duration. Arguments expose the identifiers passed downstream. Memory read and write records add keys, retrieved values, and cache outcomes, while handoff records add source and target agent IDs, context payload size, and transfer latency.
MCP tracing extends this evidence into the tool layer. OpenTelemetry v1.39 added MCP semantic conventions for its CLIENT and SERVER spans, including an operation such as tools/call get-weather with gen_ai.operation.name=execute_tool. Those spans are separate from an outer agent tool span. The conventions make the layers comparable without requiring duplicate instrumentation of the same MCP operation. Business attributes such as user_id, session_id, and workflow_id then connect these execution details to the workflows whose failures need to be grouped.
The span patterns that signal intent-execution drift before it reaches a user
Pattern 1 (Declaration-action gap). Check the planned action in a reasoning chain span against the tool name and arguments in the following execute_tool span. If the reasoning names tool A and execution calls tool B, the discrepancy is explicit. Safety Drift becomes visible when a refusal or stated constraint precedes a contradictory action. A policy.deny span recording “intent drift tool not in plan (export_records)” confirms the mismatch after the fact. To detect it earlier, the comparison must happen before the action completes.
Pattern 2 (Operational Hallucination). Check successive execute_tool spans against the goal recorded in the first invoke_agent span, looking for the same tool, slightly varied arguments, and no downstream state change. Exact-repeat detection is not enough for this pattern. Token totals can keep growing while every call succeeds, so the run can look like exploratory work when seen only through throughput. Yu et al. describe this livelock across multiple state-of-the-art LLMs.
Pattern 3 (Tool output ignored downstream). Check the output payload of an execute_tool span against the captured input content and input token count of the next LLM call span. A result that does not appear in the next reasoning context signals a broken connection between retrieval and use. Token counts provide tentative clues to incorporation. Content comparison establishes whether the result was available to the next call. A related failure occurs when a search returns an empty result or stale value with a successful HTTP status, leaving later reasoning dependent on unsuitable inputs despite healthy transport.
Pattern 4 (Context loss at handoff). Check the context payload recorded at handoff against the original invoke_workflow goal and the receiving invoke_agent child’s context. A payload size that shrinks unexpectedly is a warning. The semantic check assesses whether the child retained the task state needed to follow the original instructions. A structurally valid downstream action can still be misaligned when the receiving agent operates on a fragment of that state. Payload size identifies a place to investigate, while the content comparison establishes what was lost.
Pattern 5 (Finish reason mismatch). Check the finish reason of the final model-call span against the completion that the original prompt span called for. A finish reason of length or tool_calls where stop was expected indicates truncation or continuing tool work. The trace can close before the task is done. This comparison separates the end of recorded execution from the fulfillment of the request. It also keeps a mechanically successful final call from serving as the only evidence of task success.
Why these patterns are invisible to teams who can only see individual spans
A complete trace is necessary but not sufficient. Parent and child links show which plan, action, and result belong together, but cannot tell whether they are consistent. Two tool names can be compared with a string match, while judging whether an action followed an instruction takes semantic judgment. Aggregation adds another dimension by showing whether a mismatch recurs within the same workflow. Yu et al. propose an Action-Aware Supervision Layer with intent-action consistency checks and runtime state tracking because this logic must work above individual spans.
Sampling agent traces drops entire execution trajectories, so a failure confined to a minority of runs can disappear from the reviewed data. That limits what a healthy dashboard can establish. The relevant capability is whether it can relate instructions to actions across the hierarchy, evaluate their consistency, and group the resulting failures across runs.
How to instrument agents so the drift-relevant attributes are present and comparable
To make those comparisons possible, teams should emit consistent semantic attributes across the stack and attach at least one business-level attribute to every span. workflow_id, session_id, or user_id provides the grouping key. Agent traces should be captured at full rate so that whole execution trajectories can be reviewed. Consistency also requires recognizing that different instrumentation packages emit different vocabularies. An attribute that exists under one convention cannot simply be assumed to exist under another name.
For LangGraph and LangChain, OpenInference instrumentation hooks into execution at the node level, with LLM calls represented as child spans. Its LLM attributes use llm.*, and tool spans are identified by openinference.span.kind = TOOL. These are not automatically OTel GenAI attributes. For the OpenAI Agents SDK, openinference-instrumentation-openai-agents provides AGENT, TOOL, and LLM spans through one line of instrumentation. The separate opentelemetry-instrumentation-openai-agents package uses the OTel GenAI convention names, a distinction that affects cross-framework queries.
At the MCP layer, the relevant fields include mcp.method.name, mcp.session.id, and mcp.protocol.version. They describe the protocol operation on the tool-layer spans without requiring duplicate spans for the same operation. Version awareness is essential here. As of v1.41, every gen_ai.* attribute has a Development stability badge, so names can change without a major version bump. Teams should instrument against a specified convention version and plan for renames.
Instrumentation coverage also depends on who controls the component. MLflow recommends SDK instrumentation for owned agents and eBPF-based monitoring for third-party components that cannot be instrumented directly. The latter captures structural data without changes to the code. It provides less semantic context than SDK instrumentation, so it cannot supply the same evidence for every intent-action comparison.
Reading drift signals in production: from raw spans to grouped failure patterns
Deterministic checks can run across all traffic, comparing tool names with plans, checking finish reasons, and validating argument schemas. Semantic evaluation can then use LLM-as-judge scoring on a sampled slice to check whether actions stayed consistent with stated intent. These checks answer different questions about the same run. Continuous grouping then clusters flagged traces by failure type and workflow segment, turning isolated signals into recurring issues.
Tool calls per request rising above a defined limit can expose livelock before the run consumes more tokens or leaves the user waiting. Falling argument-schema compliance exposes malformed calls, although schema validity alone does not establish that an identifier is current or real. A decline can reveal off-task behavior or lost handoff context even when individual tools remain healthy.
A Slack alert with the specific spans, grouped issue, and failure type provides a more direct path to diagnosis than a generic incident entry. Splunk Agent Observability brings quality and security signals together with latency and errors to help show what caused a failure beyond its symptoms. A drift monitoring program should track silent failure rate as its main metric, which counts runs that succeed technically but get the task outcome wrong. Task success rate, tool failure rate, and human correction rate provide the surrounding view.
Closing the loop: from a detected drift pattern to a verified fix
The grouped issue should keep the reasoning span, divergent tool call, argument payload, and finish reason needed to find the cause. The trace supplies engineers with the sequence they would otherwise reconstruct from logs. The repair may be a prompt change, a tool schema correction, or an architectural intent-action consistency check. For prompt changes, an MCP server can pass the trace context and proposed fix to Claude Code, Cursor, or a similar coding agent so that the repair and PR begin inside the existing development workflow.
The production failure traces should become new evals that test the changed behavior instead of staying attached to a closed issue as examples. Automatic generation of evals from those traces can be faster and more faithful than hand-writing assertions after each discovery. A prompt change is a software change. A response that seems better in isolation is not evidence that the workflow still satisfies its instructions under the conditions that previously caused drift.
A fix that has not been tested against the triggering failure can recur under the same conditions until another complaint exposes it. With the loop connected, the grouped issue, diagnosed pattern, proposed repair, and running evals are already available when an incident report arrives.


