Est.

Reading Agent Traces Without an LLM Judge

Deterministic checks on agent traces catch silent failures that no LLM judge can spot.

· 10 min read
Cover illustration for “Reading Agent Traces Without an LLM Judge”
LLM-as-Judge Design · October 16, 2026 · 10 min read · 2,197 words

The question isn't whether an agent will fail. It's whether anyone will notice. Most of the time, agentic systems fail silently: they give a plausible-sounding but factually wrong, policy-violating, or operationally broken answer with complete confidence. The trace, the structured record of every model invocation, tool call, memory operation, and decision branch, is the only artifact that captures what actually happened independent of what the agent reported to the user. Reading those traces with deterministic, rule-based checks catches meaningful misbehavior without requiring an LLM judge.

Why traces are the only honest record of what an agent actually did

An agent's summary of its own work is a performance, not a record. The agent can claim it checked a balance, verified a policy, or retrieved a source, and the claim may be entirely disconnected from what the trace shows. The dangerous failure class in agentic systems is not a crash or an exception. It's a confident, well-formatted response that is wrong in ways no uptime metric will ever surface.

Standard infrastructure monitoring was built for a world where failure announces itself. Uptime, error rate, and latency all measure systems that break loudly. An agent that hallucinates a tool name and proceeds as if the call succeeded produces no error, no crash, and no latency spike. The trace is the agent's internal trajectory made visible. Every model invocation, tool call, memory read and write, and decision branch is recorded as a structured, inspectable artifact. That artifact is what distinguishes an honest account of the agent's behavior from the agent's own account of its behavior. Production monitoring systems like Lemma treat the trace as the primary audit surface, checking every step against the agent's own instructions to catch the silent failures that standard error monitors cannot surface.

What a trace actually contains and how its layers map to failure surfaces

A trace is not a flat log. It is a span tree, and each layer exposes a distinct class of agent behavior and, correspondingly, a distinct class of detectable failure. The execution units in a structured trace include reasoning steps, which capture the agent's internal chain of thought or plan. Tool invocations, recording the tool name, arguments, and return value. Retrieval calls, showing what was queried, what chunks were returned, and what context was injected. Memory operations, logging reads and writes to persistent or session memory. Environment actions, recording side effects taken in external systems. Inter-agent messages, capturing delegation calls and orchestrator-to-subagent instructions. And final outputs, which show what was actually returned to the user or downstream system.

Each layer has a distinct failure signature. A check that works on a tool call does not apply to a retrieval result, and vice versa. Execution graphs go further than flat logs by representing instructions, retrievals, tool calls, memory operations, observations, claims, and actions as nodes connected through typed dependency relations. That makes dependencies between steps explicit and localizable, which is what turns a trace from a historical record into a diagnostic instrument.

The five failure categories and the trace fingerprint each one leaves

Failure categories are not just academic labels. They are lookup keys for knowing where in the trace to look. Planning errors leave a distinctive fingerprint: the plan span's emitted tool sequence does not match the executed tool sequence, or the same tool fires repeatedly with similar arguments and no goal progress, or the agent returns to the user before the plan span closes. The plan-versus-execute divergence is the canonical fingerprint of indirect prompt injection at the plan layer. The planner decided one sequence. The executor ran another.

Tool errors are the most straightforward to spot. A tool invocation with an argument shape that fails the tool's schema, a tool name that does not appear in the runtime catalog, or a non-2xx return followed by a confident downstream response that ignores the failure all point to tool-layer problems. Tool correctness is fully deterministic. Verifying that all required tools were called, with correct arguments, and that error returns were handled requires no model judgment whatsoever. Retrieval errors show up as a chunk injected into context that does not match the query embedding, a retrieval call that returns zero results followed by a confident grounded claim, or a role-switch token present in a retrieved chunk. Reasoning errors leave their mark as a claim in the output span that contradicts a value returned in an earlier tool or retrieval span, a math result in the output that does not match the arithmetic in the trace, or an instruction in the system prompt that is unambiguously not followed.

Safety and policy violations appear as an output span containing a banned phrase, a PII pattern, or a tool call to a non-approved tool. They also appear as a missing required tool call, such as a policy check that was required before a consequential action. Once a team knows what each failure category looks like in a trace, it can build a lookup table of deterministic checks. That is the same approach production monitoring systems like Lemma use to automatically group trace deviations into actionable issues without requiring upfront definition of every possible failure mode.

Deterministic checks that work on the tool-call layer

The tool-call layer is the richest surface for deterministic checking because every element of a tool invocation is structured data. The name, arguments, return value, and status code are all machine-readable fields that require no model judgment to validate. A senior engineer building a trace-checking harness would start with five checks on this layer.

Tool name membership is a set lookup. If the invoked tool name is not present in the agent's declared tool catalog, the trace shows a tool hallucination. Return status handling is a sequencing check: if the tool returned a non-success status, does the next span in the trace branch to an error path, or does it proceed as if the call succeeded? A trace where a failed tool call is followed by a confident downstream output is a detectable no-error-handling failure.

Required tool coverage is a set difference. For agents with a defined task, the trace should contain all the tool calls that task requires. A missing policy check, balance lookup, or authentication step is a missing-step planning failure. Repetition detection is a cycle detector: if the same tool fires more than N times with near-identical arguments and no state change between calls, a simple counter with a threshold flags it.

MCP tool descriptions complicate this picture. The Microsoft AI Red Team's updated taxonomy explicitly names MCP/Plugin Abuse as a failure mode: poisoned tool descriptions, instructions injected by a server, and one server overriding another. All of these produce traces that pass a syntactic check but fail a semantic one.

Structural checks across the plan, retrieval, and memory layers

The same principle of comparing structure against expectation extends beyond the tool layer. Plan-versus-execute divergence is a direct comparison: if the trace records both a planned tool sequence and the executed sequence, any difference between them is detectable, regardless of whether the executed sequence was better or worse. Retrieval spans offer several structural signals. An empty retrieval followed by a grounded claim is detectable by checking the retrieval result count against the presence of grounded-claim markers in the next output span. Source citation without a matching retrieval call is a set difference between cited sources and retrieved sources. If the output cites a source that never appears in the retrieval log, the citation is hallucinated.

The memory layer deserves structural auditing because of how quickly poisoning compounds. The Microsoft AI Red Team found that memory poisoning required only a single successful injection, after which the agent propagated the bad instruction across subsequent sessions on its own. Trace-auditing platforms like Lemma isolate failures that would otherwise hide in plain sight by structuring their checks around these layer boundaries.

Output-layer checks that need no model judgment

The output span is the most user-visible layer, and several of its most consequential failure signals are readable through pattern matching, schema validation, and cross-span consistency checks without asking another model to evaluate the response. Format and schema validation is the first check: if the agent is expected to return structured output, validate it against the declared schema. A response that does not conform is a detectable failure regardless of whether its content is correct. Length constraints, required field presence, and banned field values are all binary checks.

Banned phrase and PII detection runs in milliseconds. A string match against a list of banned phrases, PII patterns like regex for SSN, credit card, and email formats, or known sensitive identifiers is fully deterministic. These checks catch safety and policy violation failures without any model involvement.

Cross-span consistency is a provenance check. A claim in the output span can be checked against values returned in earlier tool or retrieval spans. If the agent quotes a price, a balance, or an identifier, that value should appear somewhere in the trace's upstream spans. A value in the output with no upstream provenance is a candidate hallucination, detectable by provenance graph traversal.

The Sakana AI CUDA Engineer case illustrates the limit of surface checks. Policy compliance via tool-call audit is the final check: if a consequential output like a refund, a booking, or an account change requires a prior policy-check tool call, the absence of that call in the trace before the output span is a detectable policy violation. No evaluation of the output's content is required.

Where deterministic checks stop working and what fills the gap

Deterministic checks cover a wide surface, but they cannot catch failures whose error signal is semantic rather than structural. Correctly formatted, policy-compliant responses can still be factually wrong in domains where ground truth requires external knowledge. No structural check will catch that.

Goal Hijacking escapes deterministic detection because adversarial instructions appear aligned with legitimate task completion while silently redirecting the agent's terminal goal. The trace looks syntactically correct. The goal is wrong. Inter-Agent Trust Escalation, a compromised agent asserting false identity or inflated permissions to an orchestrator in a multi-agent trace, evades detection without explicit identity verification logic built into the inter-agent message layer.

The right response to this limit is not to replace deterministic checks with LLM judges. It is to use deterministic checks as the first layer, running on every trace at sub-second speed, and to escalate only the traces they flag as anomalous or explicitly cannot cover to more expensive evaluation. A tiered approach where deterministic checks form the first layer and catch the majority of structural failures means that LLM-based evaluation, human review, or sampling-based audit is applied to a much smaller, already-triaged set of traces, not to every trace in production.

Building a per-layer detection harness in practice

A practical harness runs each category of check against the trace layer it applies to, gates on per-slice baselines rather than aggregate metrics, and runs fast enough to sit in CI on every change. Structuring the harness by trace layer, not by failure category, is the key design decision. The tool layer gets a schema validator, catalog membership check, repetition counter, and error-handling verifier, all running as unit tests against the trace's tool spans. The plan layer gets a plan-versus-execute comparator, a cycle detector, and a required-step coverage checker. The retrieval layer gets an empty-retrieval-plus-claim detector, a role-token scanner, and a source provenance checker. The memory layer gets a write-read consistency checker and an injection pattern scanner. The output layer gets a schema validator, banned-phrase and PII scanner, cross-span provenance checker, and execution runner for code outputs.

Per-slice baseline locking addresses a failure mode that aggregate metrics mask. Regressions that affect one slice of behavior while leaving overall metrics flat are invisible to aggregate monitoring. Lock baselines per slice and gate on deviation from each individually.

Regression injection is how a team validates that its harness actually catches what it claims to catch. If no trace in the evaluation set exercises the memory write path, the memory layer check's green status is meaningless. Mark it as unexercised, not passing.

What a working trace-reading practice looks like over time

Reading traces deterministically is not a debugging activity. It is a reliability practice that compounds, because each failure mode caught and named becomes a regression test that prevents the same failure from shipping silently again. The vocabulary problem is the foundation. An incident review that does not name the failure category produces a prompt tweak. An incident review that names the category and the trace fingerprint produces a regression test in CI that gates future deploys. The Microsoft AI Red Team's taxonomy expanded from 27 to 34 failure modes after a year of red-teaming live agents, not because agents became more dangerous, but because operational experience with real traces surfaces failure modes that forward-looking design does not anticipate.

Checking for expected absence matters as much as checking for unexpected presence. A trace that should contain a memory write and does not is as informative as a trace that contains a banned phrase. The absence of a required step is itself a signal, and learning to read it is what separates a team that reacts to failures from one that prevents them.

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. Model or Harness? An Interaction-Centric Taxonomy for Localizing Agent Failures
  4. Externalization in LLM Agents: A Unified Review of Memory, Skills, Protocols and Harness Engineering

More in LLM-as-Judge Design