How to Put an Agent Inside a Deterministic Workflow
An agent belongs inside a deterministic workflow as one bounded step with a defined input, a defined output, a fixed-rule check after it and a named path for when it fails.
Put the agent in as one step, with a defined input, a defined output, a fixed-rule check after it and a named path for when it fails, and leave every other step of the workflow as it was.
Most of the trouble with agents in production comes from doing the opposite: handing the agent the whole process and asking it to work out the sequence. The workflow then has no fixed shape, so nobody can say in advance what it will do, and nobody can say afterwards why it did it. The deterministic workflow already answers both questions. The aim is to keep those answers while letting a model handle the one part of the process a rule cannot.
To see what that looks like, it helps to work through one process from start to finish.
A worked case: maintenance work orders
Consider a hypothetical plant maintenance process, the same shape as the one in the publication's governed AI workflows benchmark. An equipment alert arrives from a monitoring system. The asset is looked up in the maintenance system. Its service history is retrieved. The replacement part is checked against inventory. A work order is drafted, a supervisor approves or rejects it, and an approved order is submitted.
Five of those steps have answers defined before the alert arrives. The asset lookup is a key match. The service history is a query. The stock check is a query. Supervisor approval is a person. Submission is an API call. Only the draft needs judgment: reading a free-text alert, a service history written by different technicians over several years, and an inventory result, and writing a work order that says what is wrong, what to replace and what to check.
So the agent goes there and nowhere else. The fixed steps before it gather what it needs. The fixed steps after it decide whether its output is used.
The contract around the step
An agent step is bounded by a contract, and the contract has four parts. Each one is written before the agent is built.
- The input. The exact fields the step receives: the alert text, the asset identifier, the service records, the stock result. The agent reads these and nothing else. If it needs more context, that is a change to the contract, not something it fetches on its own.
- The output. A structured draft with named fields: asset, fault description, part number, quantity, recommended action, and a list of the source records it relied on. Free text is allowed inside fields where a person will read it. The fields a later step will act on are typed.
- The permissions. What the step may write, and where. Here, it may create a draft. It may not submit a work order, reserve a part or change the asset record. Those permissions are enforced by the system around the agent, not by instructions to the model.
- The failure path. What happens when the step cannot produce a valid output: the draft is withheld and the case goes to an escalation queue with what is known and what is not.
The third part is the one most often left to the prompt. An instruction such as "do not submit without approval" describes the policy to the model; it does not enforce it. Enforcement belongs in the workflow: the agent's credentials cannot reach the submission endpoint, and the submission step will not run without an approval record that references this draft.
An instruction to the model describes the policy; it does not enforce it.
With the contract in place, the question becomes how the workflow knows whether a particular output honors it.
The check after the step
The validator is a fixed-rule step that reads the agent's output and decides whether it may proceed. It does not judge whether the draft is good. That is the supervisor's job. It checks whether the draft is consistent with the facts the workflow already holds.
For the work order, that means: the asset on the draft is the asset on the alert; the part number exists in the parts catalog and is listed for this asset type; the quantity is within the range policy allows; the stock figure quoted matches the stock result the workflow retrieved; every source record cited is one the step was given. Each check compares the draft with a value the agent did not produce, and so each can fail independently of how persuasive the draft is.
A draft that fails goes to the escalation path, not back to the agent for another attempt by default. A single retry with the failure reason can be reasonable. An open loop of retries hides a step that does not work.
This is also where the deterministic parts of the workflow repay the effort of keeping them. Because the stock check ran as a query before the agent, the validator has a true stock figure to compare against. If the agent had been allowed to check stock itself, there would be nothing independent to check its draft against.
When something upstream fails
Agents are often tested on the cases where everything works. The cases that distinguish a sound design are the ones where it does not. Suppose the inventory service is unavailable. A workflow that lets the agent run the whole process will usually do something plausible: draft a work order with the stock field blank, or infer stock from the last known figure, or say that stock is probably available. Each is a guess presented as a result.
In the bounded design, the stock check is a fixed step with a defined failure. When it fails, the workflow records the failure, marks stock as unknown and routes the case to a person, before the agent is ever called. The agent never has to decide what to do about missing data because the workflow has already decided. This is exactly the condition the benchmark's handoff-failure case tests: the inventory request fails on every attempt, and a passing run records the failure, escalates it, preserves stock as unknown and submits nothing.
The agent never has to decide what to do about missing data because the workflow has already decided.
What the trace has to show
The last part of the design is the record. Every run should leave a trace that shows the inputs the agent step received, the output it produced, each validator result, the approval or denial and the submission or its absence. Because the steps around the agent are fixed, the trace has a fixed shape. An auditor reading it six months later can follow the same path for every case and see exactly where the one judgment step sat and what it was given.
That shape is the main return on the design. The agent contributes what only a model can contribute, reading varied material and writing something a person can act on quickly. The workflow contributes what a model cannot guarantee: the same sequence every time, permissions that hold whatever the model writes, failures that are caught where they occur, and a record that can be checked against the systems it touched. The work of extending the design to a second or third agent step is the same work repeated, each step with its own contract, its own validator and its own path to a person.
New research, benchmark results and reporting, by email.
No more than one email a week. Unsubscribe from any email. See the privacy notice.