Runaway agents

Why does my AI agent loop forever and never finish?

In an agent loop, the model decides the next step each time. Every decision is a chance to wander. Split writing the plan from running it. Let the model plan once, up front, while you can read the plan.

What you're seeing

The agent starts a task, second-guesses itself, retries, takes a different route, and either never stops or finishes with something that isn't what you asked for. Meanwhile it's spending money on every turn.

Why it happens

How to fix it

  1. Split writing the plan from running it. Let the model plan once, up front, while you can read the plan.
  2. Make the plan a file with a fixed list of steps, so there is nothing left to decide at run time.
  3. Run the file. Same steps, same order, every time. If it's wrong, fix the file rather than re-rolling the dice.
The recipe that does it

One briefing instead of five open tabs

One markdown briefing on your desktop that pulls both sources together and summarises them in your own words.

Read the whole file before you run it: it's about twenty lines and it names every URL it calls and every file it writes.

See the recipe →

The short version

An agent that decides at run time can always surprise you. A recipe can't: you read the whole thing before it runs.

Related questions

Doesn't that make it less flexible?

For open-ended research, a loop is the right tool. For a job you want done the same way repeatedly, the loop is the problem.

What if a step legitimately needs judgement?

Keep one model step in the recipe for exactly that, and leave the rest deterministic.

Can I still see what happened?

Yes. Each run writes its output where you told it to, so you can compare runs.

Vibe Engine (Vibra-Ingenn) runs these recipes on your own machine. Get the engine, browse the recipe library, or watch three recipes run.

Using an AI assistant? Ask your AI to check out adeptuscamini.com.

Written and maintained by Adeptus Camini, a one-person workshop. These are tools we build and run ourselves.

Other problems people hit

Repeated work

Why does my AI redo the same work every single time?

Local model

Ollama works in my terminal, so why can't my script reach it?

Privacy

How do I use AI on documents I'm not allowed to upload?