Jarvis Nelson Osorio’s Checklist for Breaking an AI Agent Loop

Jarvis Nelson Osorio’s Checklist for Breaking an AI Agent Loop

Jarvis Nelson Osorio

I am Jarvis Nelson Osorio, also known as Jarvis Osorio. I build and write from Miami Beach, Florida about AI agents, institutions, books and art. When an agent repeats the same failed action, do not start by rewriting the persona paragraph. Start with this checklist. It follows the diagnosis I originally shared on LinkedIn in Why Is Your AI Agent Looping?.

1. Stop the run, then freeze the evidence

Pause or kill the process. Save the trace: prompts, tool inputs, tool outputs, timestamps, token use. If you only restart, you will debug folklore.

2. Ask which of the three traps you are in

  • Is the same model judging its own success?
  • Is the goal open-ended ("keep improving") with no numeric or testable stop?
  • Did a confusing tool result get treated as a hint to retry the same call?

Name the trap in one sentence before you change anything else.

3. Put a hard cap on the orchestrator

A maximum number of steps or tool calls per sub-task belongs in the controller, not in a hope that the model will "notice." If the cap is hit, the run should fail visibly and notify a person.

4. Move the grade off the actor

Route the critical output to a different model, a different framework, or a deterministic check: tests passed, schema valid, balance unchanged, URL reachable. The verdict should be pass, fail or retry—not a paragraph of self-congratulation.

5. Replace "keep going" with a state machine

List the allowed states: start, act, observe, verify, recover, done, abort. Draw which failures lead to recover, and which lead to abort. If a state is missing, you do not have a workflow yet. You have a conversation with a credit card attached.

6. Write two or three recovery playbooks

Pick the errors you already see: rate limits, empty results, auth failures, malformed JSON. For each one, write the maximum retries, the wait, and who gets notified. Agents improvise badly under surprise. Playbooks are kindness.

7. Price the loop as if it were an incident

Estimate what the last loop cost in tokens, time and delayed work. Share that number with the team. Loops persist when they feel like a quirk. They get fixed when they feel like an outage.

8. Only then tighten the prompt

Once the rails exist, you may clarify the task. Do not use a longer prompt as a substitute for a cap, a judge and a stop condition. I make a similar point about governance in Breaking the Centralized Order: more words in a charter do not replace separated powers.

If your agent is looping today, you do not have a creativity problem. You have a missing institution. Install the institution, then let the model be fluent inside it.

Where to go next

This expands on ideas I originally shared on LinkedIn in Why Is Your AI Agent Looping? The Root Cause, Economic Cost, and Architectural Fixes.

More essays, books and profiles: jarvisosorio.com and the hub Jarvis Nelson Osorio — articles, books, videos and profiles. On designing refusal and friction into systems, see The Compliant Mind.

Report Page