Build flow and sequence: shipping an agent in the right order

In brief

Build an AI agent in this order: decide the task and what success looks like, try one plain model call first, add tools one at a time, let the model choose its own steps only where needed, write test cases, add safety limits, then launch small and improve. The order matters — it is the safety feature.

Most agent projects that fail don't fail because of the model. They fail because of the order: freedom given before testing, tools added before anyone defined the task. Here is the order that holds up in the real world.

Fig. 04 — the sequence is the safety feature

Advice from Anthropic and OpenAI points the same way: start with the simplest thing that could work, and add complexity only when a measured gap shows you need it [1] [2]. Turned into a build order, that looks like this:

  1. Define the task and what success looks like. Write the task in one sentence. Say how you'll know it's "done", and which mistakes you won't accept. If you can't write down what success means, you can't test for it — stop until you can.
  2. Start with one plain model call. One good prompt with the right context, nothing more. This is your starting point to beat — and a surprising number of "agent" problems are solved right here.
  3. Add tools, one at a time. Give the model only the tools the task really needs, each clearly described. A tool description is a prompt — write it with the same care [3].
  4. Fix the path before you free it. If you already know the steps, build them as a fixed workflow. Let the model choose its own steps only for the parts that are truly open-ended [1].
  5. Write your tests before adding freedom. Build the 20–50 test cases from the evaluation guide and run them after every change. Freedom you can't measure is freedom you can't trust.
  6. Add safety limits and human checks. Ask permission before anything that can't be undone. Cap how long the loop runs and how much it spends. Put a person in the loop wherever a wrong move would cost more than asking first [2].
  7. Launch small, watch what happens, improve. Real use finds the failures your tests missed. Feed them back into step 5.

The order is the safety feature: task, baseline, tools, loop, tests, limits — then ship.

Which step do teams skip?

It's step 5. Teams wire up tools and freedom in a week, demo the easy cases, and only learn the agent works 60% of the time after real users do. Testing feels like it slows shipping. In truth, it's the only thing that makes the later steps — more freedom, more tools, more trust — safe to take. The build flow is a loop, not a line: every real-world failure goes back into your tests and comes out as a better prompt, a clearer tool description, or a tighter safety limit.

Pencil and ruler resting on an architectural drawing
Plate 04 — the sequence is drawn before anything is built Photo — Sven Mieke, Unsplash

Sources

  1. Anthropic — Building effective agents, 19 Dec 2024
  2. OpenAI — A practical guide to building agents (PDF), 2025
  3. Anthropic — Writing effective tools for agents, Sep 2025

Frequently asked questions

What are the steps to build an AI agent?

Seven, in order: define the task and what success means; try one plain model call first; add only the tools you need; let the model choose its own steps only where the task is open-ended; build 20–50 test cases; add safety limits and human checks; then launch small, watch closely, and improve.

Should I build a workflow or an agent?

Build the simplest thing that works. If you already know the steps in advance, build them as a fixed workflow — it's cheaper, faster, and easier to predict. Let the model choose its own steps only for the truly open-ended parts, and only after a plain model call has proven not enough.

What guardrails does an AI agent need?

Ask permission before any action that can't be undone. Cap how many times the loop can run and how much it can spend. Add a human check wherever a wrong move would cost more than asking first. Do this before giving the agent more freedom — a safety limit added after an accident comes too late.