Grokking Agentic Design Patterns
Vote

0% completed

​

Workflows vs Agents: The First Design Decision

The Deciding Question

The Three Signals

What the Simpler Option Saves

Five Briefs, Worked

Mixing and Moving Between Designs

Single Agent Before Anything Larger

Key Takeaways

Practice Questions

Two customers write to the same store one morning. The first writes, "Where is my order?" The second sends the blender message: the item arrived broken, the replacement arrived broken, and the customer believes the store charged twice.

Both messages are unstructured text, and both need a model to read them. The first has steps that you could write down before reading it: sort the message, look up the order, and reply with the delivery date. The second does not, because you cannot know that the payment records matter until you have read the tickets.

That difference is the first decision in any agent design, and it is made per task rather than per product.

The Deciding Question

Can you write the steps down before you read the input? If you can, the task is a workflow, however complex its steps are. If the next step depends on what an earlier step found, and the possible sequences are too many to write, the task may need an agent.

Anthropic draws the same boundary: agents suit "open-ended problems where it's difficult or impossible to predict the required number of steps", and that "workflows offer predictability and consistency for well-defined tasks".

Two simpler questions come first: can ordinary code decide the task, and can one model call complete it? The diagram orders the choices from least autonomy to most, and you stop at the first one that fits.

Four questions in order, each leading to the simplest design that fits the task.
Four questions in order, each leading to the simplest design that fits the task.

An agent appears only after three simpler designs are rejected, and no path reaches the multi agent box directly.

The Three Signals

OpenAI's practical guide to building agents names three signals that may justify an agent: "complex decision-making", "difficult-to-maintain" rules, and "heavy reliance on unstructured data". If a use case does not clearly meet these criteria, the guide adds, "a deterministic solution may suffice". A deterministic solution is one in which code fixes every step, so the same input always takes the same path.

Complex judgment means a decision that has exceptions and depends on context. The guide's own example is refund approval in customer service. The test is whether two competent employees would need to read and weigh several records before deciding. One difficult decision does not pass on its own, because one model call inside a workflow can make it.

Rules are hard to maintain when every new case changes the code. Suppose Desk handles 6 request types, and a customer may raise any one or any two in a message. The autonomy spectrum lesson counted 21 paths for this. With 10 types, the count becomes 55. The test is whether adding branches takes more of the team's time than anything else.

Unstructured input means text without fixed fields, such as messages, emails, and documents. This is the most frequently misread signal. A model is needed to read such text, but a model is not an agent. "Where is my order?" is unstructured, and a workflow handles it.

The signals do not replace the first question. A task whose steps can be written in advance is a workflow, even with all three signals. For the other tasks, the signals show whether the extra cost has a real reason.

What the Simpler Option Saves

Anthropic states the trade-off: "Agentic systems often trade latency and cost for better task performance."

Suppose the workflow's sorting call sends 1,000 tokens and its reply call sends 1,500. The agent uses this course's standard inputs, which start at 6,000 tokens and add 1,800 per step. Suppose a model call takes 3 seconds, a tool takes 1 second, and each model step succeeds 95 percent of the time.

MeasureOrder status: workflowOrder status: agent, 3 stepsBlender: agent, 6 steps
Model calls2, always3, and it varies6, and it varies
Tokens sent2,50023,400 (6,000 + 7,800 + 9,600)63,000
Time7 seconds (2 x 3 + 1)11 seconds (3 x 3 + 2)23 seconds (6 x 3 + 5)
All model steps succeedAbout 90 percent (0.95^2)About 86 percent (0.95^3)About 74 percent (0.95^6)
Upper limit on tokens2,500690,000, at 25 steps690,000, at 25 steps

On the order status message, the agent sends about 9 times the tokens, is slower, and adds nothing the customer can see. The last row may matter most: the workflow's cost is fixed, while the agent's is bounded only by its limit. You can also test each workflow step separately, while two agent runs on the same message can take different paths.

The blender message has no workflow column, because a workflow cannot resolve it. It can only give a wrong answer based on one part or pass the message to an employee, whose time is also a cost.

Five Briefs, Worked

BriefSteps known in advance?Complex judgment?Rules hard to maintain?Unstructured input?Design
Decide whether an order falls inside the 30-day windowYesNoNoNoOrdinary code, no model
Extract the order number and reason from each emailYes, one stepNoNoYesDirect call
Tell a customer where an order isYesNoNoYesWorkflow
Resolve any support message, including the blenderNoYesYesYesSingle agent
Review a business customer's 18-month invoice disputeNoYesYesYesSingle agent first

The extraction brief has one signal and needs no loop. One call with a fixed output format reads the unstructured input, and your code then tests that the order number exists.

The refund window needs no model. Comparing two dates has one correct answer, and a model would make it slower, more expensive, and occasionally wrong. This remains true when the same date check is part of an agent's refund tool.

The invoice dispute passes every test, and it still starts as a single agent. The autonomy spectrum lesson showed why thousands of records may exceed what one model call can read. First give the agent tools that filter records and return totals. If the records still do not fit, you have a measured reason for a lead agent and workers.

Mixing and Moving Between Designs

The decision belongs to a task, so one product usually contains several designs. Suppose that of every 100 messages, 80 are simple and 20 are difficult.

DesignCalculationTokens per 100 messages
Every message goes to the agent80 x 23,400 + 20 x 63,0003,132,000
Sort all, workflow for simple, agent for difficult100 x 1,000 + 80 x 1,500 + 20 x 63,0001,480,000

The mixed design sends about 47 percent of the tokens. Its new risk is a wrong sort, which sends a difficult message into a workflow that cannot handle it, so the workflow needs a way to pass a message on. The routing lesson covers that design.

One sorting call sends simple messages to a workflow and difficult messages to the agent, with a path from the workflow to the agent.
One sorting call sends simple messages to a workflow and difficult messages to the agent, with a path from the workflow to the agent.

The arrow from workflow to agent gives a wrongly sorted message a way to reach the agent.

The decision can also change over time, in either direction:

  • From agent to workflow. Suppose your records show that 90 of 100 runs on a request type use the same three tools in the same order. Write that sequence as a workflow, and keep the agent for the other 10.
  • From workflow to agent. Suppose more and more messages reach the workflow's "other" branch, or each release adds branches. That is the second signal, now measured.

Single Agent Before Anything Larger

Once a task needs an agent, build the single agent with tools before anything larger. OpenAI's guide advises: "maximize a single agent's capabilities first". More agents add complexity and overhead, while "often a single agent with tools is sufficient".

Anthropic reports that multi agent systems use about 15 times the tokens of a chat interaction, against about 4 times for agents. A multi agent design therefore needs a reason that one agent cannot satisfy, not just a clean division of labor in a diagram.

Key Takeaways

  • Ask first whether ordinary code or one model call can do the task. Then ask the deciding question: can you write the steps down before you read the input? If you can, build a workflow.
  • Complex judgment, rules that are hard to maintain, and unstructured input are signals that support the decision. Unstructured input alone needs a model, not an agent.
  • A workflow's cost and path count are fixed, while an agent's are bounded only by its limits. An agent's gain is that it handles requests that no branch anticipated.
  • Make the decision per task, mix designs in one product, and revisit it when your records show a change.
  • Build the single agent with tools before anything larger.

Every design still involves many other decisions, and a team can overlook one until it causes a failure. The design worksheet records them in a fixed layout, with one row for each question that every agent design must answer.

Practice Questions

1. A team wants to translate each product page into five languages and then test each translation against a glossary. Should this be an agent?

<details><summary>Show answer</summary>

No, it is a workflow. The steps are known before any page is read, and they do not depend on what an earlier step finds. Your code, not a model, decides whether a failed glossary test repeats a step.

</details>

2. A brief says, "The input is free-form customer email, so we need an agent." What is wrong with that reasoning?

<details><summary>Show answer</summary>

Unstructured input requires a model, not an agent. A direct call or a workflow step can read the email. An agent is justified only if the next step depends on what earlier steps find.

</details>

3. Using this lesson's inputs, what happens to the token comparison if the agent needs 6 steps instead of 3 for every simple message?

<details><summary>Show answer</summary>

All-agent cost rises to 6,300,000 tokens per 100 messages. Each of the 100 messages then costs 63,000 tokens, while the mixed design stays at 1,480,000 if its agent runs still take 6 steps. The all-agent design now sends more than 4 times as many tokens.

</details>

4. Records show that most runs on returns use the same four tools in the same order, while a few do something different. What should the team do?

<details><summary>Show answer</summary>

Write the common sequence as a workflow, and send the rest to the agent. The common path gains a fixed cost and steps that can be tested separately. The agent keeps the cases that do not fit.

</details>

Reading Progress

0%


Vote for new content

On This Page

The Deciding Question

The Three Signals

What the Simpler Option Saves

Five Briefs, Worked

Mixing and Moving Between Designs

Single Agent Before Anything Larger

Key Takeaways

Practice Questions