Skip to content
Optimal Lab

AI Engineering · interactive

Agent patterns: workflow or agent?

Most “agents” in production are workflows: model calls wired together by your code. A true agent chooses its own next step in a loop. Run six patterns from Anthropic's Building Effective Agents and compare the cost of each.

Input

product notes

LLM call 1

draft

Code check

< 120 words?

LLM call 2

translate → es

Prompt chaining: The task splits into fixed steps, and each step is easier than the whole.

Pattern

model calls
2
wall time
~4s
predictable
high

Task: Write a launch email, then translate it to Spanish.

Step 1 of 3

  1. 1

    Draft the email

    One call does one job: write the English draft.

    Draft: 96 words.

  2. 2

    Check it in code

    A gate between calls catches a bad draft before it costs a second call.

    96 < 120. Pass.

  3. 3

    Translate it

    The second call only sees the checked draft.

    Spanish email ready.

Compare all six

Start at the top. Move down only when the simpler pattern measurably fails.

PatternWho decides the pathCallsWall timePredictable
Your code2~4shigh
Your code2~4shigh
Your code3~2shigh
A model plans, code runs it5~6smedium
Your code4~8smedium
The model, every turn4~8slow