Wetel
Go back

Twelve workflow habits that save you later

A good kitchen is not the one with the best chef. It is the one where every jar is labelled, the knives go back in the same place, and the person on the late shift can find the stock without phoning anyone. None of those habits is clever. Each one saves ten minutes on a bad night.

Workflows are the same. An AI employee in Wetel follows a workflow: a graph of steps joined by arrows that a person on your team builds, tests and publishes. The first version always works on the happy path. What decides whether it is still easy to work with in six months is a set of dull habits applied from the first day.

Here are twelve, each with a rule, the reason, the documented mechanism and a link. For the case for a graph in the first place, read procedures you can read.

1. Give each workflow one job, and each step one job

Rule: one workflow per piece of work, and one task per step.

A workflow that handles refunds, delivery questions and job applications at once is hard to test, because every change touches everything. The same goes inside a step: the docs say not to combine extracting a value and writing a reply in one “clever” prompt, and to keep them as two steps even if that adds a hop, because you can then inspect each step’s output on its own.

When the work genuinely splits into specialists, the documented building block is the sub_agent step: it hands the turn to one or more other agents, each running its own session, and collects what comes back. A workflow also has a size ceiling (200 steps, 400 arrows), checked when you save a draft. A graph near that size is usually several jobs sharing one file.

See keep extraction and conversation in separate nodes.

2. Name every step for the person who reads the record

Rule: give every step a label a colleague would understand, such as “Look Up Order Status”, not “node_7”.

Every step has an id that arrows refer to and a label, which the docs describe as the human-readable name shown in logs and in the event stream your client receives while a session runs. When someone asks why a customer got a strange answer, they read the run record, which lists each step visited, in order. Good labels make that record read like a sentence.

See node shape and how to read a run record.

3. Give the classifier every label, and give the router somewhere to go

Rule: list every possible intent in the classifier’s prompt, set matchAnyOf, and always set a default path.

A router only sees what the classifier produced, and matches it to arrow labels by plain string equality. If the classifier’s prompt never mentions an intent, the router can never route to it. If the model answers in a full sentence instead of one word, nothing matches.

Three documented settings close those gaps. matchAnyOf on the classification step stores whichever valid label appears earliest in the model’s answer, even if it rambled. defaultTarget on the router says where to go when nothing matches; without it, the docs say execution simply does not advance past the router. And an optional circuitBreaker sends the conversation somewhere explicit, such as a hand-off to a person, after a set number of consecutive fall-throughs to the default.

One more: never set applyVoiceFormatting on a step that feeds a router or condition. “Speak naturally in short sentences” fights “respond with only one word”.

See the router reference and matchAnyOf.

4. Tell an extraction step it is a pipeline step

Rule: an extraction prompt says it is not talking to the customer, forbids any reply, and restates the output format.

The docs describe a recurring failure: a step asked to pull out one value, such as a booking date, drifts into answering what the conversation is about (“Your booking is confirmed!”), because the conversation around it is about a booking. Their fix, recommended for every extraction step from the start, is plain negative framing. If that still drifts, give the model the real list of valid values and ask it to copy one.

Pair the wording with a structural option. extractFirstInteger keeps only the first whole number in the answer, stored as a number, or 0 when there is none. Steps stream by default, and the docs say this option needs streamOutput: false; an extraction step’s output never reaches the customer directly anyway. Getting structured data out of a conversation covers this in full.

5. Draw a clear “nothing found” path

Rule: after every extraction, a condition step checks the value, and the false branch asks the customer one specific question.

The docs’ corrected order example extracts an order id, checks orderId > 0, looks the order up only if one was found, and otherwise replies: “I couldn’t find an order number in your message — could you share your order ID so I can look it up?”

Write number gates as > 0. A condition compares values without converting types, so the string '0' is not the number 0, and > 0 also fails closed if the value turns out to be text. Two more documented details make gates safer. A condition that names a variable the context does not hold takes the false branch instead of failing the run. So put the branch that calls out to another system on true, and an unanswerable check then takes the branch that does nothing.

See Example 3 and the condition reference.

6. Label the success and failure paths of tool and action steps

Rule: every tool or action step that calls another system gets a success arrow and a failure arrow.

By default, every arrow leaving a tool or action step fires once the step finishes, and an unhandled failure fails the whole run. The customer then gets a generic “Sorry, I ran into a problem” reply. With a labelled pair, a failure (a timeout, a connection error, an arguments template that did not render) follows the failure arrow instead, and the error message is written to _lastNodeError for a later step to use. A failure arrow without a matching success arrow is refused at publish.

On the failure branch, say something useful: what happened in plain words, and what happens next. When an AI employee fails, what the customer sees has examples.

See success/failure edges on the tool step and on the action step.

7. Put a step’s instructions and its data in the prompt template

Rule: leave systemPrompt unset on llm steps; write instructions and {{variables}} together in promptTemplate.

This one fails silently. On an llm step, systemPrompt is not rendered and is used instead of the rendered promptTemplate, not alongside it. Set both, and the data you injected into the template never reaches the model. The docs describe the result: no error, every step marked completed, and a confident answer invented without the data you fetched. They reserve systemPrompt for the rare step whose instructions are static and need no data at all.

See the systemPrompt gotcha.

8. Decide the shape of every tool result before a customer sees it

Rule: never write a raw tool result straight into a reply without deciding its shape.

A tool step’s output variable holds the plain-text form of what the connected system returned. If that system returns JSON as text, writing {{outputVar}} into a reply leaks the whole JSON envelope to the customer. The docs describe two supported choices: pull out the human-readable field from the parsed copy the tool step also writes (_{outputVar}Structured), or deliberately send a JSON envelope your own front end parses, using the jsonString helper.

And when a result is already good, readable text, pass it through: the docs advise against an extra model step that only paraphrases, which adds cost and a chance of changing the meaning.

See tool results: raw text vs. structured extraction.

9. If you draw a loop, give it a way out

Rule: set maxVisits on every step inside the loop, and add a loop_exhausted arrow to a step that says something useful.

A step runs once per run unless you set maxVisits (up to 100). The docs’ retry example shows the easy mistake: if a step that speaks between attempts keeps the default of one visit, the second attempt silently stops at it. And without a loop_exhausted arrow, a step that declared maxVisits and is reached again fails the run. With one, the run follows it to a graceful message, such as a hand-off to a colleague.

See loops and re-entry.

10. Test as a draft, with real phrasing, and save a baseline first

Rule: run every change as a draft in a test session, and save a real run as a regression scenario before touching a classification step.

Every edit is saved to a draft; customers keep getting the published version until someone publishes. A test message sent with testDraft: true runs the draft instead. The docs describe a simulated mode only for approval steps, so plan as if tool, action and webhook steps run for real, and point them at test records first.

Test extraction prompts on varied real phrasing, not your first example. Before a risky edit to a classification step (a new prompt, a different model), capture a completed run as a regression scenario, then replay it against your draft. Pass or fail compares the path taken, not the wording, so it catches a step that quietly starts choosing a different branch.

See how to try a workflow safely before customers see it and regression scenarios.

11. Keep your own copy of each published graph

Rule: before every publish, save the exact nodes and edges you sent, in your own source control.

Publishing increases the workflow’s version number, but the docs say earlier versions are not kept as snapshots you can fetch. The nodes and edges you save are also a full replacement of the graph, not a merge. So if a new version misbehaves, your own copy is the only way to put the old one back.

See deployment tips for production.

12. Add an approval step where a person must decide

Rule: decide which actions need a person, and put an approval step in front of each one.

Approval is not on by default; it is a step you add. An approval step pauses the run until a workspace owner approves or rejects it, optionally correcting fields you allow. If nobody decides in time (72 hours by default, at most 14 days), the run follows an expired arrow. All three arrows, approved, rejected and expired, are required. Owners get an in-app notice; email notice is not sent yet, and the only approver role today is the workspace owner. In a draft test you can simulate each outcome without opening a real request.

flowchart LR
X["llm: extract refund amount"] --> C{"condition: amount > 0"}
C -- "true" --> P{"approval"}
C -- "false" --> Q["response: ask for the amount"]
P -- "approved" --> A["action: issue refund"]
P -- "rejected" --> N["response: declined"]
P -- "expired" --> E["response: a colleague will follow up"]

Because the step sits in the graph, anyone can see which actions wait for a person. See designing approval steps people actually read and the approval walkthrough.

What these habits do not do

None of this makes a model’s answers correct. A classification step can still pick the wrong label; an extraction step can still read the wrong number. We publish no accuracy figure for any workflow. What the habits give you is a procedure a person on your team can read, test, roll back and supervise, and a record that shows where something went wrong. Like the labelled jars, they matter most on the night something breaks.

The full list, with every gotcha behind these habits, is in the workflow best practices.


Share this post:

Next Post
Why we label everything live, being built or direction
Previous Post
Serving many customers' AI employees from one backend