How I build AI agents and automations

I write down the manual task, test the output with fake data, and decide how I'll know if an automation breaks.

My first automation took hours to build and saved me about twenty minutes a week. On the second run the input came in a different shape. I nearly used the result before I spotted the garbage in it. I’d automated the steps I could see and left out the decisions I made while doing them.

I’ve since built AI assistants and automated workflows for my job and my own projects. I’ve replaced the tools several times. I still start with a text file.

Describe how I do the task by hand

I write the steps in the order I do them, as if I’m handing the work to someone joining next week. If they follow the instructions and get a different result, I want to be able to see which decision I left out.

I once wrote “choose the ones with real buying intent” while documenting how I pick prompts to track in a GEO tool. A new colleague reading that would have to ask me what counts as intent, whether to treat terms with brand names differently from category terms, and how broad a prompt can be before I drop it. I’d been making those calls without writing them down.

Spend an hour trying to kill the idea

Before I build, I write ten reasons it could fail. The first few are objections I’ve half-answered in my head. Around number seven, after I’ve run out of easy answers, I start seeing the problems I missed. I look for ways the output could be correct and still be useless. I also check whether I have access to the source, what its rate limit is, and whether the export includes the field I’m counting on.

When I was scoping Let The Bots In, my site scanner, I had to decide what a score of 62 would tell someone to do. I wrote each check so I could show a fix alongside the score.

I put the same exercise to a model. I ask it for ten reasons the idea can fail. If I ask for help building the idea, the model will give me a plausible plan even if the premise is weak. One failure I keep finding is that the task depends on a judgment I’d have to make myself. If checking each answer takes as long as doing the work, the automation saves me little.

Decide who will use the output

I work backward from what the recipient needs, whether that’s a tab in a spreadsheet or an email with three numbers. That gives me the fields to collect and the steps to get them. I ask what the person would do in the first minute after opening it. If they’d paste the three numbers into another tool, I can send them there and skip the email.

Someone using the scanner wants to know if AI crawlers can read their site. I could give them an accurate crawl log, but they’d have to know how to read it to find the answer. When I’m the only user, I can leave more of those rough edges in.

Give rules to code and judgment to the model

I mark the steps I can specify as rules. I can write code to fetch a page, parse it, check whether a file exists and save the result. Deciding whether the page answers the question in its title takes a judgment a rule might miss. I pass that step to a model and turn the paragraph I wrote for a new teammate into its instructions.

Sometimes I’ll write down what looks like a judgment call and find that it comes down to three conditions. I put that in code and save a model call. If I keep a decision for myself, I add a review step.

Build a version I can afford to get wrong

I build the rough version the same day I finish the notes. The rough version might take one input and run ten checks on one page. I often ask a model to mock up the finished output with fake data first. Looking at a mock spreadsheet can show me I asked for the wrong columns, while I can still change them without redoing the pipeline.

I use a script when the steps are the same on each run. It can still call a model in the middle. I’ll build an agent when the result of one step determines the next. I want a reason to take on that extra work. When a script fails, I can read a line number. When an agent gets stuck in a loop, I have to find out why it kept making the same call.

Revise after someone uses it

My prompt bot is on its fourth or fifth version. I made it ask questions before drafting after it kept answering requests it hadn’t clarified. I also rewrote instructions that made it refuse requests I wanted it to answer.

If I’m building for someone else, I get the rough version in front of them. They might tell me they need it on Monday or that they want to see what changed since the last run. I get better feedback by asking what they did the last time it ran. Someone might say it’s useful to be polite. If they didn’t open it, I’ve learned more from that.

Plan for the wrong result and the missed run

Ten bad rows in a sheet I skim on Monday are cheap to fix. Ten bad rows that sit in a live report for a quarter can affect the decisions people make from it. I put the review where an error can do that kind of damage.

I run my own stack on a small server. A certificate lapses, a credential expires, or a container restarts and a service fails to come back. Weeks later I go looking for the output and find that the newest file is from the twelfth. Now I spend ten minutes wiring up an alert for a missed run or making an empty result easy to spot.

Keep the notes

The file I started for a new teammate becomes the spec, the model’s instructions and my documentation. Three months later I can read the code to find out what it does and read the notes to find out why. I’ve replaced the tools I named in my notes two years ago, and I still use the notes.

If you have a task you repeat, write down how you do it. You might find a step you can drop before you build anything at all.