Lesson 6.4: Workflow or agent: choosing the simplest design that works
Learn how to choose between a single call, a workflow, a hybrid and a full agent using cost, reliability, coverage and testability, and when to move up or down.
By the end of this lesson you will be able to place a task on the spectrum from a single model call to a full agent, ask the questions that decide where it belongs, name the common workflow patterns, estimate cost and reliability for a workflow and an agent side by side, see when a hybrid beats both, and recognise the signs that a design should move up or down the spectrum. You will work out that a four-step workflow at 99 per cent per step succeeds 96.1 per cent of the time at ₹2.40 a task, while a nine-step agent succeeds 91.3 per cent of the time at ₹5.40, that sending 70 per cent of requests down the workflow and the rest to the agent gives 94.7 per cent success at ₹3.30, and that eight branches cover 90 per cent of requests where eleven are needed for 95 per cent. You should have read Lessons 1.1 to 1.3 and Lessons 5.1 to 6.3. No code is needed. The mathematics is powers, products and a logarithm.
This is the last lesson of the module, and it asks a question that a good engineer asks first and a beginner asks last: do you need an agent at all? An agent is the most flexible design, and that flexibility is paid for in cost, speed, reliability and the difficulty of testing. Many jobs that are described as agent problems are really workflow problems, and a plain workflow does them better. Choosing well is worth more than any technique in the previous lessons, because the best way to avoid a hard problem is not to have it.
The spectrum
Designs differ in how much of the path is decided by the person who built the system and how much by the model at run time. It helps to see them as points on a line, from most fixed to most free.
Design · Who decides the path · What it looks like · Typical useA single call · You · One prompt, one answer · Summarise, classify, rewrite, extract
A prompt chain · You · A fixed series of calls, each using the last result, with checks between · Draft, then check, then format
A routed workflow · You, with a model choosing a branch · A first call picks a path, and each path is fixed · Support requests of known kinds
A workflow with parallel parts · You · Fixed splits run together and are combined by code · Review each of ten documents, then merge
A workflow with a loop · You set the loop, the model judges when done · Generate, evaluate, improve, repeat up to a limit · Writing or code that must pass a check
An agent · The model · A loop in which the model chooses the next tool or action until it decides it is done · Open-ended tasks with unpredictable steps
A team of agents · Models, at several levels · Orchestrator and workers, as in Module 5 · Wide tasks with parts that need their own context
A workflow is any design where your code fixes the sequence of steps. An agent is a design where the model decides the sequence. The two are not rivals. Most good systems are workflows with a few model calls inside them, and some have one or two steps where an agent is allowed to roam.
The questions that decide
Five questions place a task on the spectrum. Answer them honestly, for the task as it really is.
1. Can you write down the steps in advance? If a competent person could give you a checklist that covers nearly every case, you have a workflow. If every case needs a different path, because what you find at one step decides what you do at the next, you may need an agent. Invoice matching has a checklist. Investigating why a customer's payment keeps failing may not.
2. How much do cases vary? If 80 per cent of cases follow three patterns, build those three paths. If the variety is endless, a workflow becomes an unmanageable tangle of branches. This is explored below.
3. How bad is a mistake? The more freedom you give a model, the harder it is to predict what it will do. Where mistakes are costly, prefer designs where each step is fixed and checked. Where mistakes are cheap, an agent's flexibility is affordable.
4. How much do cost and delay matter? An agent makes several calls, each carrying a growing history. A workflow makes a fixed number. If the user waits for the answer, or if you run a million tasks a month, the difference matters a great deal.
5. How will you test it? A workflow can be tested step by step, and each step has expected inputs and outputs. An agent can take many paths, so testing means judging outcomes over many examples. If you cannot yet say how you would test an agent on this task, you are not ready to run one.
A rough rule follows: use the simplest design that does the job well enough. Start at the top of the table, and move down only when a simpler design fails in a way you can name.
The common workflow patterns
Five patterns cover most workflows. Knowing them lets you assemble a design from parts you understand.
Chaining. Step one produces something, step two uses it, and so on, with a check between steps. Example: extract the facts from a complaint, check that all required fields were found, then draft a reply from the facts. If the check fails, stop or retry. Chaining trades speed for accuracy, since each call is simpler than one big call would be.
Routing. A first call classifies the input and sends it down one of several fixed paths, each tuned to its kind, as Lesson 5.3 described. Example: billing, delivery or product questions each get their own prompt and tools.
Parallelisation. Independent parts run at the same time and code combines them. Two forms are common: split a job into pieces, such as checking ten documents, or run the same task several times and take a vote or the best result, when a single answer is not reliable enough.
Evaluate and improve. One call produces a result, another judges it against criteria, and the first revises, up to a limit, such as three rounds. This works when you can say clearly what good looks like, for example "the code passes these tests" or "the reply includes the refund amount and the policy name".
Orchestrate and delegate. A lead call decides the pieces at run time and hands them to workers, as in Lesson 5.2. This is the most agent-like of the patterns, since the model chooses the pieces, but its structure is still fixed: plan, delegate, combine.
Most real tasks need two or three of these. A support system might route, chain within each branch and add an evaluate-and-improve step on the final reply. None of this is an agent in the sense of a model choosing freely among tools. All of it is still very capable.
What an agent costs
An agent's costs are easy to underestimate, because they do not appear in a demo. Four stand out.
More calls. A workflow of four steps makes four calls. An agent that averages nine steps makes nine, and some runs take thirty.
Growing context. Each step of an agent re-sends the history, as Lesson 7.2 of the AI Engineering track showed, so cost grows faster than the number of steps.
Lower reliability. Each step is a chance for a mistake, and the chances multiply. A step that is right 99 times in 100, repeated four times, gives 0.99⁴ = 0.961, or 96.1 per cent. Repeated nine times it gives 0.99⁹ = 0.914, or 91.4 per cent. Fewer steps means fewer chances to go wrong.
Harder testing and debugging. The path varies from run to run, so a failure may not repeat, and the cause is spread over a long trace.
Here is a worked comparison. A workflow has 4 fixed calls and an agent averages 9 steps for the same task. Each step is right 99 per cent of the time. Take an example price of ₹0.60 per call, ignoring that the agent's later calls are bigger, which makes the real gap wider.
The workflow succeeds 0.99⁴ = 96.1 per cent of the time and costs 4 × ₹0.60 = ₹2.40 per task, or ₹2.50 per successful task.
The agent succeeds 0.99⁹ = 91.4 per cent of the time and costs 9 × ₹0.60 = ₹5.40 per task, or ₹5.91 per successful task.
The agent is both less reliable and more than twice as costly. That does not make it wrong. It means it must be bought with something: coverage of cases the workflow cannot handle.
Predict first: a workflow has 4 steps and an agent has 9, each step right 99 per cent of the time, and each call costs ₹0.60. Suppose 70 per cent of requests are routine enough for the workflow and the other 30 per cent need the agent. If you send routine requests down the workflow and the rest to the agent, what are the overall success rate and the cost per task? Decide before reading on.
The success rate is 0.7 × 0.961 + 0.3 × 0.914 = 0.673 + 0.274 = 0.947, or 94.7 per cent. The cost per task is 0.7 × ₹2.40 + 0.3 × ₹5.40 = ₹1.68 + ₹1.62 = ₹3.30. Compare that with sending everything to the agent: 91.4 per cent success at ₹5.40. The hybrid is more reliable and 39 per cent cheaper, and it still handles the unusual cases.
The branch explosion: when a workflow stops working
A workflow has a weakness. Each kind of case needs its own branch. At first, a few branches cover most requests. Then the rest arrive in a long tail, each rare, each needing its own handling. The workflow grows branch after branch, and becomes costly to build and maintain.
Here is a way to see how fast. Suppose each branch you add handles a fixed share of the requests not yet covered. If each new branch removes one quarter of what remains, so 75 per cent stays uncovered, then after k branches the uncovered share is 0.75ᵏ. After 4 branches, 0.75⁴ = 0.316 remains, so 68.4 per cent is covered. After 8, 0.75⁸ = 0.100 remains, so 90.0 per cent is covered. After 12, 0.032 remains, 96.8 per cent covered. After 16, 0.010 remains, 99.0 per cent covered. To reach 95 per cent coverage, you need branches k such that 0.75ᵏ ≤ 0.05, which is k ≥ ln 0.05 ÷ ln 0.75 = 10.4, so 11 branches. Each branch costs about as much to build and test as the one before, but gives a smaller gain. The first four cover 68 per cent. The next four add 22 points. The next four add 7 points. The next four add 2.
That is the shape of the choice. A workflow is excellent for the head of the distribution, the common cases. An agent is attractive for the tail, the many rare cases, because one agent can handle them without a branch for each. The hybrid design above is the natural result: build the workflow for the common cases, and let an agent, or a person, take what falls through.
Signs that a design should move
Designs do not stay put. Two kinds of evidence say it is time to change.
Signs to move up toward an agent
The workflow keeps growing branches for rare cases, and the maintenance cost is climbing.
People hand-handle a large share of cases because the workflow cannot cope.
The right next step depends on what an earlier step found, in ways you cannot list.
The same task keeps needing new tools or sources, and each requires a rewrite of the flow.
When you see these, move only the part that needs it. Replace one step, or add one agent for the tail, and leave the rest as a workflow.
Signs to move down toward a workflow
The agent takes nearly the same path on most runs. Look at your traces. If 85 per cent of runs call the same four tools in the same order, you have a workflow that happens to be built as an agent. Write it as one and keep the agent for the exceptions.
Cost or delay is too high, and most of it is the agent deciding what to do next.
Failures are hard to reproduce, and the cause is the variation in paths.
Tests are too expensive to run, or you cannot get stable results.
Moving down is not a defeat. A path that has been discovered by an agent is a good candidate to fix in code, where it is faster, cheaper and more predictable.
Frameworks and the temptation to start big
Many tools make it easy to build a multi-agent system in an afternoon. Ease of building is not a reason to build. A demo with three agents chatting looks impressive, and then it must run a thousand times a day, cost a known amount, fail in understood ways and be changed safely by someone who did not write it. Start with the plainest design that could work. Write the simple version first, even if you expect to replace it, because it gives you a baseline: a result, a cost and a reliability against which any more complex design must prove itself.
A good habit is to build in this order:
1. A single call, with a good prompt. Measure it on a test set.
2. A chain or routed workflow, if the single call falls short. Measure again.
3. A loop or parallel parts, where one step needs improvement.
4. An agent step, only where the path truly cannot be fixed.
5. Several agents, only where context, parallelism or roles require it, as Lesson 5.1 argued.
At each stage, compare with the one before on the same test set for quality, cost, time and reliability. Move on only if the gain justifies the cost.
Three worked examples
Example 1: invoice matching
A finance team wants to match supplier invoices to purchase orders. The steps are known: extract the fields, look up the order, compare amounts, flag differences, write a note. 90 per cent of invoices follow this path. They build a five-step workflow, with a model call at the extraction and at the note and plain code in between, and a check after extraction that every required field was found. It succeeds on 96 per cent of invoices at ₹2.50 each. The remaining 4 per cent go to a person. A later experiment with an agent for the exceptions resolves about a third of them, saving the person some time. The agent handles only the tail.
Example 2: customer support triage
A support team's requests are varied. They begin with a router that sends each request to one of six branches, each a short chain. This covers 78 per cent of requests. Looking at the rest, they find a few kinds of problem that need several lookups in an order that depends on what each finds, such as a payment that failed for a reason hidden in three systems. They add one agent, with read-only tools to those systems, for the cases the router marks as "complex". The agent's findings go to a person, who decides. The agent runs on 22 per cent of requests and the workflow handles the rest. The design is a workflow with an agent in one branch.
Example 3: moving down
A research agent was built to answer market questions. After two months, traces show that for 80 per cent of questions it runs the same sequence: search the news, search filings, read three documents and write a summary with sources. The team rewrites that path as a fixed workflow with parallel searches. Cost per question falls from ₹14 to ₹5, time falls from four minutes to one and the results become more consistent. The agent remains for questions that do not fit, flagged by a classifier. The team found the workflow by watching what the agent did.
A design worksheet
1. Write the task and what a good result looks like.
2. Answer the five questions: can you list the steps, how varied are cases, how bad is a mistake, how much do cost and delay matter, and how will you test?
3. Start with a single call and measure it on a test set of 30 or more real cases.
4. If it falls short, design a workflow from the five patterns. Estimate steps, cost and success.
5. Find out how much of the work the workflow covers, and what the tail looks like.
6. For the tail, choose: a person, an agent step or more branches. Use the branch simulator to see what more branches would take.
7. If you add an agent, give it the smallest tool set and limits from the earlier lessons: steps, budget, approvals.
8. Compare each design on the same test set for quality, cost, time and reliability.
9. After launch, read the traces for paths that repeat, and fix them in code.
Common mistakes
Starting with an agent because it sounds modern. Start with the simplest design.
Using an agent where a checklist exists. A workflow is cheaper, faster and more reliable.
Building a huge workflow for a long tail. The last branches cost the most and gain the least.
Ignoring reliability arithmetic. Longer paths fail more often.
Comparing designs by demos. Compare on a test set of real cases.
Using agents everywhere in a hybrid. Give an agent only the step that needs it.
Never reading traces. They show which paths repeat and could be fixed in code.
Treating the first design as final. Move up and down as evidence arrives.
Adding several agents to fix a prompt problem. Improve the prompt and tools first.
Key takeaways
Designs run from a single call through chains, routing, parallel parts and loops to agents and teams of agents. In a workflow your code fixes the path. In an agent the model chooses it.
Five questions place a task: can you list the steps, how varied are cases, how bad is a mistake, how much do cost and delay matter and how will you test. Use the simplest design that does the job well enough.
The five workflow patterns are chaining, routing, parallelisation, evaluate and improve, and orchestrate and delegate.
Agents cost more calls, a growing context and lower reliability, since the chances of error multiply. A 4-step workflow at 99 per cent per step succeeds 96.1 per cent of the time at ₹2.40 a task. A 9-step agent succeeds 91.4 per cent at ₹5.40.
A hybrid is often best. Sending 70 per cent of tasks down the workflow and 30 per cent to the agent gave 94.7 per cent success at ₹3.30.
Workflows cover the common cases well and the long tail badly. Eight branches covered 90 per cent in the example and eleven were needed for 95 per cent.
Move up when branches multiply and people handle too much by hand. Move down when an agent takes the same path every time, and fix that path in code.
Build in order and compare each step with the last on the same test set.
Check yourself
1. In one sentence each, what is a workflow and what is an agent?
In a workflow your code fixes the sequence of steps. In an agent the model decides the sequence at run time.
2. Name the five common workflow patterns.
Chaining, routing, parallelisation, evaluate and improve, and orchestrate and delegate.
3. A workflow has 5 steps and each is right 98 per cent of the time. What is the chance it works end to end?
0.98⁵ = 0.904, about 90.4 per cent.
4. Each added branch leaves 80 per cent of uncovered requests uncovered. What share is covered after 5 branches?
1 − 0.8⁵ = 1 − 0.328 = 0.672, about 67.2 per cent.
5. Your agent's traces show 85 per cent of runs follow one path. What should you do?
Write that path as a fixed workflow, which is cheaper, faster and more predictable, and keep the agent for the exceptions.
6. Why is a hybrid often better than either a workflow or an agent alone?
The workflow handles common cases cheaply and reliably, and the agent covers the long tail that would need many branches, so you get both coverage and efficiency.
Try this
Set aside seventy-five minutes.
1. Choose a task you might give to an agent. Write it in two sentences.
2. Answer the five placement questions with evidence, not hope.
3. Write the simplest single-call version, run it on ten real cases and note where it fails.
4. Design a workflow from the five patterns, and count its steps. Estimate its reliability and cost with the first simulator.
5. List twenty real requests and sort them into kinds. How many branches would cover 90 per cent? Check with the second simulator.
6. Decide what handles the tail: a person, an agent step or more branches.
7. Write how you will compare the designs on the same test set, and what result would make you choose the agent.
A good result is a one-page design decision: where on the spectrum the task belongs, the numbers behind it and the plan to test it. That completes Module 6. Your agents can now connect to real systems, work with documents, involve people at the right points and be chosen against simpler alternatives. Module 7 turns to making them reliable and safe: evaluating agents, guardrails, security and runaway failures.
Tags: Agentic AI Workflows Agent design System design Cost and reliability