Grokking Agentic Design Patterns
Vote

0% completed

​

The Autonomy Spectrum: Direct Call, Workflow, Single Agent, Multi Agent

The Running Example

Direct Call

Workflow

Single Agent

Multi Agent

Comparing the Four Designs

Choosing a Position

Key Takeaways

Practice Questions

A language model is a program that reads text and writes text in reply. There are four ways to put one into a product:

  • Send it one request and use the answer (a direct call).
  • Run it inside steps that your code fixes in advance (a workflow).
  • Let it choose its own next step, over and over, until the task is done (a single agent).
  • Divide one task among several such agents (a multi agent system).

These designs differ mainly in who decides what happens next. In a direct call, nothing happens next. In a workflow, your code decides. In an agent, the model decides, within limits that your code enforces. The share of those decisions given to the model is its autonomy, and the four designs form a range called the autonomy spectrum.

More autonomy lets a product handle requests that nobody planned for, but it also makes the product harder to predict, harder to test, and more expensive to run.

The four designs, from least model autonomy to most.
The four designs, from least model autonomy to most.

Look at the middle of each column, which names who chooses the next step. Then read the bottom lines from left to right: the design becomes harder to predict and more expensive to run.

The Running Example

Desk is a customer support assistant for an online store, and it appears throughout this course. Here is a message that Desk receives:

My blender arrived broken. You sent a replacement, and it is broken too. I also think you charged me twice. Please refund me.

To resolve it, someone must read the order, the earlier support tickets, the payment records, and the refund policy, then issue any refund and reply.

Direct Call

A direct call sends one request to the model and uses the one response it returns. For Desk, your code would send the message and the refund policy and ask for a draft reply, and an employee would look up the order. The model knows only what your code sent, so it cannot tell whether the customer was charged twice.

A direct call is the right design when the request already contains everything the model needs, as when you summarize a document or sort a message into a category. It is also the cheapest design: one model call per input.

Workflow

A workflow is a fixed sequence of steps written in your code, in which some steps call the model and the others are ordinary code. A Desk refund workflow asks the model to sort the message into a category. Code then fetches the order and applies the refund rule, and the model writes the reply.

A Desk refund workflow. Your code wrote every step and every branch.
A Desk refund workflow. Your code wrote every step and every branch.

Notice that the model appears in only two places, and neither one chooses the next step. Its category can select a branch, but only a branch that a developer has already written. This makes a workflow predictable: you know every path and the maximum number of model calls.

The limitation shows on our message. The workflow treats it as one refund request, so it never examines the replacement or the duplicate charge. You could add a branch for that combination, but combinations grow quickly. Suppose Desk handles 6 types of request, and a customer can raise any one or any two of them in a message. That is 6 single types plus 15 pairs: 21 paths to write and test.

Single Agent

A single agent is one model running in a loop: it chooses an action, your code performs the action, the model reads the result, and it chooses again. The loop ends when the model decides that the task is finished or when a limit set by your code stops it. The actions come from tools, which are functions your code offers to the model, such as one that looks up an order. The model can only ask for a tool; your code runs it.

A single agent. The model chooses each action, and your code performs it.
A single agent. The model chooses each action, and your code performs it.

Notice that every action passes through your code, which is where limits and approvals are enforced. One possible run on our message, with one model call per step:

StepThe model choosesThe result
1Look up the orderDelivered 12 days ago; one replacement shipped
2Read the support ticketsThe replacement was reported broken yesterday
3Check the payment recordsTwo identical charges, two minutes apart
4Read the refund policyBroken items qualify within 30 days; duplicate charges are always refunded
5Request a refund for both chargesHeld for an employee, who approves it
6Reply to the customerTask finished

Nobody wrote this sequence in advance, and a simpler message would take fewer steps through the same loop. That flexibility is the reason to build an agent, and it has three costs:

  • Variable cost. The number of steps is unknown until the run ends. A token is a small piece of text, about three quarters of an English word, and providers charge by the token. Anthropic reports that agents typically use about 4 times the tokens of a chat interaction.
  • Spreading errors. A wrong choice at step 2 affects every later step.
  • Harder testing. Two runs on the same message can take different paths.

Step 5 shows an important distinction. Autonomy describes who chooses the next step, not whether the agent acts without supervision. Desk chose to request the refund, but an employee approved it. Whether an action needs approval is a separate decision for each tool.

Multi Agent

A multi agent system divides one task among several agents, each with its own instructions, tools, and record of the work so far. The blender message does not need this design. Suppose instead that a business customer disputes every invoice from the past 18 months, and the records are too many for one model request. A lead agent can give the payment records, the delivery records, and the contract to three workers, and each returns a short summary.

A lead agent divides a large dispute among three workers, each with its own tools.
A lead agent divides a large dispute among three workers, each with its own tools.

Notice that the lead receives short findings, not the records. This keeps its work small, but a detail left out of a summary is lost to the lead and to every other worker.

Anthropic reports that multi agent systems use about 15 times the tokens of a chat interaction. That cost is justified when the work is too large for one agent, when the parts need different tools or permissions, or when the parts can run at the same time. Otherwise, a single agent is better.

Comparing the Four Designs

DesignWho chooses the next stepModel calls in our exampleHandles unplanned requestsMain risk
Direct callNobody1NoMissing information
WorkflowYour code2Only on written branchesToo many paths to maintain
Single agentThe model6, and it variesYes, within its toolsWrong choices that spread
Multi agentSeveral modelsSuppose 28 for the dispute (lead 4, three workers 8 each)Yes, for larger tasksDetails lost between agents

Choosing a Position

Choose the least autonomy that solves the problem. Anthropic gives the same advice: "we recommend finding the simplest solution possible, and only increasing complexity when needed."

Products often call a system an "agent" loosely. Two questions classify it: does the system repeat its steps until the task is done, and does the model choose the next action? If either answer is no, it is a workflow or a direct call, and it should be designed and tested as one.

The position belongs to a task, not to a whole product. Desk can send common requests through a workflow and only difficult ones to an agent. Suppose 80 of every 100 messages are simple: sorting costs 100 calls, the simple replies 80, and the 20 difficult messages 6 agent calls each, for 300 in total. Sending every message to the agent, at 3 steps for a simple one, would cost 360.

Key Takeaways

  • The four designs are a direct call, a workflow, a single agent, and a multi agent system. They differ mainly in who chooses the next step.
  • In a workflow, the model can fill in a step or select a branch, but your code wrote every path.
  • An agent is a model running in a loop, choosing its next action from tools that your code offers and performs.
  • Autonomy over the next step is separate from permission to act.
  • Choose the least autonomy that solves each task, and mix positions within one product when the tasks differ.

The next lesson, The Agent Loop, examines the loop at the center of every agent, including how it stops.

Practice Questions

1. A system asks the model to write a summary, checks the length with code, and asks the model to shorten the summary if it is too long. Is this an agent?

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

No, it is a workflow. The system repeats a step, but your code decides when to repeat. The model never chooses an action.

</details>

2. Why can a single agent handle the blender message when the refund workflow could not?

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

The agent chooses its steps from what it reads. After it sees the replacement and suspects a duplicate charge, it reads the tickets and the payment records. The workflow follows only the steps written for a refund.

</details>

3. An agent can issue refunds, but every refund must be approved by an employee. Does the approval make it a workflow?

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

No, it is still an agent. The model still chooses its next action in a loop. The approval limits what the refund tool may do, which is separate from who chooses the next step.

</details>

4. Suppose Desk handles 10 request types, and a customer can raise any one or any two in a message. How many workflow paths would you need to write and test?

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

55 paths. There are 10 single types and 45 distinct pairs (10 times 9, divided by 2). This growth is one signal that a task may need an agent rather than more branches.

</details>

Reading Progress

0%


Vote for new content

On This Page

The Running Example

Direct Call

Workflow

Single Agent

Multi Agent

Comparing the Four Designs

Choosing a Position

Key Takeaways

Practice Questions