Verification ·
Deterministic Oracles for AI Agents: From Plausibility to Proof
Replacing trust in persuasive explanations with external verification mechanisms in AI agent workflows.
AI agents write code, read repositories, execute commands, and propose changes at high speed. Yet the relevant engineering question is not whether an agent can perform a task, but how we verify that it performed it correctly.
The answer cannot be that the agent claims to be done, nor that a second model reviewed the explanation and found it reasonable. In software engineering, the answer is an oracle.
What an oracle is
An oracle is a mechanism external to the agent that can decide whether an output satisfies a concrete condition. It does not guess, and it cannot be persuaded by a well-written explanation. It evaluates a condition and returns binary evidence: pass or fail.
An automated test is the classic example:
Rule: a user cannot pay for the same order twice.
Oracle: an integration test executes two simultaneous payment attempts.
Expected result: exactly one charge and an idempotent response.
The agent may have produced clean code, thorough comments, and a detailed rationale. If the test records two charges, the verdict is immediate: the property does not hold. An oracle shifts the evaluation from linguistic plausibility to empirical demonstration.
Why agents need oracles more than human engineers
A human developer also makes mistakes, but usually retains problem memory, business context, and an intuition for structural inconsistencies. An agent can produce a highly persuasive response even after misunderstanding a premise, testing the wrong file, or omitting an edge case.
Asking the model to be careful in the prompt is insufficient. Reliability cannot depend on the model remembering to exercise caution on every turn. In my workflow, any task delegated to an agent must specify four explicit elements:
Objective: what behavior is required.
Boundary: what cannot be modified or assumed.
Oracle: how the behavior is verified.
Evidence: which file, command, output, or source proves the result.
Without a defined oracle, an agent may perform exploratory work, but it should not be permitted to certify task completion.
TDD: requiring the test before the implementation
In Test-Driven Development (TDD), the minimal cycle consists of three steps: red, green, and refactor.
- Red: write a test for the desired behavior and verify that it fails.
- Green: make the minimal change required for the test to pass.
- Refactor: improve the internal design without altering the verified behavior.
The first step is the one most often skipped, and the one that provides the highest leverage with agents. A test that has never failed may be disconnected from the actual code path or assert a trivial condition. Observing it fail proves that the oracle can detect the absence of the required behavior.
Rather than requesting a feature in open-ended terms—such as adding support for exporting session state—it is more effective to structure the prompt as follows:
First write a test demonstrating that session export cannot include secrets.
Show that the test fails against the current implementation.
Then implement the exclusion logic.
Run the test and attach the full output.
This does not make the model infallible, but it catches structural errors before a human reviewer has to audit a lengthy explanation.
An oracle is not always a unit test
Forcing unit tests where they do not fit creates a false sense of coverage. The broader principle is evidence-first: every claim requires a verification method suited to its domain:
| Claim type | Appropriate oracle |
|---|---|
| “This function does not duplicate payments” | Unit and concurrency integration test |
| “The service is healthy” | Health check, bounded log inspection, and expected response |
| “The migration preserves data” | Before/after fixture and verification query |
| “The interface works on mobile” | Reproducible walkthrough, UI test, or verifiable screenshot |
| “This source supports the conclusion” | Primary source, exact quote, and access date |
| “This option is better” | Explicit hypothesis, evaluation criteria, and pending experiment |
The final row matters. Some claims cannot be verified immediately. In those cases, rigorous engineering behavior is not to manufacture certainty, but to label the claim as a hypothesis, state what evidence is missing, and propose how to obtain it.
Signals that do not count as oracles
Several common development signals are useful for orientation, yet insufficient on their own to approve a deliverable:
- A self-review in which the agent states that the code is correct.
- The fact that the project compiles locally.
- A passing test that was never observed failing first.
- Agreement from another language model.
- A static screenshot without functional verification behind it.
- The apparent absence of errors in logs.
Each of these provides a partial signal, but none proves the property that matters. A valid oracle must sit close to the actual risk. If the risk is losing uncommitted local changes during a state transfer, the oracle is not a formatting check: it is a test that stages uncommitted changes, executes the transfer, and verifies that the target preserves them without overwriting other work.
Oracles and model routing
Clear oracles also change how we should allocate capacity across models.
A smaller, lower-cost model performs reliably on bounded tasks when backed by a strict contract and a strong oracle—such as classifying files, preparing fixtures, or implementing a small function against existing tests. Higher-capacity models should be reserved for discovering the right premise, resolving contradictory evidence, designing the contract, or integrating results across subsystems.
Upgrading to a larger model whenever something fails is wasteful; we first need to diagnose what failed. A sensible routing policy follows these rules:
Network or tool failure -> bounded retry.
Ambiguous specification -> halt and clarify.
Red oracle after a targeted fix -> escalate model effort or capacity.
Model unavailable -> use an approved fallback with reduced sign-off authority.
Incomplete evidence -> prohibit declaring success.
Every escalation must be explicit: which model was selected, at what effort level, why, which check failed, and what changed in the next attempt. Silent model switching turns the system into a black box precisely when auditability is most needed.
The verification flow I use
For complex engineering work, I structure execution around this sequence:
Claim
↓
Task contract
↓
Appropriate oracle
↓
Reproducible evidence
↓
Verdict: verified, blocked, or hypothesis
A “verified” verdict does not mean the system is bug-free. It means something more honest and actionable: the agreed-upon property was demonstrated using the best available evidence. Automating with rigor requires separating autonomy from faith. A reliable agent system is not one that always reports completion, but one that knows when it can prove its work, when it must escalate, and when it still has to say it does not know.