Blog · Chapter 02 · Agent development

Design the workflow before you write a prompt

A ten-step method for designing AI workflows, from splitting the work into steps to the hooks that keep agents in check.

The chapter in 25 seconds

Agent development is the heart of an AI application, and the longest chapter of the book. Its central idea is simple: design the workflow before you write a prompt. The book gives a ten-step method. Each step asks one question and leaves one written result.

The ten steps

  1. Define the steps. Split the work into fixed steps with clear inputs and outputs, and make the branches explicit.
  2. Deterministic or AI? For every step, use code if code can do it. Use AI for decisions and planning, for classification, scoring, summarization and generation, and for goal-driven work with automatic feedback.
  3. Choose the AI pattern. Use the least complicated pattern that does the work (see below).
  4. Select the components. Decide which prompts, tools, skills and sub-agents each agent needs, with a name and a description.
  5. Place humans. Add a human after every low-confidence critical decision, and before every action on the environment, such as sending an email or changing a file.
  6. Define memory. Separate the working memory of one run from the external memory that persists across runs.
  7. Design the context. For every LLM call, list exactly what goes into the context and which part of memory each item comes from.
  8. Design the components. Write the prompts, tool schemas, skills and sub-agent definitions as versioned files.
  9. Design external memory. After every run, save experience such as outcomes, corrections and lessons, so the next run starts smarter.
  10. Design hooks. Use linters, validators, guards and audit logs for the rules that must always hold, whatever the model decides.

The pattern ladder

Step 3 is where most over-engineering happens. The book orders the options from simple to complex:

Pattern Use it when
Single LLM call The task is done in one step: classify, extract, summarise, answer
LLM chain / RAG Fixed pre- or post-processing is known in advance, such as retrieval
ReAct agent The next tools or steps must be chosen at run time
Reflection agent An automatic quality signal (tests, rules, rubric) can judge the output
Deep agent A generated plan, unknown skills or tools, and actions on an environment
AI harness A persistent agent that keeps memory and works with you over time

Climb only when the simpler pattern demonstrably fails. If no pattern fits, the step is too big: split it.

Prompts, tools, skills and sub-agents

Where know-how belongs is one of the most practical decisions in the chapter:

  • know-how that is always needed goes in the prompt;
  • know-how that is needed sometimes, in cases that cannot be predicted, goes in a skill, loaded on demand;
  • access to the outside world goes in a tool;
  • context-heavy sub-tasks go to a sub-agent with its own clean context.

The workhorse architecture

In the book's claims example, twelve steps produce only two agents, and both are bounded. One is a read-only investigation agent with a step limit; the other drafts replies with at most three reflection rounds. Everything else is code, single LLM calls or RAG chains. A deterministic backbone with bounded AI steps is the enterprise workhorse: flexible where cases vary, and predictable everywhere else.

Key takeaways

  • Design before you prompt: ten steps, one design sheet.
  • Use code where it can do the work, and AI only where it must.
  • Choose the least complex AI pattern for every step.