Design the loop, not the prompt
An agent is just tools in a loop toward a goal. Simon Willison shows how to set one up so it can safely work things out.
30 Sep 2025 · 4 min read
By Simon Willison (@simonw) on Blog
The short version
- An agent is an AI that runs tools in a loop until it reaches a goal.
- The skill is giving it a clear goal it can check, plus the right tools.
- Letting it run without asking is fast but risky, so use a safe sandbox.
- It works best on trial-and-error jobs with a clear pass or fail, like fixing tests.
Who it's for: Developers and technical founders using coding agents.
Why it's genius
Simon Willison co-created the Django web framework and writes one of the most trusted blogs on AI tools. He tests everything himself and says plainly what works.
His idea here is simple. Give an agent a clear goal, a way to check whether it has met it, and safe tools to work with. It can then try, fail and try again until it gets there, the way you would with a hard puzzle. He calls designing that loop a key new skill.
He's just as clear on safety. Letting an agent run commands without asking you each time (“YOLO mode”) is fast but risky. So do it somewhere it can't do damage: a sandbox, a throwaway cloud machine, test logins, and a spending cap of a few pounds.
Try it
Pick a job that needs lots of trial and error, like fixing a failing test.
Write down what “done” looks like, in a way the agent can check itself.
Add the key commands to a notes file the agent reads, with one example each.
Let it run in a safe sandbox, with any paid logins capped at a few pounds.
Your goal: make this test pass. Run it after every change. Stop when it passes, or after ten tries, and tell me what you learned.
Our take
Prompting is out, loop design is in
A year ago, the skill everyone talked about was writing the perfect prompt. Willison's point is that with agents, the prompt matters less than the setup around it. A so-so prompt in a well-designed loop beats a perfect prompt with no way to check its work.
The key ingredient is the check. If the agent can run a test and see it pass or fail, it can grind its way to a solution. If it can't tell whether it's done, it just guesses.
Simple tools beat fancy ones
One of his most useful tips is unglamorous: agents are very good at ordinary command-line tools, so prefer those over complex connections. Write down the key tools in a notes file the agent reads, with one example each, and it will usually work out the rest.
We do exactly this on Ugenie. A short project notes file with a few example commands saves a lot of explaining every session.
Safety is part of the design, not an afterthought
The risks are real: an agent could delete files, leak secrets or be tricked by instructions hidden in a web page. His advice, in order: run it in a sandbox that limits what it can touch, or on a throwaway machine, and never give it logins that can spend real money without a hard cap.
That's a sensible rule for anyone handing work to an agent, technical or not. Give it only what it needs for this job.
Where it shines
Fiddly technical jobs with a clear pass or fail, such as tests, speed-ups and upgrades.
Where it breaks
It's written for developers. Fuzzy goals like “make it better” give the loop nothing to aim at.
Where Ugenie helps
A good loop needs a clear goal. Your three main tasks are exactly that, for the rest of your work.
Get Ugenie →Tools mentioned
Claude Code
Anthropic's coding agent. You give it a task in plain English and it reads, writes and runs code on your computer.
- Cost
- Comes with paid Claude plans, or pay as you go through the API.
- Our verdict
- The strongest coding agent we've used, and we build Ugenie with it. It isn't just for developers any more, but you do need to be comfortable with a terminal or the desktop app.
Docker
Software for running programs in sealed-off containers, so they can't touch the rest of your computer.
- Cost
- Free for personal use and small businesses.
- Our verdict
- The standard way to give an agent a safe sandbox. A bit technical to set up, but worth it before you let an agent run freely.
A project notes file (AGENTS.md or CLAUDE.md)
A plain text file in your project that tells the agent how things work and which commands to use.
- Cost
- Free.
- Our verdict
- The cheapest upgrade you can make to any coding agent. Ten minutes writing it saves hours of re-explaining.
Prices are rough and change often. Check before you buy.
Questions people ask
What is an agentic loop?
An AI that runs tools in a loop, checking its progress each time, until it reaches a goal. Designing the goal, the tools and the check is what makes it work.
Is YOLO mode safe?
Not on its own. Letting an agent run commands without approval is fast but risky. Run it in a sandbox or throwaway machine, with limited logins and a spending cap.
What jobs suit an agentic loop?
Trial-and-error jobs with a clear pass or fail: fixing failing tests, speeding things up, upgrading dependencies or shrinking container images.
All credit to Simon Willison. We share things we think are genius and add our own take. Watch or read the original for the full thing.