Skip to content

How to Build an AI Agent: 7 Steps From Process to Production

How to build an AI agent that does real work: pick one process, write it down, choose a stack, add tools and checks, then run it in shadow mode first.

Short answer

To build an AI agent, start with one repeating process, write it down as a short SOP, and define the single input and output. Then pick a stack (n8n for no-code, Claude Code or an SDK if you write code), give the model only the tools that job needs, test it on 20 real past cases and run it in shadow mode before it acts on its own. The model is the easy part; the process, the tools and the checks are the build.

Key takeaways

  1. An AI agent is a model in a loop with tools. Building one is mostly deciding what it may touch and when a person checks it.
  2. Start from a process, not a tool. Write the SOP before you open n8n or Claude Code.
  3. Give the agent the fewest tools that still get the job done. Each extra tool is another way to go wrong.
  4. Test on 20 real past cases before launch, then run it in shadow mode next to the person who does the work today.
  5. Plan the failure path from day one: retries, a human queue and a log of every run.

Most guides on how to build an AI agent start with a framework. Install this library, wire up that vector database, pick a model. Two hours later you have something that answers questions in a terminal and does nothing for your business.

I build agents the other way around. Process first, tools second, model last. I've shipped 35+ agents into real businesses, and the order of these steps is the part I'd defend hardest.

What is an AI agent, in plain terms?

An AI agent is a language model running in a loop: it reads a task, decides what to do next, calls a tool, looks at the result and repeats until the job is done. The tools are what make it an agent. Without them it can only talk.

Anthropic draws a useful line in its guide "Building effective agents". Workflows follow a path you defined in code. Agents decide their own path and tool use as they go. Most agents that work in a business are a mix: a fixed workflow with one or two spots where the model gets to decide.

That matters for how you build. The more freedom you give the model, the more ways it can go wrong. So the job isn't to make the agent as smart as possible. It's to give it exactly enough room to do one job.

How do you build an AI agent, step by step?

You build an AI agent in seven steps: pick the process, write it down, define the input and output, choose a stack, give it tools, test it on real cases and run it in shadow mode. Here's the full sequence:

Step What you do What you have after
1. Pick one process Choose a task that repeats often and has clear rules One job with a name
2. Write the SOP Document how a person does it today, including exceptions A one-page process
3. Define input and output Decide what starts a run and the one thing it delivers A clear contract
4. Choose a stack n8n, Claude Code or an SDK, based on who maintains it A place to build
5. Add tools and instructions Connect only what the job needs; write the system prompt A working first version
6. Test on real cases Run 20 past examples and score the output A list of what breaks
7. Shadow mode, then launch Run next to a person, then hand over with a checkpoint An agent in production

The rest of this article walks through each step.

Step 1: Which process should your first agent take on?

Your first agent should take on a task that happens often, follows rules you can explain, and that the person doing it today would gladly hand off. Frequency gives you test cases. Clear rules give the model something to follow. Willingness means you'll get honest feedback.

I score candidates 1 to 5 on those three questions. Anything at 12 or more out of 15 is a go. Below 9, park it. I wrote up the full method in how to choose which process to automate first.

Good first agents are boring on purpose. Sorting inbound email. Drafting replies to sales inquiries. Pulling numbers from a sheet into a weekly summary. If you need ideas, these ten AI agent examples are all narrow enough to start with.

Step 2: Why write the process down before you build?

You write the process down first because an agent can only be as consistent as the instructions it gets. When each colleague handles the task differently, the agent copies a mix of their habits.

Keep the SOP short. One page is plenty. It should answer:

  • What starts the task?
  • Which information does the person look up, and where?
  • What decisions do they make, and on what basis?
  • What are the common exceptions, and what happens then?
  • What does a finished result look like?

This document becomes most of your agent's instructions later. It's the most valuable hour you'll spend on the whole build.

Step 3: What starts a run, and what does it deliver?

Every agent needs one clear input and one clear output. The input is the trigger: a new email, a form submission, a row in a sheet, a schedule. The output is a single deliverable: a label, a draft, a record in your CRM, a message in Slack.

Write the output as a format, not a vibe. "A reply draft" is vague. "A reply draft under 150 words, in our tone, with one proposed next step, saved as a draft in Gmail" is something you can test.

If you find yourself listing three outputs, you have three agents. Build the first one.

Step 4: Which tools and stack should you use?

Choose the stack based on who will maintain the agent, not on what's newest. The model inside matters far less than whether someone on your team can open it and fix it in six months.

Stack Best for Trade-off
n8n (or a similar visual tool) Business teams, triggers from email, forms and schedules Complex logic gets messy on the canvas
Claude Code Operators who want an agent with memory, skills and access to local files Runs where you run it; needs a technical owner
An agent SDK in Python or TypeScript Developers shipping an agent inside a product Full control, but you build logging and retries yourself

I use both n8n and Claude Code. n8n for anything that runs on a trigger without me. Claude Code for work where I'm in the loop, like email triage, meeting briefs and follow-ups. If you go the Claude Code route, skills are where your SOP from step 2 lives.

For the model itself: pick one current frontier model and move on. Swapping models rarely fixes an agent that has an unclear process.

Step 5: How do you give an AI agent tools and instructions?

You give an agent tools by connecting it to the specific actions the job needs, and instructions by turning your SOP into a system prompt. Both should be as narrow as possible.

For tools, follow least access. An agent that drafts email replies needs to read the inbox and create drafts. It doesn't need to send, delete or read your calendar. Every tool you add is one more thing it can misuse.

For instructions, a good system prompt has four parts:

  1. Role and goal: what the agent is for, in one or two sentences.
  2. The process: your SOP, step by step.
  3. Rules and limits: what it must never do, and when it should stop and ask.
  4. Output format: exactly what a finished result looks like, ideally with one example.

Add memory only when the job needs it. A labeler needs none. An assistant that writes in your voice needs a file with your tone and context. Start without and add it when you see the gap.

Step 6: How do you test an AI agent before it goes live?

You test an AI agent by running it on 20 or so real past cases and comparing its output with what a person actually did. Not made-up examples. Real ones, including the messy ones.

Score each run as right, fixable or wrong. Then look at the wrong ones and ask why. Usually the answer is in the SOP: an exception nobody wrote down, or a rule that was only in someone's head. Fix the instructions, run the set again.

While you're testing, build the failure path too. What happens when an API times out? When the input is incomplete? At minimum the agent should retry temporary errors, send stuck tasks to a person and log every run. I cover what to record and why in why AI agents break in production.

Step 7: How do you launch an agent without risking your business?

You launch an agent safely by running it in shadow mode first: it does the work in parallel, but a person still does the real task and compares. When the agent matches the person on most cases for a week or two, hand over, and keep a human checkpoint on anything that can't be undone.

That checkpoint is not a weakness. Approving a draft takes seconds. Fixing a refund that shouldn't have gone out takes much longer. Keep the list of approval points short, so people actually read what they approve.

Shadow mode sounds slow. It isn't, compared with the alternative. In a June 2025 forecast, Gartner expects more than 40% of agentic AI projects to be scrapped before 2028, with cost, unclear value and poor risk control as the reasons. MIT's NANDA initiative reported in 2025 that around 95% of generative AI pilots it studied showed no measurable impact on profit and loss. The pattern behind both numbers is the same: agents launched without a clear process and without a plan for what happens when they're wrong.

What does it cost to build an AI agent?

Building a narrow AI agent costs mostly time, not money. The model and tool costs for a small business agent are usually small. The real cost is the hours spent writing the process down, testing on real cases and owning the agent after launch.

Budget for three things:

  • Build time: a day or two for a narrow agent once the SOP exists.
  • Testing and shadow mode: a few weeks of light attention.
  • Ownership: someone who reads the logs and fixes edge cases every month.

Skip the third and the agent slowly drifts until nobody trusts it.

Where should you start this week?

Pick one process, write its SOP on a single page and define the one output. That's it for week one. If you want a head start on the build itself, the free agents and templates include n8n workflows and Claude Code setups you can copy and adapt.

An AI agent is not a project you finish. It's a small colleague you onboard. Treat it that way and it keeps working long after the demo.

Frequently asked questions

How do I build an AI agent from scratch?

Pick one repeating task, write down how it's done today, and define what goes in and what comes out. Then connect a model to the two or three tools that task needs, write clear instructions, test it on real past cases and let it run next to a person before it acts alone. Tools like n8n let you do this without code.

Can I build an AI agent without coding?

Yes. Visual tools like n8n let you connect a model to email, sheets, calendars and CRMs with drag-and-drop workflows and an AI agent node. You still need to write the process down clearly and decide where a person approves the output. The thinking is the same with or without code.

How long does it take to build an AI agent?

A narrow agent, like one that labels email or drafts replies to inquiries, can work in a day or two once the process is written down. Getting it reliable takes longer: testing on real cases, shadow mode and fixing edge cases usually take a few weeks of light attention.

What is the difference between an AI agent and an automation?

An automation follows fixed rules you wrote: if this, then that. An AI agent uses a model to decide its next step, such as which tool to call or how to answer, based on what it reads. Many good agents are mostly automation with one decision step in the middle where judgment is needed.

Which LLM is best for building an AI agent?

For most business agents the model matters less than people think. Any current frontier model from Anthropic, OpenAI or Google handles tool use well. Pick one, write good instructions, and only switch if your tests show a real quality gap on your own cases.

Robin van Veen

Robin van Veen is the founder of Arcgent. He helps companies become AI-native, process by process, and shares what he builds with AI agents and Claude Code in public.