AI workflow automation: where the AI step goes, how to check it and what to do when it fails
AI workflow automation done safely: where the AI step goes, how to check its output, which failures to plan for and how human review works in each tool.
By Rokibul Hasan8 min read
- AI
- Automation

Adding a language model to a workflow takes minutes in Zapier, Make or n8n. Keeping it from quietly doing the wrong thing takes more thought. When AI workflow automation goes wrong, the model is rarely the whole story: nobody checked the output, a retry ran twice, or a reviewer went on holiday and the workflow carried on without them.
This guide is for people who already run workflows, in those tools or in code, and want to add an AI step without putting customers or data at risk. It covers placement, checks, failures and how human review behaves in each tool. If you are still working out the terms, start with what AI automation is.
I build AI agents and integrations, and the advice below rests on one idea: the model suggests, and ordinary code decides.
Where the AI step goes in a workflow
Put it in the middle and keep it small. The trigger and the final action stay plain. The model gets one narrow job between them and returns data, which the next step treats with suspicion.
That shape is a security decision too. OWASP's guidance on prompt injection is to give a model only the access it needs and to run privileged functions in code, so the step that reads a customer's email should hold no key to your billing system.
Sort your AI steps by risk before you build.
| Job for the model | If it is wrong | Default check |
|---|---|---|
| Classify: what kind of message is this? | It lands in the wrong queue | Spot-check a sample |
| Extract: which account, date, amount? | Bad data enters a system | Validate every field in code |
| Draft: write the reply | A poor reply reaches a customer | A person reads it first |
| Decide: approve, refund, cancel | Money or a contract is affected | Keep it in your rules, or have a person approve |
Most of the damage happens in the fourth row, so let the model supply the inputs and keep the decision in rules you wrote.
A worked AI workflow automation example: cancellation emails
Imagine a membership business, purely as an illustration, that receives cancellation and pause requests at one address. In the automated version, an email triggers the workflow, a model returns structured data, code checks it, rules route the case, and code makes the change once and records it.
The AI step returns something like this:
{
"intent": "cancel",
"account_email": "sam@example.com",
"effective_date": "2026-12-01",
"evidence": "please cancel my membership from 1 December"
}
intent must be one of cancel, pause, question or other. The other option matters, because a model with no way to say "none of these" will force a fit. evidence is the sentence from the email that supports the answer, copied word for word, and it gives code something real to check.
Check the output in code
OpenAI and Anthropic both offer structured outputs, which hold the reply to a schema you define. That solves the shape of the answer and nothing else. effective_date will look like a date, with no promise that it is the right one. Anthropic's documentation also warns that "there are scenarios where the output might not match your schema", such as a refusal or running out of tokens.
So every result goes through four checks before anything happens.
| Check | Example | If it fails |
|---|---|---|
| Shape | Is intent an allowed value? Is the date valid? |
Send to a person |
| Facts | Does the account exist? Does the sender match it? Does the date fit your notice rules? | Send to a person |
| Source | Does evidence appear word for word in the email? |
Possible invention: send to a person |
| Stakes | Would this trigger a refund, or a change above a set value? | Always send to a person |
A second model can catch some mistakes, but it is still a model. Anything a lookup or a string match can check belongs in code.
Do not route on the model's confidence
It is tempting to ask the model for a confidence score and send anything under 0.8 to a person. Research presented at ICLR 2024 found that language models stating their confidence in words "tend to be overconfident", possibly copying how people talk. A bad extraction can arrive with a score of 0.95.
Route on evidence instead. A case goes to a person when a check fails, when the intent is other, when the sender is new or when the amount crosses a line you chose. Then add one more route: a random sample of the cases that passed everything. Nothing else will find the errors that look fine. One in twenty is a reasonable start.
The failures to design for
| What goes wrong | What you see | What to build |
|---|---|---|
| Provider overloaded or rate-limited | HTTP 429, 529 or 5xx errors | Retry with a growing delay, then queue the item |
| Refusal or cut-off reply | A successful call: Anthropic returns HTTP 200 for a refusal | Read the stop reason before using the output |
| A retry repeats work | Two emails sent, two records created | One unique key per change; update rather than create |
| Instructions hidden in the email | The model obeys text it was only meant to read | Give that step no tools; let code act on checked data |
| The model is retired | Requests start failing | Keep a test set and run it on the replacement early |
| Nobody reviews in time | The queue ages, or the run moves on | A timeout that stops or escalates |
Retries need care. n8n's documentation warns that when you retry a failed execution, the failed node gets its saved input again and "processes every item, including items it handled before it failed". Stripe's idempotency keys are the pattern to copy: every action carries a unique key, so a repeat is recognised and ignored. In the example, the key could be the email's message ID plus the action.
Hidden instructions are not a solved problem. OWASP says "it is unclear if there are fool-proof methods of prevention", so the step reading an email must have nothing dangerous within reach.
Model retirement arrives on a date. At the time of writing, Anthropic's deprecations page lists Claude Sonnet 4.5 for retirement on 30 November 2026, promises at least 60 days' notice and says requests to retired models fail. OpenAI shut down gpt-5-chat-latest on 23 July 2026. Someone on your side has to own that date.
How human review behaves in each tool
Approval steps differ, and the defaults catch people out.
Zapier. The Human in the Loop app pauses a Zap for approval. Its documentation has two details to read first. On a Pro plan you can only send requests to yourself. And the timeout setting includes "Skip and continue", under which the Zap carries on with no review at all, so choose "End run" when the approval guards a live action. Tools inside an AI by Zapier step also have a Require approval before running toggle, and it is off by default.
n8n. Human review attaches to tools on the AI Agent node. The workflow pauses, the reviewer sees the tool and the parameters the model chose, and approves or denies through Slack, Teams, Gmail and other channels. A denied call does not run, and the model is told. The documentation does not say what happens if nobody answers, so test that before you rely on it.
Make. In a post dated 20 October 2026, Make listed "Pause any scenario for approval and sign-off from Slack, Teams, or the Make mobile app" as coming soon. Until it ships, check what your plan offers or use a third-party approval app.
Custom code. A table of pending items, a simple screen and a rule that nothing runs until an item is approved. I built the same principle into Clearday, where the assistant waits for the user's approval before touching their calendar.
Going live in stages
Write the test for leaving each stage before you enter it.
| Stage | What the AI does | Move on when |
|---|---|---|
| Shadow | Processes real cases; nothing is sent or changed | It matches what staff did, at a rate you set in advance |
| Assisted | Drafts; a person approves every item | Reviewers rarely edit, and the edits are small |
| Narrow automatic | Acts alone on the simplest case type; a sample is reviewed | Errors stay under your limit for a full month |
Log every run: a link to the input, the prompt version, the model name, the raw output, each check result, who approved it and what was done. When a customer asks why their membership ended, that record is your answer.
If the workflow needs your own database, a proper approval screen or a fuller audit trail, that is custom work, quoted from a brief. For store workflows such as order exports, the marketplace MVP plan starts from $2,500; that is a starting price, with a fixed quote after a short brief.
FAQ
What is the difference between AI workflow automation and an AI agent?
In AI workflow automation you fix the path: the steps and their order are set in advance, and the model handles one or two of them, such as reading an email. An agent chooses its own next steps and which tools to use. Workflows are easier to test, cheaper to run and simpler to explain when something goes wrong, so start there. Move to an agent only when the path really cannot be written down in advance.
How do I stop an email from tricking the AI step in my workflow?
You cannot fully prevent it, so limit what a successful trick could do. OWASP says it is unclear whether fool-proof prevention exists for prompt injection. Give the step that reads outside text no tools and no credentials. Have it return only fixed fields, then validate them in code. Keep real actions in later steps the model cannot reach, and require a person to approve anything involving money or account changes.
How much testing does an AI step need before it goes live?
Start with around 50 real past cases, including the awkward ones, each with a known right answer. Run the step over them in shadow mode, where it changes nothing, and compare the results. Decide the pass mark before you look. Keep that set and rerun it whenever the prompt or model changes. Low-risk labelling needs less; anything that changes customer records needs more, plus a period where a person approves every item.
If you have a workflow that needs an AI step, send me a short brief: the trigger, the decision a person makes today, the systems involved, rough volume and what must never happen automatically. You can send it through the contact page, read about the AI agents I build, or compare platforms in workflow automation tools.


