HASZB_AIHASZB_AI

Search across courses, lessons, glossary terms, prompts and tools.

Stage 8 · AI Automation

AI decision steps

Putting a model inside a workflow safely means constraining what it can say and validating what it returns.

6 min read

In this lesson

  • Constrain a model decision to a known set of outputs
  • Validate before acting on a classification
  • Handle low confidence explicitly

A model inside a workflow is a component that produces a value other steps depend on. Treat it like any other unreliable input: constrain it, validate it, and have a plan when it is wrong.

What models are good at here

Classification — which category does this belong to. Reliable when categories are distinct and few.

Extraction — pull the invoice number, the date, the address out of unstructured text. Very strong, and the most common production use.

Summarisation — condense for a human further down the workflow.

Drafting — produce a reply for a person to review before sending.

What they are not good at here

Arithmetic. Totals, percentages, date differences. Use code.

Anything requiring current state the model was not given. It cannot check stock, or whether this customer already complained, unless you pass that in.

Consistency across runs without constraint. Free-form output varies. That is fine for drafting and unacceptable for routing.

Constrain the output

Every decision step should return something from a known set:

Classify the message into exactly one of: billing, technical, account, unclear. Answer with the single label and nothing else.

Then, in code, validate before acting:

if label not in ALLOWED:
    route_to_human(reason="unexpected label")

If the model returns something outside the set — and occasionally it will — you get a visible handoff rather than a silent misroute.

Confidence, honestly

Asking a model to rate its own confidence produces a number that is loosely related to correctness, not a calibrated probability. Use it as a triage signal, not a guarantee: below a threshold, send to a human. That is useful. Treating 0.9 as "90% likely correct" is not.

More reliable signals: does the classification agree with a simple keyword check? Is the input unusually short or empty? Has this sender always been billing? Cheap deterministic checks alongside the model catch a lot.

Repeatability

For decision steps, set temperature low. You want the same input to produce the same routing tomorrow. Variety is a feature when drafting and a defect when deciding.

And log the input, the output and the decision for every run. When someone asks why a message went to the wrong team three weeks ago, that log is the only way to answer — and without it you will be guessing at a system you cannot reproduce.