Lesson 1 / 25

Workflow or Agent?

Choose between a fixed workflow and an autonomous agent and start with the simplest option that works.

Two kinds of systems

A workflow follows steps you wrote in code: the model fills in each step but you control the path. An agent decides its own next step in a loop, using tools until it finishes. Agents are flexible but slower, costlier and harder to predict.

From one prompt to a system

Reliable agent systems are built from a few simple patterns that you combine, not from one giant prompt.

Four connected patterns of increasing autonomy.
Figure 1.1 — From fixed chains to autonomous loops.

Train vs taxi

A train follows fixed tracks: predictable and cheap for a known route. A taxi can go anywhere, but you pay more and need a driver you trust. Use the train whenever the route is known.

Start simple

Try a single well-written prompt first, then a short chain, and only then an agent loop. Add complexity only when measurements show the simpler version falls short.

Quick check: Who decides the next step in a workflow?

  • The model alone, every time
  • The code you wrote
  • The user at random
  • The operating system
Answer

The code you wrote — In a workflow the path is fixed by code; in an agent the model chooses the path.