Intent-Aware Auditing Versus Log Aggregation for Agent Traces

Intent-aware auditing detects when agents succeed technically but violate their instructions.

· 8 min read
Cover illustration for “Intent-Aware Auditing Versus Log Aggregation for Agent Traces”
Agent Hallucination · October 22, 2026 · 8 min read · 1,851 words

Traditional error monitoring fails for AI agents because an agent can run successfully and still break its instructions. Log aggregation records what happened, but it does not establish whether the agent did what it was supposed to do. Intent-aware auditing closes that gap by capturing the instruction behind a run and evaluating the resulting trace against it.

What log aggregation was built for, and why that design does not transfer to agents

Log aggregation was designed around deterministic execution. A request arrives, a fixed code path runs, an event is emitted, and a status code reports the result. The log captures state transitions in a predictable execution graph. Within that model, missing or anomalous events signal problems, while expected events provide evidence of normal operation.

Agents decompose goals, select tools, assess intermediate results, and route themselves through workflows that were not settled at design time. The same input can therefore lead to a different sequence of tools from one run to the next. A successful status code can also accompany a semantically wrong result because the underlying system did not crash.

That distinction changes what a clean log can establish. It can show that a selected API call completed, but completion alone says nothing about whether selecting that API served the user’s goal. Aggregation leaves the gap between what happened and what was supposed to happen invisible by design.

Three structural gaps that make log aggregation blind to agentic failures

The first gap is the missing contextual chain between the original instruction and downstream execution. Standard logs record each event but do not always link each sub-task to the user intent that led to it. An agent that decomposes a goal into six sequential tool calls can produce six entries with no thread back to that goal. Those entries preserve the sequence of activity, but they do not establish that it was the right sequence.

The second gap is the absence of tool-use reasoning. A log records that an API was called while leaving the reasons for the agent’s choice of API and argument unrecorded. This matters when prompts, rather than formal schemas, define how tools should be used. Small changes in API responses can cause schema drift that makes later reasoning fail silently, with no explicit errors.

The third gap is identity dilution. When actions are logged under a generic service account, the log can hide whether they came from the agent’s own logic or a user override. Without that distinction, the record cannot attribute behavior to its cause. Together, these gaps let an aggregation pipeline report a clean run even when an agent promises a non-existent promotional rate, fabricates an identifier, or takes a destructive shortcut.

Why does an LLM agent look fine in logs but still give bad outputs to users

A run with behavioral failures can pass execution checks even when it breaks the rules of its task, policy, or authorization. The Microsoft AI Red Team’s June 2026 update expanded its taxonomy from 27 to 34 failure modes after a year of red-teaming live agentic systems. The update reflected mainstream adoption of open-source agentic frameworks, vulnerabilities accumulating in the MCP ecosystem, computer-use agents entering production, and patterns from real engagements. The Microsoft AI Red Team recorded 99 CVEs that were published for MCP-related software in 2025 alone.

A compromised MCP server or plugin can inject natural-language instructions that change behavior without modifying a binary or emitting an error. Goal Hijacking redirects the terminal goal through adversarial instructions that appear aligned with the legitimate task. MCP/Plugin Abuse uses poisoned tool descriptions or server-injected instructions to make normal-looking execution contradict the agent’s instructions. Session Context Contamination plants data early in a session that distorts later reasoning without independently triggering a safety check.

Other categories exploit trust, perception, or disclosure. Inter-Agent Trust Escalation involves a compromised agent claiming an identity or permissions that an orchestrator does not verify. Computer Use Agent Visual Attacks put instructions in what appears on screen, with no need for an anomalous API call. Capability/Architecture Disclosure exposes system prompts, tool schemas, or approval logic through what a log records simply as output. The original taxonomy’s memory poisoning, cross-domain prompt injection, and human-in-the-loop bypass can also occur without an error signal. Naming these failures is a starting point, but detecting them requires a record of intended behavior against which execution can be judged.

What real-world incidents look like when intent is not part of the record

The Air Canada case illustrates the cost of treating a completed conversation as a correct one. A conversational agent told a passenger that he could book a full-price ticket and apply for a bereavement discount retroactively. That guidance did not match Air Canada’s policy. The passenger followed it, was denied the refund, and took the airline to small claims court. The interaction completed, but its financial guidance was wrong.

The agent had broad conversational scope without guardrails around policy-sensitive financial commitments. There was also no human checkpoint before the agent offered refund guidance. The log recorded a completed conversation with no errors, so the execution record did not expose the policy deviation. Comparing the response with the policy intent would have supplied the missing test.

More conversation records would not, by themselves, supply the missing policy reference. The monitoring layer must compare what the agent was supposed to do with what it actually did at the time of execution.

What intent-aware auditing captures that log aggregation leaves out

Intent-aware auditing makes the agent’s instructions a first-class part of the trace. The initiating user intent is captured when the trace opens. Planner decisions then link that intent to the sub-tasks chosen to carry it out. Those decisions need their own spans, including rejected plans and the influence of retrieved information on decomposition.

Tool calls must carry the rationale that justified the selection, the arguments supplied, and the alternatives considered. In multi-agent workflows, routing must also show which sub-agent received a sub-task and under what authorization. The final output must remain linkable through those intermediate steps to the original instruction.

Tools like Lemma illustrate this approach by auditing agent traces directly against the agent’s own instructions. That comparison makes the chain from user intent to tool execution explicit in the monitoring layer instead of leaving it to reconstruction from disconnected entries. The distinction is not simply that the record contains more detail. Richer logging captures more events, while intent-aware tracing captures their causal and semantic relationship to the instruction. Without that link and an evaluation layer, a trace viewer can help debug one run at a time but cannot check for deviations across production traffic.

Why scoring traces against intent is what separates detection from observation

Capturing intent is necessary, but a stored reference does not detect a failure on its own. Traces must be evaluated against that reference automatically and at production scale. Liu et al.’s analysis of 40,000 controlled trials of LLM agent systems found that overall task success can look steady even as a specific failure mode gets worse. An aggregate result that looks acceptable can therefore hide the choice of a wrong tool, arguments that are invalid, and side effects that were not authorized. Completion is a lagging indicator and does not prove that a run was carried out correctly.

Scoring individual decisions makes those regressions distinguishable. A slight decline in aggregate success can look like noise, while a material decline in tool selection accuracy points to the decision that is deteriorating. That distinction is available only when tool selection is evaluated against the intended sequence. Repeated deviations can then be grouped into recurring failure patterns. Increases in planning-execution cycles or tool retries can also indicate a prompt regression or unexpected tool output before user-visible harm accumulates.

LLM-as-judge evaluation provides a practical mechanism for this scoring, but automated decisions require calibration. A judge must be tested against human-labeled traces and reach an agreement threshold before its scores are trusted for that purpose. Runtime tracing can then work with eval gates that block a regression from shipping or flag a live quality drop. Production incidents also become labeled regression examples, turning a named failure into a test against recurrence. This is the step from observability to reliability, because the system no longer merely records what happened but evaluates whether it was right.

Where intent-aware auditing fits in the developer workflow

Detection has limited value when its findings sit outside the workflow needed to resolve them. If developers must leave their working environment and reconstruct the context of each issue, friction slows the fix loop. Findings can become stale before they are addressed. Auditing output must carry enough context to support a correction within development and deployment workflows, where the developer is already working.

A three-tier regression dataset gives that workflow a practical baseline. Canary traces run on every pull request and use fast, narrow checks to test the behaviors where the stakes are highest. A broader regression suite runs nightly or on release to cover known failure patterns. A set built from incidents grows each time a new named failure occurs in production. The taxonomy thus becomes part of the test suite rather than a document consulted only after an incident.

Coding-agent and CI integration connect those tests and findings to the places where changes are made and released. Lemma puts this design into practice by grouping failures that keep happening into issues, sending alerts in Slack, and giving coding agents the context. Its role is to shorten the path from an identified deviation to a fix. After a fix is deployed, Lemma creates an online eval to detect a regression.

What teams actually need before shipping an agent into production

The production decision is not whether an agent needs monitoring, but whether its monitoring covers the failures that matter. The first requirement is intent captured at trace open, preserving the instruction rather than treating the first action as a substitute. The second is step-level tracing across the full reasoning chain. Every tool call, argument, and result needs to be connected in a hierarchical trace that can be replayed. Together, these requirements preserve both the reference for correct behavior and the evidence needed to assess it.

The third requirement is automated scoring of traces against intent at production volume. Checking a few chosen logs by hand cannot evaluate traces in that systematic way. The fourth is deviation grouping and alerting inside the development workflow, so recurring patterns can be addressed before they accumulate into user-visible harm. These requirements form a continuous loop from instruction to execution, assessment, and correction. Without that loop, a team leaves users to find failures that its own systems cannot spot.

The Microsoft AI Red Team’s taxonomy makes the failure landscape concrete enough to design against. A monitoring architecture can therefore be judged by whether it detects those behavioral deviations or only reports what a status code can express. Log aggregation remains a record of execution, but that record is not a test of adherence to instructions. Closing the gap between what an agent did and what it was supposed to do requires a different architecture.

Sources

  1. Updating the taxonomy of failure modes in agentic AI systems: What a year of red teaming taught us
  2. Silent Failure in LLM Agent Systems: The Entropy Principle and the Inevitable Disorder of Autonomous Agents
  3. New whitepaper outlines the taxonomy of failure modes in AI agents

More in Agent Hallucination