How to Write Tasks AI Agents Can't Get Wrong
By Mark Harnett
Short answer: Before an agent touches a task, write a Definition of Done (the outputs, specific and checkable) and a read-only Verification check, and leave no open questions (the inputs). Then "done" stops being the agent's opinion and becomes a query result.
Before I did this, a classifier I built to guess what my tasks meant got about 40% of 117 wrong. At one point my system logged a step as done 34 times. Nothing had changed once.
Why do AI agents misread tasks?
Because they can't ask what you meant. A person can walk over and ask. An agent just guesses, and an agent guessing inside a live ad account makes for a very interesting Monday.
I kept having to correct them. I'd write "clean up the AI compliance keywords" and come back to find the agent had done something. Something reasonable, even. Just not what I wanted. Every imprecise task went off the rails.
So naturally I blamed the agent and built that classifier. It read "build a write layer for the ads API" as a request to go edit an ad account. Which, to be fair, is kind of what the words said.
That's when it clicked. The agent wasn't the problem. My tasks were.
McKinsey's latest AI trust survey says the risk with agents is no longer AI saying the wrong thing, but doing it. Only about 30% of companies are any good at governing that. I'm pretty sure I was in the other 70%.
What goes in a task an agent can't get wrong?
The outputs and the inputs, written down before the agent starts. Back in the 90s we all learned object oriented programming. The big idea: before you build anything, define what goes in and what comes out. I didn't think about it for 25 years. Then I started handing real work to AI agents.
So I went back to the 90s. Every task now has this before an agent touches it:
- Definition of Done: the outputs, specific and checkable
- Verification: a read-only check, and what it returns when the task is done
- Open Questions: the inputs I haven't given it yet. This has to be empty before the agent starts
What does a finished task look like?
Here's a real one, for a keyword change:
- Done: keywords [list] ENABLED in ad group "AI Compliance", URL /ai-compliance
- Check: query those keywords
- Pass: all present, ENABLED, right URL
Not exciting. That's the point. The agent can run the check, and so can I.
What doesn't this fix?
It doesn't fix everything. I still have a pile of well defined tasks waiting on me to approve something. But now it's painfully obvious which blockers are me.
If you're handing work to agents, write the Definition of Done first.
FAQ
What is a Definition of Done for an AI agent task?
It's the outputs the task has to produce, written specifically enough to check. In my keyword example, that's a list of keywords enabled in one named ad group with the right URL. Without it, done is whatever the agent thinks it is. Write it before the agent starts.
How do I check that an AI agent actually finished a task?
Put a read-only check in the task before the agent starts, and say what it returns when the task is done. For a keyword change, query those keywords. It passes when every one is enabled on the right URL. The agent can run it, and so can I.
What are open questions in an AI agent task?
They're the inputs you haven't given the agent yet. The list has to be empty before the agent starts, because an agent can't ask what you meant. It just guesses. Every imprecise task I handed one went off the rails.