Skip to content
← All notes

How to build your first AI agent: start with the check, not the model

Most first agents fail the same way, and it is not the model. They fail because nobody wrote down what finished looks like, so nobody can tell when the agent is wrong. Six steps, in the order that avoids it.

Tools9 min read

Most first AI agents fail the same way, and the model is rarely the reason. They fail because nobody wrote down what finished looks like, so when the agent produces something plausible and wrong, nobody can tell.

The usual build goes outward from the exciting part. Pick a model, wire up some tools, write a long prompt, watch it do something impressive in a demo. Then it meets real work, gets a case slightly different from the demo, and quietly does the wrong thing with total confidence.

Build it the other way round. What follows is six steps, and the order is the point: the check comes before the agent, and the agent comes last.

What an AI agent actually is, in one sentence

An agent is a model running in a loop: it decides which tool to use next based on what the last one returned, and it decides for itself when the job is finished.

That separates it from the two things it is usually confused with. A chatbot answers once and stops. A workflow runs a fixed sequence of steps that you chose in advance. An agent chooses the steps.

Anthropic's own guidance on building agents draws exactly that line, and adds the part most tutorials leave out: agentic systems trade speed and cost for better performance on the task, and a great many problems do not need one at all. Deciding whether you need an agent is the first decision, and "no, a single well-written call will do" is a common and correct answer.

Step 1. Pick a boring task you already do by hand

Not an assistant that runs your business. A task with a clear start, a clear end, and a result you can check in about a minute: sorting a support inbox into three piles, pulling one figure out of twenty PDFs into a spreadsheet, drafting a reply from a template and your calendar.

The reason is feedback, not modesty. You already know what a good result looks like, so you will notice when it is wrong. An agent doing work you do not understand yourself is an agent you cannot supervise, and an unsupervised first agent is how people conclude that agents do not work.

Building an agent in the right order: a person first writing down what a finished result looks like and how they would check it, with the agent itself only assembled at the end.
The check comes before the agent, and the agent comes last.

Step 2. Write down what done means, before any code

One paragraph. What goes in, what comes out, and the three ways the result could be subtly wrong while still looking fine.

This is the step almost everyone skips, and it is the one that decides everything after it. That paragraph becomes three things at once: the instructions you give the agent, the condition it uses to decide it has finished, and the test you use to decide whether it worked.

If you cannot write the paragraph, you do not have an agent problem. You have a definition problem, and no model will solve it for you, because a model asked to do something undefined will cheerfully define it itself and you will not like its definition.

Step 3. Give it the fewest tools that finish the job

Every tool is another way for the agent to be wrong. Start with the minimum that completes the task, often just one thing to read and one place to write, and add a tool only once you have watched it fail for lack of it.

The descriptions of those tools are the real prompt. The model decides what to call almost entirely from each tool's name and description, so a vague description turns every decision into a guess. Anthropic's guidance makes the same point, arguing that tool definitions deserve as much engineering attention as the main instructions do.

Design them to be hard to misuse. Take a customer ID rather than a customer name that might match three people. Return a clear error rather than an empty result the agent will read as "nothing found". Small choices like these prevent more failures than any amount of prompt rewording.

Step 4. Make every action reversible, or put a person in front of it

When AI produced drafts, checking was free because it sat in the path: you could not send the thing without reading it. An agent that acts removes that step. A finished action arrives as a notification, and people acknowledge notifications rather than audit them.

So your first agent should either only read, or write to somewhere a person approves before anything leaves: a draft folder, a staging sheet, a queue.

Anything that sends, pays, deletes, publishes or commits gets an approval step, even when the agent is right nine times out of ten. Especially then, because that is exactly when people stop looking. Loosen it later, one action at a time, when you have evidence it is safe.

Step 5. Build the check before you build the agent

Collect ten to twenty real examples from your own history, each paired with the answer you would accept. That is your evaluation set, and it is the most important thing you will make.

Run the agent against all of them every time you change the instructions or a tool. Without it you are tuning by feel: you fix the case in front of you and silently break three others you are no longer looking at, which is how agents get worse while everyone believes they are improving.

Keep every failure and add it to the set. A growing list of cases the agent got wrong is the most valuable thing the whole project produces, because it is the only honest record of what the agent can and cannot do.

An agent being run against a set of real examples with known correct answers, each result marked right or wrong, and every failure kept and added back into the set.
Without a test set you are tuning by feel, and fixing one case breaks three.

Step 6. Start as a workflow, and let it earn the loop

A surprising number of tasks people build as agents are fixed sequences in disguise. If the steps are the same every time, write them down as steps, and use the model only at the points where judgement is actually needed.

Give it the loop, the freedom to choose its own steps, only once the path genuinely varies from case to case and a fixed sequence keeps breaking. Anthropic's guidance notes that the most successful implementations it has seen used simple, composable patterns rather than elaborate frameworks.

The asymmetry is worth remembering. You can always give an agent more autonomy later. Winning back trust after it did something expensive on its own is much harder.

What to build it with

Less than you would think depends on this. The major model providers all offer tool calling and a way to run an agent loop, Anthropic among them with its Agent SDK, and no-code automation tools can handle the workflow version from step 6 without any code at all.

Pick whatever your team can actually debug when it goes wrong at four in the afternoon. The first five steps decide whether the agent is any good; the framework mostly decides how pleasant it is to fix.

The hard part is not the code

Look back over the six steps and only one of them involves much software. The rest are writing down what done looks like, deciding what the agent may touch, and building a way to tell whether it worked.

That is the same skill as delegating to a person well: a clear brief, a definition of done, sensible limits on what they can do without asking, and a way to check the work without redoing it.

Which is why the people who build good first agents are very often the people who were already good at handing work to others. The model is new. Knowing what you are actually asking for, and being able to tell when you did not get it, is not.

Common questions

What is an AI agent?
A model running in a loop that decides which tool to use next based on the result of the last one, and decides for itself when the task is finished. A chatbot answers once, and a workflow runs a fixed sequence of steps chosen in advance; an agent chooses its own steps. Many problems do not need one, and a single well-written call is often the better answer.
How do I build my first AI agent?
Pick a boring task you already do by hand and can check quickly. Write one paragraph defining what done looks like and how the result could be subtly wrong. Give the agent the fewest tools that finish the job, keep its actions reversible or behind human approval, and build a set of ten to twenty real examples with known answers before tuning anything. Start it as a fixed workflow and only let it choose its own steps once the path genuinely varies.
Do I need to know how to code to build an AI agent?
Not for the simplest useful version. No-code automation tools can run a fixed workflow that calls a model at the steps needing judgement, which covers a lot of first projects. A true agent loop is easier with some code, but the hard parts, defining what done means and building a way to check the result, involve no code at all.
What is the difference between an AI agent and a workflow?
A workflow follows steps you decided in advance and uses a model only where needed. An agent decides its own steps as it goes. Workflows are more predictable and cheaper, agents are more flexible and cost more in time and money. Start with a workflow and move to an agent only when the steps genuinely vary from case to case.
What is the most common mistake when building a first AI agent?
Building outward from the model instead of inward from the definition of done. Without a written description of a correct result and a set of real examples to test against, there is no way to tell a plausible wrong answer from a right one, so the agent gets tuned by feel and quietly gets worse. Write the check first and the agent last.

PDP Quest exists because of the problem underneath all of these: when output stops indicating capability, you need another way to know who can actually do the work.

Keep reading

Three more notes on the same argument.