AI agent infinite loops: step budgets, loop detection and kill switches
How to stop an AI agent infinite loop from burning your LLM budget: step and token budgets, repeated-call detection, wall-clock limits and a per-run kill switch.
Single agent vs multi-agent AI systems: when extra agents help, when they only add cost and coordination bugs, and a decision checklist to use before you build.
You have an agent that mostly works, and someone proposes splitting it into a planner, a researcher, a writer and a reviewer. The diagram looks tidy. The question to settle first is single agent vs multi-agent: does the split solve a problem you have measured, or does it add cost and coordination bugs to a system that one agent could handle?
This post is about the domain, not any particular deployment of ours. Claims are sourced from public engineering write-ups, linked inline.
Three things get conflated. Anthropic's Building effective agents separates them cleanly: workflows are "systems where LLMs and tools are orchestrated through predefined code paths", while agents are systems where "LLMs dynamically direct their own processes and tool usage". A multi-agent system is several of the latter that delegate to each other.
| Pattern | Who decides the next step | Predictability | Cost and latency |
|---|---|---|---|
| Single LLM call (with retrieval) | Your code | Highest | Lowest |
| Workflow (fixed chain or routing) | Your code | High | Low to moderate |
| Single agent with tools | The model | Moderate | Moderate |
| Multi-agent (orchestrator and workers) | Several models | Lowest | Highest |
The same guide's advice is to find "the simplest solution possible, and only increase complexity when needed", noting that this "might mean not building agentic systems at all", and that for many applications optimising a single call with retrieval and examples is usually enough. Treat every step down this table as something you have to justify.
Anthropic's engineering team described how they built their multi-agent research system, and the useful part is where they say it fits. It works best for "breadth-first queries that involve pursuing multiple independent directions simultaneously." They also report that a lead Claude Opus 4 with Claude Sonnet 4 subagents outperformed single-agent Opus 4 by 90.2% on their internal research evaluation. That is one vendor's result on one task type, so read it as evidence for research-shaped work, not for agents in general.
The conditions that favour splitting:
The same write-up is candid about the other side. Domains "that require all agents to share the same context" or have many dependencies between agents are described as not a good fit today, and it notes that most coding tasks involve fewer truly parallelisable pieces than research. It also says LLM agents are "not yet great at coordinating and delegating to other agents in real time."
Failure modes they observed in early versions are worth knowing before you design around them:
Add the debugging problem. Small changes to the lead agent can change how every worker behaves, so an eval that passed last week can fail after an unrelated prompt edit. If you do not yet have an evaluation framework for a single agent, a multi-agent system will be harder to trust, not easier.
Anthropic reports that in their experience agents typically use about 4x more tokens than chat interactions, and multi-agent systems about 15x more than chats. They also found token usage alone explained 80% of the variance in performance on the BrowseComp benchmark. Two honest readings follow. Part of the multi-agent gain is simply that you spent more tokens. And the cost multiple is a planning input: if your task is worth cents, a 15x multiple may erase the margin.
Their figures are not a forecast for your workload, and they do not give a direct multi-agent versus single-agent multiple. Measure both on your own tasks. For where the spend goes and how to track it, see our posts on AI agent observability cost and reducing LLM API cost with caching, batching and routing.
Work down this list and stop at the first step that solves the problem.
Two further safeguards apply once you do split. Put hard limits on the number of workers and steps, because runaway delegation is a documented failure. And keep a human checkpoint on side-effecting actions; see where to put the approval step and why agents fail in production.
Write down the one task you want agents for and answer the checklist honestly. Most teams find a workflow or a single agent covers it, and that is a good outcome: it is the cheaper system to run and the easier one to fix at 2 a.m. If your task genuinely is broad, parallel and high value, prototype the orchestrator-worker version behind an eval set and compare cost and quality against the single-agent baseline before committing.
If you want a second opinion on the architecture before you build, our AI automation service covers agent design, evaluation and production hardening.
Drafted by CodeKrypt's AI writing pipeline, built and maintained by our engineers, under fixed rules on sources and claims. How we write
How to stop an AI agent infinite loop from burning your LLM budget: step and token budgets, repeated-call detection, wall-clock limits and a per-run kill switch.
Durable execution lets a long-running AI agent resume after a crash, deploy or timeout instead of starting over. How checkpointing and workflow engines differ, and when you need either.
AI agent memory cost is the budget line most teams discover only after their context window balloons. What naive context injection actually costs, what tiered retrieval saves, and real 2026 pricing to plan against.