Unit 06.00: The parts that must not be improvised
A Flow is deterministic orchestration written in code. Deciding what goes in it is the same question as deciding what an agent should not improvise.
Rule, judgement, or action
Sort every step into one of three kinds. Anything with a writable rule goes in the flow. Anything that genuinely needs judgement goes to an agent. Anything that acts goes in code, after approval.
The code sorts a six-step support workflow.
STEPS = [
("decide which team handles this ticket", "rule exists", "code"),
("summarise the customer's complaint", "judgement", "agent"),
("check the refund is under the ceiling", "rule exists", "code"),
("draft a reply in house style", "judgement", "agent"),
("decide whether to escalate", "rule exists", "code"),
("send the reply", "action", "code, after approval"),
]
print(f"{'step':40} {'kind':12} runs in")
for step, kind, where in STEPS:
print(f"{step:40} {kind:12} {where}")
improvised = sum(1 for _, _, w in STEPS if w == "agent")
print(f"\n{improvised} of {len(STEPS)} steps genuinely need judgement")
# Everything with a writable rule goes in the flow. That is not a stylistic
# preference: a rule in code is testable, free, and identical every run, and
# the same rule in a prompt is none of those.
Two of six genuinely need judgement - summarising a complaint and drafting in house style. The other four have rules you could write on a whiteboard, and writing them down makes them free, identical every run, and testable.
The last row is the one people miss. Sending a reply is an action, and actions belong in code even though no judgement is involved - because an agent that can send is an agent that can send at the wrong moment.
The mistake this prevents
The mistake is treating the flow as scaffolding around the interesting part. The flow is where every guarantee lives. What is inside an agent can only ever be measured; what is in the flow can be proven.
Takeaway
Everything with a writable rule belongs in the flow, along with every action. Agents get the steps where enumerating the cases is the part you cannot do.
