How to Build an AI Workflow Step by Step

AI & Agents
Slate
GUIDE · NOVEMBER 2026
Seven steps from the trigger to the failure alert, then one GTM workflow built in full, prompt and tests included.
Organisation
Slate
Written By
Theres Sudeep
PUBLISHED
November 11, 2026
Read
3
min

Key Takeaways

  • Decide the job, the input, the output, and who checks it before you open a builder, since most failed builds skip that page.
  • The AI step needs a set output format, such as one label from a set list, so the next step can act on it without a person reading it first.
  • A code check after the AI step catches broken output, while a person still approves anything that reaches a customer.
  • Test on past cases you've already handled by hand, then run the workflow next to the person for two weeks before it acts on its own.
Quick answer

To build an AI workflow, write down the one job it does and the format its output must take. Then set the trigger, pull the inputs, and write a prompt that returns that format and nothing else.

Decide Four Things Before You Open a Builder

Most AI workflows that fail were started inside the builder. Someone dragged in a trigger and a model step, then tried to work out what the workflow was for.

Write these four down first. A doc or a sticky note is enough:

  1. The job, in one sentence. For example: "Read each reply to our outbound emails and decide what happens next."
  2. The input. Name the exact fields the model will see, such as the reply text, the sender, and the sequence it came from.
  3. The output, in a set shape. One label from a set list, plus a short reason, works far better than free text the next step has to interpret.
  4. Who checks it, and when. Anything that sends or changes a record needs a named person before it acts, at least at first.

Picking which process to automate is a separate decision. The Exchange covers it in AI Workflow Automation: 10 GTM Processes You Can Automate, with a free workflow for each.

So is picking the platform. People searching for an AI workflow builder are usually comparing Zapier, Make, n8n, and the agent builders, and the Exchange compares them by layer and price in Best AI Workflow Automation Tools. The steps below work in any of them.

How to Build an AI Workflow in Seven Steps

Each step ends with a test you can run in a few minutes. Don't start the next step until the last one passes.

Step 1: Write the Job and One Worked Example

Take the one-sentence job and add one input from your own data, with the output you'd want for it. That pair becomes your first test case and the first example in your prompt.

Done when a colleague reads the example and agrees with the output.

Step 2: Set the Trigger and Pull the Inputs

Choose the event that starts each run, such as a new reply in the inbox, a new row in a sheet, or a schedule, and pull only the fields you named before you started.

Then run the trigger on a live record. Fields often arrive empty, or named differently from what you expected.

Done when one live record arrives with every field you need filled in.

Step 3: Write the Prompt for the AI Step

Give the model the job, the rules, two or three examples, and the output format, in that order. If the workflow has a second job, give it a separate AI step with its own prompt.

Tell the model what to do when it isn't sure, because an "unclear" label beats a forced guess every time.

Done when the prompt returns the right output for your Step 1 example.

Step 4: Lock the Output Format

Ask for JSON with named fields, and list the allowed values for every label. Many model steps can be set to return JSON directly, and where yours can't, ask for it in the prompt and parse it in the next step.

A set shape lets the workflow branch on a field, where prose would leave the next step guessing.

Done when ten runs on the same input return the same fields.

Step 5: Add a Code Check After the Model

A short code step rejects output that breaks the rules: a label that isn't on the list, an empty reason, or a draft over the length limit. Rejected runs go to a person with the reason attached, never on to the action.

TripleDart's email sequence workflow runs every draft through 13 rules this way before anything reaches Gmail.

Done when a deliberately broken output gets stopped.

Step 6: Route Each Result, With a Person on Anything That Acts

Branch on the label, and let low-risk results like tagging a record act at once.

Anything that sends an email, changes a deal, or spends money waits in a queue for a person. That queue is where most of the value of a first version sits, because the person sees every draft the model gets wrong.

Done when every label has a destination, and every path that sends has an approver.

Step 7: Log Every Run and Alert on Failure

Write each run's input, output, and decision to a sheet or table, then alert the owner whenever a run fails.

The Exchange's workflows directory lists what breaks first: the credential, then the schema. Without an alert, either one stops the workflow with no error anyone reads.

Done when a forced failure reaches the owner.

A Worked Build: Triage Replies to Outbound Email

Here's the seven steps applied to one GTM workflow, written out the way I'd hand it to whoever builds it. The job: read each reply to an outbound sequence and decide what happens next.

It picks up where an outbound workflow leaves off. TripleDart's email sequence workflow stops a sequence when someone replies, and then a person has to read every reply and decide what to do with it.

The input is the reply text, the sender's email, the sequence name, and the last email the contact received.

The prompt for the AI step:

text
You sort replies to outbound sales emails. Read the reply and return one label.

Labels:
- interested: they want a call, a demo, pricing, or more detail
- not_now: they're open, but name a later time
- referral: they point to someone else at their company
- unsubscribe: they ask to stop, in any wording
- out_of_office: an auto-reply, with a return date if one is given
- unclear: none of the above, or you're not sure

Rules:
- If a reply asks to stop, label it unsubscribe, even if it also says something else.
- Never guess a date. Return a return_date only when the reply states one.
- Return JSON only, in the format below.

Reply: {reply_text}
Last email we sent: {last_email}

The output format, with every field the next steps need:

json
{
  "label": "not_now",
  "reason": "Asks to reconnect after their Q1 planning",
  "return_date": null,
  "referred_to": null
}

The code check rejects any run where the label isn't one of the six, the reason is empty, or a date appears in return_date that isn't in the reply text. Rejected runs go to the rep's queue, labeled as rejected.

The routing decides what each label does, and who approves it:

LabelWhat the workflow doesWho approves
interestedDrafts a reply offering times, and alerts the repThe rep, who edits and sends it
not_nowEnds the sequence and creates a follow-up task for the date they namedNo one, since a task is easy to undo
referralDrafts a short note to the person they namedThe rep, before it goes out
unsubscribeEnds every sequence for the contact and adds them to the suppression listNo one, since a missed opt-out costs more than an extra one
out_of_officePauses the sequence until the return date, or for a week without oneNo one
unclearSends the reply to the rep's queueThe rep

Three rows act with no approval on purpose. A follow-up task and a paused sequence are easy to undo, and honoring an opt-out at once is the safer mistake to make.

Test It Before It Touches a Customer

Pull 30 replies you've already handled by hand, and write down the label you gave each one. Include the awkward cases, such as a "not now" that means no, or a polite opt-out buried in a long reply.

Run all 30 through the workflow and compare its labels with yours. Read every miss, and trace each one to the line that caused it. Run all 30 again after each change, because a change that helps one case can break another.

What to measureWhat it tells youThe bar before launch
Labels that match yoursWhether the prompt understands the jobMost of the 30, with every miss explained
Opt-outs it missedWhether it will email someone who asked to stopZero
Runs the code check rejectedWhether the output format holdsEach one read, and the rule or prompt changed

Then run it next to the person for two weeks, with the workflow labeling every reply while the rep still decides what happens.

Turn the labels on one at a time. Let out-of-office and not-now act first, since they're easy to undo, and keep interested and referral drafts behind the rep for as long as the drafts need editing.

Keep It Running After Launch

A workflow that works on launch day can drift. The replies change, a field gets renamed upstream, or someone edits the prompt and doesn't tell anyone.

Three habits keep it honest:

  • Name one owner. They get the failure alerts and read a sample of 20 runs every week for the first month.
  • Version the prompt. Log each change with the date and the reason, and rerun the 30 test cases after every edit.
  • Watch the unclear label. A rising share of unclear replies usually means the input changed, so check the trigger and the fields first.

The Exchange lists the common failures, from expired logins to duplicate triggers, each with the step that prevents it. They're in the What Breaks section of AI Workflow Automation: 10 GTM Processes You Can Automate.

Frequently Asked Questions

How long does it take to build an AI workflow?
Do you need to code to build an AI workflow?
What is an AI workflow builder?
How is an AI workflow different from an AI agent?
Which model should the AI step use?

The plays behind the reading.

We build inbound GTM engines for B2B software teams, and these are the frameworks we build from. Bring us a pipeline target and we'll map the route.