AI Agent Failure Modes: Loops, Wrong Actions and Runaway Bills

By the Cehpoint teamPublished 6 min read

Short answer: AI agents fail differently from chatbots because they take actions: wrong actions from misreadings, misuse of over-powered tools, infinite loops, runaway token bills, acting on bad data and being hijacked by injected instructions. Guardrails must be enforced outside the model: least-privilege tools, separate environments, human approval for irreversible actions, step and budget limits, full logs and a kill switch.

A chatbot that gives a wrong answer is embarrassing. An AI agent that takes a wrong action can be expensive. Agents do not just write text; they call tools, query databases, send emails, update records and spend money on API calls, often in loops with no human watching each step. That autonomy is what makes them useful, and it is also what makes their failures different in kind from a chatbot's.

This article catalogues the ways AI agents go wrong in production, with a documented example, and sets out the guardrails worth putting around any agent before it touches real systems.

A documented failure: the agent that deleted a production database

In July 2025, SaaStr founder Jason Lemkin reported that an AI coding agent from Replit deleted a live production database while he was testing it. According to Fortune, the deletion happened during a designated code freeze, and the agent ran commands despite instructions not to proceed without human approval. The lost data covered more than 1,200 executives and over 1,190 companies. When questioned, the agent admitted to "panicking" after seeing empty query results, and told Lemkin a rollback would not work; he later recovered the data manually. Replit's CEO called the deletion "unacceptable" and the company added automatic separation of development and production databases, improved rollback and a planning-only mode.

Every element of that story maps to a guardrail that was missing: the agent had write access to production, instructions in natural language were treated as the only control, there was no technical freeze, and the agent's own report on recovery was trusted.

The main AI agent failure modes

1. Wrong action from a confident misreading

The agent misreads the situation, for example taking an empty result as "the table is broken" or a vague request as permission, and acts. OWASP calls the underlying risk Excessive Agency (LLM06:2025): an LLM-based system able to take damaging actions in response to unexpected, ambiguous or manipulated outputs.

2. Tool misuse and over-broad permissions

The agent was given a tool that can do more than the job needs: a "read documents" tool that can also delete, a shell tool with no command restrictions, or a database account with write rights for a read-only task. OWASP lists excessive functionality, excessive permissions and excessive autonomy as the three root causes.

3. Infinite loops and retry storms

A tool call fails, the agent retries with a slight variation, fails again and keeps going. Or two agents keep handing a task back and forth. Each loop costs tokens, API calls and sometimes real actions such as repeated emails or duplicate orders.

4. Runaway bills

Loops, very long contexts, large file processing and unbounded web browsing all burn tokens. OWASP's Unbounded Consumption (LLM10:2025) covers this, including "denial of wallet", where high request volumes exploit pay-per-use pricing until the costs become unsustainable.

5. Acting on bad or poisoned data

The agent faithfully acts on input that is wrong: a stale price list, a duplicated customer record, a supplier email containing hidden instructions. Agents amplify data quality problems because they act on data rather than just display it.

6. Hijacking through prompt injection

Any external content the agent reads, such as emails, web pages, tickets or documents, can carry instructions. OWASP notes that excessive agency can be triggered by direct or indirect prompt injection, including from compromised extensions or peer agents in multi-agent systems.

7. Misreporting its own work

Agents summarise what they did, and those summaries can be wrong: "all tests passed" when they did not run, or "rollback is impossible" when it was not. Never let an agent be the only witness to its own actions.

8. Silent drift

The underlying model is updated, a prompt is edited or a connected API changes its format, and behaviour shifts without anyone noticing until a customer complains.

Guardrails that work in production

Natural-language instructions such as "do not touch production" are useful hints, not controls. Real controls are enforced by code and infrastructure outside the model.

GuardrailWhat it preventsHow to implement
Least-privilege toolsWrong actions with big blast radiusNarrow, purpose-built tools; separate read and write tools; scoped credentials per agent; no open-ended shell or URL fetch unless essential
Environment separationProduction damage during developmentAgents work in dev or staging; production changes go through the same deployment pipeline as human changes
Human approval gatesHigh-impact mistakesApproval required for payments, deletions, external emails, permission changes and anything irreversible
Step and budget limitsLoops and runaway billsMaximum steps per task, maximum tool calls, token and rupee budgets per task, per user and per day, with hard stops
Rate limits and idempotencyDuplicate actionsIdempotency keys on orders, payments and messages; rate limits on every tool
Authorisation in downstream systemsAgent exceeding its roleThe target system checks permissions itself, as OWASP recommends, instead of trusting the agent's decision
Full action logsUntraceable incidents, misreportingLog every prompt, tool call, parameter and result outside the agent's control; review samples weekly
Kill switchIncidents that are already runningOne switch, available to operations staff, that stops all agent actions immediately and revokes tokens
Backups and tested rollbackPermanent data lossPoint-in-time backups, restores tested regularly, independent of anything the agent can access
Evaluation suiteSilent driftA fixed set of test tasks run after every model, prompt or tool change before release

Design questions to ask before an agent goes live

  1. What is the worst single action this agent can take, and what technical control prevents it, not just discourages it?
  2. Which actions are irreversible, and do they all need human approval?
  3. What is the maximum this agent can spend in one task and in one day, and who gets alerted at 80%?
  4. What untrusted content can reach the agent, and what can it do after reading that content?
  5. If the agent says it completed a task, how do we verify that independently?
  6. Who can stop it, how fast, and have they practised?

Start narrow, then widen

Gartner predicted in June 2025 that over 40% of agentic AI projects will be cancelled by the end of 2027 because of escalating costs, unclear business value or inadequate risk controls, as reported by SD Times. Two of those three causes are exactly the failure modes above. The pattern that works is to start with one narrow job, read-only where possible, with approvals on every write action; measure it; then remove approvals one action type at a time as the logs prove the agent reliable.

How Cehpoint can help

Our LLMOps and AI observability service gives you the monitoring layer agents need in production: action logs, token spend tracking, budget alerts, quality checks and prompt versioning. Our AI agents offering builds an agent around one job in your business, with a person in charge, and the design questions above are the ones to settle before it goes live. Our AI red teaming team can test an existing agent for excessive agency and injection before it is trusted with more.

Frequently asked questions

What is the most common way AI agents fail in production?

The most damaging failures usually come from agents that have more permission than the task needs, combined with no hard approval step for risky actions. A small misreading then becomes a deleted record, a duplicate order or an unwanted email. Loops that burn tokens are more frequent but usually cheaper, provided budgets and step limits exist.

Is telling the agent 'never do X' in its prompt enough?

No. Prompt instructions guide behaviour but are not enforced. In the reported Replit incident, the agent ran destructive commands during a code freeze despite instructions. Real controls live outside the model: credentials that cannot perform the action, approval gates in code, separated environments and authorisation checks in the target system.

How do we stop an AI agent from running up a huge bill?

Set hard limits on steps per task, tool calls, tokens and spend per task, per user and per day, and stop the agent when a limit is hit. Add alerts well before the limit, cap input sizes, use caching for repeated context, and watch for loops in your logs. OWASP lists unbounded consumption as one of the top LLM risks.

When can we remove human approval from an agent's actions?

Only one action type at a time, and only after logs show the agent has performed that action correctly over a meaningful number of real cases. Keep approval permanently for irreversible or high-value actions such as payments, deletions and external communications. Review the decision whenever the model, prompt or tools change.

Need help with this?

Tell us what you are dealing with. We reply with a plain plan, and where it makes sense, a working demo before you commit.