AI workflow

On this page 6

An AI workflow is an automated process with a predefined sequence of steps in which one or more steps call an AI model, typically a large language model, to classify, extract, summarize, translate or generate content, while ordinary code and rules control everything else. In AI automation, the defining feature is that the developer, not the model, decides the path: the model performs bounded tasks at fixed points in a flow whose structure is known in advance.

This distinguishes an AI workflow from agent automation, in which the model itself chooses which tools to call and in what order. AI workflows are therefore more predictable, cheaper and easier to test, and they handle the large majority of practical business cases, such as triaging email, extracting invoice data or drafting replies for human approval.

How an AI workflow is structured

An AI workflow is structured as a chain of deterministic steps and model calls, where each model call receives a defined input, a prompt and an expected output format. The surrounding code validates the output, applies business rules and passes the result to the next step.

A typical model step has five parts: the input data assembled from earlier steps, the prompt with instructions and examples, the model call with parameters such as temperature, the structured output that forces the response into a schema such as JSON, and the validation that checks the result before anything downstream uses it.

Several recurring design patterns describe how model calls are combined. The table below summarizes the most common ones.

PatternHow it worksTypical use
Prompt chainingOutput of one model call becomes input of the nextOutline, then draft, then translate
RoutingA classification step sends input to a specialized branchSupport tickets by category
ParallelizationSeveral calls run at once and results are combinedChecking a contract against many clauses
Extraction and enrichmentThe model turns unstructured text into fieldsInvoice, order or resume parsing
Evaluator loopA second call reviews and the first revisesQuality checks on generated text
Common AI workflow patterns

AI workflows sit between classic rule-based automation and autonomous agents on a scale of how much control is handed to the model. Choosing the right point on that scale is the main architectural decision.

PropertyRule-based automationAI workflowAgent automation
Control flowFixed by the developerFixed by the developerChosen by the model at run time
Handles unstructured inputPoorlyWellWell
PredictabilityFully deterministicHigh, model steps varyLower, paths vary
Cost per runVery lowLow to moderateModerate to high
Testing effortUnit testsTests plus evaluation setsExtensive scenario evaluation
Best fitStructured, stable dataKnown process, messy inputsOpen-ended, multi-step tasks
Rule-based automation, AI workflows and agents

A sound engineering rule is to start with the simplest design that meets the requirement: plain rules where data is structured, an AI workflow where inputs are unstructured but the process is known, and an agent only when the sequence of steps genuinely cannot be defined in advance.

Key parameters, accuracy and cost

The behavior of an AI workflow is governed by a small set of parameters that trade accuracy, consistency, latency and cost against each other. The table below lists the most influential ones.

ParameterWhat it controlsPractical guidance
Model choiceCapability, speed and price per tokenUse small models for routing, larger ones for reasoning
TemperatureRandomness of the outputNear 0 for extraction and classification
Structured output schemaShape and types of the responseEnforce for every step consumed by code
Context sizeHow much input the model seesSend only relevant text to cut cost and errors
Confidence thresholdWhich results bypass human reviewCalibrate on a labeled sample
Parameters that shape an AI workflow

Cost is usually modest and easy to estimate because models are priced per token. Consider 10,000 emails a month, each sending about 1,500 input tokens and receiving 200 output tokens. That is 15 million input tokens and 2 million output tokens. At illustrative prices of 1 dollar per million input tokens and 5 dollars per million output tokens, the monthly model cost is 15 plus 10, or about 25 dollars. Actual prices vary widely by model and change often, so the calculation matters more than the figures.

Accuracy deserves more attention than cost. A classifier that is 95 percent accurate still produces about 500 wrong results in 10,000 items. A common remedy is confidence-based routing: if 80 percent of items exceed a threshold at which accuracy reaches 99 percent, the workflow processes 8,000 items automatically with about 80 errors and sends the remaining 2,000 items to human review.

Designing reliable AI workflows

Reliable AI workflows treat every model output as untrusted input that must be validated before it changes data or reaches a customer. The following practices separate production systems from prototypes.

  • Constrain outputs with a schema and reject or retry responses that fail validation.
  • Add a human approval gate before irreversible or external actions such as payments, refunds or customer emails.
  • Build an evaluation set of real, labeled examples and rerun it after every prompt or model change.
  • Log inputs, prompts, outputs and decisions so that errors can be traced and audited.
  • Protect against prompt injection: text from emails or documents can contain instructions, so it must never be allowed to change what the workflow does.

The table below lists the failure modes seen most often in production.

SymptomCauseFix
Downstream step crashesFree-form output instead of a schemaEnforce structured output and validate
Plausible but wrong valuesHallucination on missing dataAllow null fields and verify against sources
Quality drops after an updateModel or prompt change without testingPin model versions and rerun evaluations
Unexpected actions takenPrompt injection in input textSeparate data from instructions, restrict actions
Costs rise sharplyOversized context or retry loopsTrim input and cap retries
Common AI workflow failures

Put simply

An AI workflow is a fixed checklist in which some steps are done by an AI model. The checklist itself never changes: first read the message, then decide its type, then pull out the important details, then prepare a reply. The AI only does the parts that require understanding language.

Think of an experienced office manager who wrote clear procedures and hired a fast assistant to read and sort documents. The procedures stay in charge, and the assistant’s work is checked before anything important happens.

In practice

An accounting department receives about 3,000 supplier invoices a month as PDF attachments in many layouts. Manual entry took about 4 minutes per invoice, or roughly 200 hours a month.

The team built an AI workflow with four steps. A trigger picks up each new email, a model step extracts supplier, invoice number, date, amount and VAT into a JSON schema, a rule step checks the extracted totals and matches the invoice against open purchase orders, and invoices that pass are booked automatically. Any invoice with a failed check, a missing field or an amount above 10,000 goes to a human approval gate.

After calibration on 500 labeled invoices, about 85 percent of invoices were booked without manual entry, and the review queue held roughly 450 invoices a month. Because the model never posts anything on its own and every booking is logged, auditors accepted the process without changes to existing controls.