WEBVTT

NOTE AI Engineering Visualised: https://understandingdata.com/ai-engineering-visualised/workflow-versus-agent/

1
00:00:00.047 --> 00:00:14.274
One refund email can go down two lanes: a fixed workflow that runs the same four steps in the same order every time, or an agent loop, where the model picks each next tool from what the last one returned.

2
00:00:14.274 --> 00:00:31.259
Trace the happy path, where the email names order A-2207: the workflow looks it up, fetches the refund policy and makes one model call on 211 tokens, while the agent takes three calls and 896 tokens to reach the same answer.

3
00:00:31.259 --> 00:00:46.972
The part people miss is where those tokens go: every agent call resends the email, the tools and each result so far, so when the steps are known, the loop pays four times as much to make the choices the workflow already hard-codes.

4
00:00:46.972 --> 00:01:01.758
Now take the order number out: the workflow's first step finds no id and stops, but the agent searches by Maya's email, sees two orders, picks the blender and replies in four calls, because what came back changed its next step.

5
00:01:01.758 --> 00:01:16.454
Here is the failure mode: the policy service times out on every call, so the workflow stops at that step and hands off at once, while the agent calls the same lookup five times, each call longer than the last.

6
00:01:16.454 --> 00:01:31.869
Only the budget stops it, at six calls, with no reply and 2,159 tokens sent, because the loop's natural stop is the model choosing to answer, and a timeout that says it can be retried never gives it a reason to.

7
00:01:31.869 --> 00:01:43.152
So use a workflow when the steps are known, and a loop only when what comes back decides the next step, with a budget, a stop condition and a person to hand off to.
