By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
A finance team shipped an agent to process expense reports. Each report ran through a loop that chose its own steps. Six weeks later an auditor asked why two identical receipts produced different results. Nobody could explain the difference, because the path changed from run to run.
The loop was not broken. The team had picked the wrong shape. The steps were known, the order was fixed, and identical input had to produce identical output. A workflow would have been cheaper, faster and much easier to defend in an audit.
A workflow is a fixed sequence of steps that your code controls. A model call can sit inside any step. An agent is a loop in which the model chooses the next step at run time, calls tools, and decides when the task is done.
The difference is not sophistication. It is who owns the control flow. In a workflow you can draw the whole path before you write code. In an agent the path is discovered on the turn it happens. That is powerful and hard to test.
The exam calls this the workflow-versus-agent decision. Treat it as the first decision on any design question, because everything after it depends on the answer: your test strategy, your cost model and your guardrails.
| Signal | Pick a workflow | Pick an agent |
|---|---|---|
| Steps | Every step is known up front | The next step depends on what came back |
| Order | Policy fixes the order | The input decides the order |
| Failure | A wrong step is cheap to catch early | A wrong step is expensive and must be checked first |
| Testing | You can replay a fixed path | You test traces, bounds and invariants |
| Cost | A predictable number of calls | A range, capped by a step budget |
Score the three answers together, not one at a time. Two answers for a workflow usually settle it, even when an agent would be more interesting to build. The exam rewards the shape that fits the constraint, not the shape with the most autonomy.
Autonomy is not free. An agent pays for its flexibility in four currencies. It is slower, because each turn is another model call. It is more expensive, because turns multiply. It is harder to test, because the path is not fixed. It is harder to review, because a reviewer sees a trace instead of a function.
That trade is often correct. Incident triage, research and code repair all need real discovery. The mistake is paying the cost without writing down what the autonomy buys. If you cannot name the decision the model must make at run time, you have a workflow with extra steps and a wider cost range.
def choose_shape(task):
"""Decide the control flow, and record why a reviewer should accept it."""
if not task["steps_known"]:
return "agent", "the path is discovered at run time"
if task["steps_depend_on_results"]:
return "agent", "each step depends on what the last one returned"
if task["wrong_step_cost"] > task["flexibility_value"]:
return "workflow", "a wrong step is expensive and the path is known"
return "workflow", "a known path is cheaper to test and operate"
TASKS = [
{
"name": "expense_report",
"steps_known": True,
"steps_depend_on_results": False,
"wrong_step_cost": 9,
"flexibility_value": 1,
},
{
"name": "incident_triage",
"steps_known": False,
"steps_depend_on_results": True,
"wrong_step_cost": 4,
"flexibility_value": 8,
},
]
for task in TASKS:
shape, why = choose_shape(task)
print(f"{task['name']}: {shape} - {why}")When the work needs several paths at once, one loop is not enough. You build a small hierarchy. A manager or supervisor agent receives the request, splits it into jobs, and hands each job to a subagent.
A subagent is an agent in its own right: its own loop, its own tools, its own context window. It returns a result to the supervisor, not a transcript. The supervisor owns the plan and the final answer, and it usually does not run the tools itself.
The hierarchy does not change the loop. Every level reads stop_reason, runs tools, appends results and stops on end_turn. What changes is the scope of each loop. Step 13 covers why that scope is worth the extra call.
Use your own project, or a scenario you know well.
Key takeaways
Workflow vs agent is about who owns the control flow, not which is more advanced.
The next step depending on the last result is the strongest signal for an agent.
Known steps, fixed order and expensive mistakes point to a workflow with model calls inside.
An agent trades latency, cost and testability for flexibility; name what the flexibility buys.
A supervisor plans and delegates; subagents run narrow loops with their own context.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.