Part of the Determesh series.
What
Determesh has one rule for where any decision lives: if it can be written as a rule, it is code. The model gets only what cannot be: understanding what a person meant, choosing whom to ask, and putting an answer into words.
This post is about drawing that line, and about the less obvious half of it: making sure the model’s output crosses back into code as data, not as prose that code has to trust.
Why
A prompt is a suggestion
Every instruction in a system prompt is followed most of the time. “Never show salary data to anyone outside HR” is followed most of the time. For a writing assistant, most of the time is fine. For a system that reads a company’s payroll on behalf of whoever sends a Telegram message, it is not.
The problem is not that models are careless. It is that a prompt has no enforcement. It cannot refuse a call. It can only ask the model to refuse it, and the model is also reading the user’s message, which may be arguing the other way.
Errors compound
A single request in Determesh can touch several model calls: the orchestrator plans, one or more resource assistants call methods, the reply writer phrases, the evaluator scores. If each step is right 98 percent of the time, five steps in a row are right about 90 percent of the time. Every decision moved out of the model is one fewer step that can be wrong.
Code can be tested and audited
A rule in code has a test that fails when it breaks. A rule in a prompt has a hand test that passed last Tuesday. When a company asks why a user was refused, code gives a reason that can be logged: “no rule allows this user on this resource”. A model gives a sentence that sounds like a reason.
How
The split, decision by decision
| Decision | Who makes it |
|---|---|
| Is this message from a channel the company owns, and is it signed or authenticated? | Code |
| Which person is this? | Code |
| Is this person blocked? | Code |
| Which resources may they reach, from this channel? | Code |
| What do they actually want? | Model |
| Which resource should be asked, and what? | Model |
| May this method be called for this user, with this permission? | Code |
| Did the call succeed? | Code, from the method’s own answer |
| How should the result be phrased? | Model |
| Is the reply good enough? | Model scores it, code decides what the score means |
| Fallback, block, retry, deliver | Code |
The model’s column is short and every entry in it is about language. Nothing in it is about permission.
The model ends a turn with a structure, not a sentence
The orchestrator does not finish by writing a reply. It finishes by calling a finish tool with an outcome and the facts it found:
ANSWER: the facts are enough to reply.ASK_USER: something is missing, ask the user.DENY: the request is outside what this company does.NO_MATCH: on topic, but none of the company’s resources covers it.
Code branches on that outcome. NO_MATCH sends the company’s fallback. DENY sends a polite refusal with no fallback. ANSWER goes to the reply writer with the facts, and only the facts. The model chose the outcome, but what each outcome does is fixed.
This started as “end your turn by writing this JSON”. It became a tool after the model kept reasoning its way to the right answer and then calling another tool instead of stopping. That story is its own post later in the series.
Fields that matter are read by code
When a resource answers, its answer is text the resource assistant reads. But some answers carry consequences: a verification succeeded, an email should be sent, a person should be messaged. Those are never taken from the assistant’s wording. They are fields at the top of the method’s response, and code reads them:
{
"outcome": "SUCCEEDED",
"verified": { "channel": "EMAIL", "externalId": "user@example.com" }
}
If the resource says verified, code links that email to the user’s identity. If the assistant later writes “the user is now verified” without that field, nothing happens. A model cannot verify anyone by saying so.
The same holds for outcomes in general. A method call that ran is not a call that worked: a wrong one-time code still returns HTTP 200. So the outcome of a step is decided in a fixed order: the method’s own outcome field, then a verifier’s verified field, then Determesh’s own gates and errors, and only last the assistant’s closing note. The model’s opinion is the tie breaker, not the source.
Ambiguity in, determinism out
Some inputs are ambiguous by nature. A manager with five approvals waiting replies “yes”. Code cannot tell which request that answers. A model can make a good guess, or notice it cannot and ask.
So the model’s job there is narrow: turn the ambiguous reply into a result of fixed shape, “this reply, for this request”. Code then delivers it only if that request is still waiting for that person. A fooled model can pick the wrong pending request, but it can never answer a request that was not waiting, or one that belongs to somebody else.
That pattern repeats across the system. Let the model interpret. Make it hand back a structure. Let code check the structure against what is actually true before anything happens.
What it costs
More model calls per request, not fewer. Every resource gets its own assistant even when one model could have read the file directly. A reply goes through a writer and an evaluator before it is sent. A simple question takes seconds, not milliseconds.
That is accepted. The users are on Telegram, email and webhooks, not watching a spinner. A reply in eight seconds that respects access is worth more than a reply in two that usually does.
The other cost is honesty about what remains with the model. There is no code filter on the wording of replies. If the orchestrator decides to describe its own instructions, nothing in code stops the sentence. What code stops is any data the user may not reach getting into that sentence in the first place. That is the subject of the next post.
Previous: Determesh: An AI That Routes and Never Answers
Next: Access Control That Lives Outside the Model