Non-Deterministic Agents Need Deterministic Feedback Loops
Non-Deterministic Agents Need Deterministic Feedback Loops
Non-deterministic agents with deterministic feedback loops - that is the whole trick. The agent itself will never be perfectly predictable. LLMs produce different outputs for the same input. But the system that checks whether the agent did the right thing? That has to be rock solid.
The Problem with Pure Non-Determinism
When both the agent and its verification are non-deterministic, you get chaos. The agent might produce a wrong answer, and the verification might say it looks fine. You have no ground truth. Everything is vibes.
What Deterministic Feedback Looks Like
Good feedback loops have clear, binary outcomes:
- Did the test suite pass? Yes or no.
- Does the file exist at the expected path? Yes or no.
- Did the API return a 200 status code? Yes or no.
- Does the output match the expected schema? Yes or no.
These checks do not involve LLM judgment. They are programmatic assertions that either pass or fail.
Layering the System
The architecture looks like this:
- Agent layer (non-deterministic) - receives a task, reasons about it, takes action
- Verification layer (deterministic) - checks the result against hard criteria
- Retry layer (deterministic) - if verification fails, routes back to the agent with the specific failure reason
The agent gets creative freedom. The verification layer keeps it honest.
Practical Examples
- Agent writes code, then
npm testprovides deterministic feedback - Agent drafts an email, then a schema validator checks required fields
- Agent organizes files, then a directory listing confirms the expected structure
- Agent deploys to staging, then a health check endpoint confirms it is running
The Takeaway
You cannot make LLMs deterministic. Stop trying. Instead, wrap them in deterministic systems that catch mistakes quickly and route them back for correction. The agent does not need to be right the first time - it needs to know when it is wrong.
Fazm is an open source macOS AI agent. Open source on GitHub.