Agent Reliability · Context Engineering · Evaluation

The failure starts
before the agent runs.

First surfaced in Tandemly Briefing — 2026-07-28.

A researcher at the University of Chicago built a seven-criterion scoring system for agent context quality and isolated it from behavioral metrics entirely. Then ran 300 controlled evaluations holding the model fixed and varying only the context. What changed between poor and structured context: critical failures dropped from 4.11 to 1.33 per session. The lesson is about where reliability actually comes from.

Core concept
Context preflight: scoring the quality of an agent's instructions, tools, memory, and guardrails before any behavioral test runs, as an independent, non-circular predictor of which failure modes to expect.
scroll to explore

Measuring outputs
to diagnose inputs.

Most agent evaluation runs the agent, counts failures, and calls that a quality signal. There's a circularity problem buried in that approach that the field has mostly ignored.

When an AI agent misbehaves, the standard sequence is: run the agent, observe what it does, count the things that went wrong. If it hallucinated, if it broke a guardrail, if it ignored a constraint or spent three times the expected tokens on a simple task, those outcomes show up in a behavioral metric and get logged as failures.

But every agent decision is shaped by what's in its context. The system prompt that defines the agent's role. The tool definitions that specify what functions it can call and with what schemas. The retrieved knowledge grounding its answers. The guardrail instructions limiting what it's allowed to do. The phrasing choices that either invite or resist injection attempts. These are the inputs, and they vary enormously in quality across production deployments.

The circularity problem: if you evaluate context quality by running the agent and counting failures, the score depends on the same outputs it's supposed to predict. You can't use behavioral metrics to grade the context that produced the behavior without losing the ability to use context quality as a predictive signal.

There's also a timing problem. By the time behavioral failures surface in a testing pipeline, the context has already shipped. The failure arrived late. What's needed is a way to grade the context before the agent runs, as a preflight check rather than a post-mortem.

The question this paper asks

Can context quality be scored independently, before any behavioral tests run, in a way that actually predicts which failure modes to expect? And if so, how much does context quality explain about reliability variation across deployments?

Seven criteria,
scored before the run.

Bousetouane built ProofAgent-Harness, an open-source multi-juror infrastructure for adversarial agent evaluation, and used it to measure context quality across seven dimensions. The scores went down before the behavioral tests ran.

ProofAgent-Harness uses a consensus-based scoring approach: multiple independent jurors assess each criterion and the result is a consensus score, not a single reviewer's judgment. This reduces the subjectivity problem in qualitative context assessment.

The crucial design choice was sequencing. Context quality scores were recorded before behavioral evaluations began. Behavioral outcomes were only examined after scoring was complete. This sequencing breaks the circularity: the context score cannot be influenced by the behavioral outcomes it is predicting, and the evaluator scoring context cannot rationalize the score backward from observed failures.

The controlled study ran 300 multi-turn evaluation sessions across three deployment domains: customer support, healthcare claims processing, and legal drafting. The model was held fixed throughout. Only the context varied, across three levels. Poor context meant minimal system prompts, generic tool definitions, and no explicit guardrails. Structured context meant well-specified roles, typed tool schemas, and explicit constraint instructions. Hardened context added injection-resistant phrasing and explicit handling of adversarial inputs on top of structured.

Role clarity
How precisely the system prompt defines the agent's identity, scope, and the limits of its authority.
Predicts: instruction-following drift
Guardrail coverage
Whether explicit constraints are present for the failure modes most likely to matter in the deployment domain.
Predicts: manipulation resistance
Instruction consistency
Whether instructions in the context contradict each other or leave ambiguous cases unaddressed.
Predicts: behavioral coherence
Tool-schema quality
How precisely tool definitions describe input types, expected outputs, and error conditions.
Predicts: tool misuse rate
Grounding sufficiency
Whether retrieved knowledge is complete enough to support accurate answers without requiring the model to invent details.
Predicts: hallucination resistance
Injection hardening
Whether the context phrasing and structure resist attempts by untrusted inputs to redirect the agent's behavior.
Predicts: injection attack resistance
Token efficiency
Whether context is dense enough to be informative without padding that wastes model attention on irrelevant material.
Predicts: over-spending on simple tasks
Why the sequencing matters

Scoring context quality before behavioral tests run is not a procedural formality. It determines whether the score is genuinely predictive or just retrospective rationalization. A context score assigned after you've seen the failure rate is a description. A context score assigned before is a prediction. The paper's contribution rests on that distinction.

Criteria predict
their matched outcomes.

Three results across 300 sessions. The main one is that context quality is a real variable with a large effect on critical failure rate, independent of the model.

Critical failures, poor context
4.11
per evaluation session
Critical failures, structured context
1.33
per evaluation session
Reduction, poor to structured
68%
same model, different context
Evaluation sessions
300
multi-turn, across 3 domains
Finding 1: Context quality scores predicted behavioral outcomes along matched axes

The grounding sufficiency score predicted hallucination resistance. The guardrail coverage score predicted manipulation resistance. Each of the seven criteria pointed to a corresponding class of failure mode. This is the non-circular validation the design was built for: the context scores went down before the behavioral tests ran, and the predictions held when the results came in.

This result is more useful than it might first appear. It means context quality can function as a diagnostic vocabulary. If you know a deployment's grounding sufficiency score is low, you know which tests to weight most heavily in behavioral evaluation. You don't have to run the full evaluation before you know where to look.

Finding 2: The gap between poor and structured context was larger than expected

Moving from poorly-specified to properly-specified context cut critical failures by 68%, from 4.11 to 1.33 per session. This happened before any safety hardening was applied. The majority of the reliability gain came from basic structural work: clear role definitions, typed tool schemas, explicit constraint statements. The "hardened" level brought further improvement, but the largest single step was from poor to structured.

This matters for resource allocation. Teams often invest in adversarial red-teaming and injection-hardening before addressing basic context quality. The data suggest that's the wrong order.

Standard evaluation posture
Run the agent, count the failures. Context quality is implicit in the results. If the agent failed, something was wrong, but you measure what happened, not what caused it. Context gets improved reactively, after failures surface.
Context-preflight posture
Score the context before the agent runs. Each criterion predicts a failure class. Low grounding predicts hallucination. Thin guardrails predict manipulation. You know what you're walking into before the first behavioral test.
Finding 3: Structured context still fails. Preflight scores are predictive, not protective.

Even at the hardened context level, critical failures did not reach zero. A well-specified, injection-hardened context produces fewer failures, not no failures. The seven-criterion score tells you what to expect; it doesn't eliminate the risks it names.

This is an honest limitation the paper does not hide. Context quality is a leading indicator of reliability, not a guarantee of it. Teams that treat a high preflight score as permission to skip behavioral testing will be surprised.

Scope and limitations

Three deployment domains (customer support, healthcare claims, legal drafting), one model family, one harness. The seven criteria and their matched behavioral predictions have not been validated across a wide range of model families or deployment types. The paper is a first demonstration, not a validated framework. The claim that grounding predicts hallucination, for example, is supported by these 300 sessions; it needs more domains to be general.

What to do with
context as a variable.

The practical shift this research asks for is not adding a new tool. It's adding a new step before a step you already take, and treating context quality as something measurable, not intuitive.

1
For AI builders running agent evaluations
Before your next behavioral eval run, score the agent's context against the seven criteria. You don't need a formal harness to start: a rubric with four levels per criterion (poor, basic, structured, hardened) applied by two independent reviewers is enough to surface the gaps. Low grounding sufficiency means hallucination tests will dominate. Thin guardrail coverage means manipulation tests will catch things. Address the low scores before you interpret the behavioral numbers.
2
For teams running CI/CD on agent deployments
Context quality can be scored statically, without running the agent. That makes it fast and cheap enough to run on every candidate release, as a first filter before expensive behavioral evaluation passes. A context score drop from a recent release is a signal to investigate the system prompt changes before shipping, not after. Gate on context score the same way you gate on unit tests.
3
For teams doing post-mortems on production failures
The seven criteria are a diagnostic vocabulary for root cause analysis. When a production agent misbehaves, the standard question is what the agent did. The more useful question is which context dimension was weak. Low grounding at the time of failure predicts a different root cause than thin guardrail coverage or a contradictory instruction set. Retroactive context scoring against the production context at the time of incident narrows the search before you start reading logs.
4
For anyone thinking about where to invest in reliability
The 68% failure reduction from poor to structured context, without any safety hardening added, suggests that basic context quality work returns more than adversarial hardening for most deployments. If guardrails are missing and tool schemas are generic, fixing those first costs less than red-teaming an agent that will still fail on structural problems the red-teaming doesn't address.
5
What this paper doesn't settle
Three domains, one model family. The seven criteria and their behavioral predictions need validation across a wider range of agent types and deployment domains before the framework generalizes confidently. Treat the current version as a structured starting point for your own context audits, not a finalized scoring standard. The framework's value is in giving the conversation a vocabulary; the specific score cutoffs will need local calibration.

Where to go
from here.

If you want to go deeper on context as a measurable variable in agent reliability.

1
Read the paper
Bousetouane, F. (2026). AI Agents Do Not Fail Alone: The Context Fails First. ProofAgent.ai / University of Chicago. arXiv:2607.14275.
2
Explore the ProofAgent-Harness infrastructure
The companion paper describes the full adversarial evaluation infrastructure ProofAgent-Harness is built on. Bousetouane, F. (2026). ProofAgent Harness: Open Infrastructure for Adversarial Evaluation of AI Agents. arXiv:2605.24134. Open-source and designed to be adopted for in-house agent evaluations.
3
Run a context audit on your current deployment
Pick your highest-stakes production agent. Score it against the seven criteria: role clarity, guardrail coverage, instruction consistency, tool-schema quality, grounding sufficiency, injection hardening, token efficiency. Use a simple four-level rubric per criterion (poor / basic / structured / hardened). Any dimension at "poor" or "basic" is a higher-priority investment than more behavioral test coverage.
4
Try the sequencing discipline on your next evaluation
Score context quality before running behavioral tests on your next agent release. Record the scores. Then run the behavioral evaluation. Compare which failure modes appeared against which criteria scored low. Doing this even informally once builds intuition for which context gaps create which classes of behavioral problems.
5
Pair with the broader agent-reliability cluster
This paper sits upstream of the behavioral-eval cluster. For the downstream piece, the Deterministic Gates paper (Reddy, Challaram & Basu, 2026) addresses pre-execution validation at the action boundary. AgentTrust (Yang, 2026) addresses runtime tool-call interception. Context preflight, action-boundary gates, and runtime interception are three distinct layers in a reliability stack, not competing alternatives.