esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

What Are Common AI Agent Failure Modes?

The main ways an AI agent goes wrong, why one small slip grows, and the code checks that catch it, explained simply for your AI interview.

In short

An agent often fails by picking the wrong tool, letting one error grow through later steps, never stopping, losing track of facts in a long context, claiming success too early, or having too much access. Each has a known fix in code.

12 min readIntermediateVery common · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

The common failures are wrong tool calls, errors that pile up across steps, no stop point, losing track of facts in a long context, claiming success too early, and having too much access. Small slips compound. In a simple model where each step is 95 percent right, a 20-step job is right only about 36 percent of the time. So I cap the steps, require a passing check before anything is marked done, and give each tool only the access it needs.

What is an AI agent failure, in plain words?

An AI agent is a model that works on a task in steps. It calls a tool, reads what came back, and picks the next step. Anthropic describes agents as "typically just LLMs using tools based on environmental feedback in a loop".

A failure mode is a common way something goes wrong, the kind of problem you can name in advance. For an agent, the loop goes wrong: a bad choice, a bad input, or a claim of success that isn't true, which then shapes every step after it.

Think of a new claims clerk in their first week with full access to the system. They are careful, but they may follow an old form, miss a rule that changed on Monday, and mark a file done before the checks run. A claims triage agent, made up for this page, handles thousands of files a day, so the same slip spreads before anyone looks.

Key words

Tool call
The model asks your code to run a function, such as look up a claim. Your code runs it.
Step cap
A limit on how many steps one job may take, after which a person takes over.
Context
The text the model can see at one time: rules, the task, and every tool result so far.
Guardrail
A rule in code that checks or blocks an action before it happens.

Which failure modes should you be able to name?

Six failure modes are a useful way to sort agent problems. Each has a symptom you can see, a cause, and a fix.

  • Wrong tool or wrong input

    The agent calls a function that doesn't fit the job, or passes a value that belongs to another customer. Fix: strict tool inputs that reject malformed values, plus a check in code that each ID belongs to the case being worked on.

  • Errors pile up

    One wrong early step becomes the input to every later step, so the final answer looks confident and is wrong. Fix: a check after each step, before the next one runs.

  • No stop point

    The loop repeats a failing call, or keeps searching, and the bill grows. Fix: a step cap (a limit on how many steps run) and a spend cap (a limit on money spent), with a clear hand-off to a person when either is hit.

  • Lost in a long context

    As the chat and the tool results grow, the model recalls information from its context less accurately. Anthropic's engineering article points to studies that have uncovered "the concept of context rot". Fix: keep each step's context short and carry only the facts it needs.

  • Says done too early

    The agent reports success before the work is checked. In one Anthropic experiment with long-running agents, the agent marked the whole project finished too early. Fix: a passing check is required before anything is marked done.

  • Too much access

    The agent can send mail, delete files or move money. Untrusted text in a web page or email can also steer it, which OWASP describes as indirect prompt injection. OWASP names excessive functionality, permissions and autonomy as the root causes of Excessive Agency. Fix: give each tool the least access, and ask a person before actions that can't be undone.

  • “Agents might call the wrong tools, call the right tools with the wrong parameters, call too few tools, or process tool responses incorrectly.”

    Anthropic, on writing tools for agents

  • “Claude declares victory on the entire project too early.”

    Anthropic, on long-running agents

  • “Excessive Agency is the vulnerability that enables damaging actions to be performed in response to unexpected, ambiguous or manipulated outputs from an LLM”

    OWASP, LLM03:2026

How does one small slip become a big failure?

Errors compound because each step builds on the last. Here is a simple model with made-up numbers. Say each step is right 95 percent of the time and the steps don't affect each other. Then a 20-step job is fully right only about 36 percent of the time. Anthropic's evaluation guide makes the same general point: agents "use tools across many turns", so "mistakes can propagate and compound".

  • “The autonomous nature of agents means higher costs, and the potential for compounding errors.”

    Anthropic, on building effective agents

How one small slip grows

Wrong tool call

a bad input goes in

Bad result trusted

the agent treats it as true

Later steps inherit it

each step builds on the slip

Wrong claim sent out

the mistake reaches a customer

  1. 1The tool returns a result built on the bad input.
  2. 2The agent accepts that result as true and carries on.
  3. 3Every later step builds on it, and the wrong claim reaches the end.
One wrong tool call gets carried forward by every step after it. The mistake shows up at the end, after the damage is done, which is why each step needs a check.

This small program puts the odds and a safe stop into code. It prints the odds for 1, 5, 10 and 20 steps. Then a made-up claims triage agent runs three jobs: one finishes, one hits the 12-step cap and goes to a person, and one fails its checks and is held.

Python
# Claims triage agent, made-up numbers. Each step has a 95% chance of being right,
# and we pretend the steps are independent (a simplification).
STEP_RIGHT = 0.95
MAX_STEPS = 12

for steps in (1, 5, 10, 20):
    print(f"{steps:2} steps: {STEP_RIGHT ** steps:.0%} chance every step is right")

def triage(plan, checks_pass):
    done = []
    for step in plan:
        if len(done) >= MAX_STEPS:
            return f"STOP: step cap hit after {len(done)} steps, send to a claims handler"
        done.append(step)
    if not checks_pass:
        return "HOLD: checks failed, the claim is not marked done"
    return f"DONE: {len(done)} steps, all checks passed"

print(triage(["read form", "match policy", "check fraud flags", "price", "write note"], True))
print(triage(["read form"] * 15, True))
print(triage(["read form", "match policy"], False))

Output

 1 steps: 95% chance every step is right
 5 steps: 77% chance every step is right
10 steps: 60% chance every step is right
20 steps: 36% chance every step is right
DONE: 5 steps, all checks passed
STOP: step cap hit after 12 steps, send to a claims handler
HOLD: checks failed, the claim is not marked done

The step cap (lines 12 and 13) and the check gate (lines 15 and 16) protect the claim. Code decides when a claim is finished. The program gates only once, at the end. In a real agent the same gate runs after every step.

What stops these failures in production?

No single fix is enough, so stack small checks in code. The chart maps five of the failure modes to the check that limits each one. Lost context, the sixth mode, is handled by keeping each step's context short, so it is not in the chart.

Five failure modes and the code check for each

Failure

Wrong tool or input

picks the wrong function or value

Errors pile up

one slip shapes every later step

No stop point

runs on, and the bill grows

Says done too early

claims success without a check

Too much access

one bad step can do real damage

Fix in code

Strict tool inputs

reject malformed values before they run

Check each step

verify output before the next step

Step and spend cap

stop after a fixed budget

Passing test before done

finishing needs a passed check

Least privilege

only the access the job needs

  1. 1Rules for each field reject a malformed tool call before it runs.
  2. 2A check after each step catches a slip before it spreads.
  3. 3A step cap stops the loop and hands the case to a person.
  4. 4A passing check has to exist before the agent may say done.
  5. 5Each tool gets only the access it needs, nothing more.
Five failure modes on the left, each joined to the code check that limits it on the right. The check decides what happens, not the model.
  1. 1

    Strict inputs

    Reject a bad tool call before it runs, with a written rule for each field that says what values it may take. Check in code that every ID belongs to this case.

  2. 2

    Check each step

    Run a check on each output before the next step builds on it.

  3. 3

    Cap steps and spend

    Stop after a fixed budget, and hand the case to a person with a short summary of what was done.

  4. 4

    Require a passing test

    Done needs a passing check that code runs, never only the agent's own report.

  5. 5

    Least access, human approval

    Give only the access the job needs. A person signs off on any action that can't be undone.

Anthropic makes a similar point: agents "can then pause for human feedback at checkpoints or when encountering blockers". It also recommends "extensive testing in sandboxed environments, along with the appropriate guardrails".

Tip

Ask how you would test an agent before launch. Say you run a fixed set of tasks, count the failures for each mode, and fix the top one first.

What does the interviewer want to hear?

A strong answer covers

  • The common modes by name: wrong tool or input, errors piling up, no stop point, lost context, false done, too much access.
  • Why one slip grows: each step builds on the last one.
  • The fix in code, not in the prompt.
  • A step cap and a spend cap, with a hand-off to a person.
  • A passing check before anything is marked done.
  • How you would test it: a fixed set of tasks, with failures counted for each mode.

Common traps

  • Trap"Just write a better prompt."

    BetterA prompt helps a little. The limits and checks must live in code the model can't rewrite.

  • Trap"A good model won't make these mistakes."

    BetterErrors compound over many steps, so even a good model needs a check after each step.

  • Trap"If the agent says it's done, it's done."

    BetterDone needs a passing check that code runs. The agent's own report is not enough.

Can you spot the failure?

Spot the failure

This log comes from a claims job. Which line shows the failure the team must fix first?

Quick check

An agent runs a 20-step claims job. Each step is right 95 percent of the time, and the steps are independent. Roughly how often is the whole job right?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q173How do you stop endless agent loops?11 min
  2. Q176How should an agent handle tool errors and retries?14 min
  3. Q179Excessive agency and least privilege?11 min
  4. Q172When and how do you add a human in the loop?12 min
  5. Q181How do you evaluate agents?11 min
  6. Q201What is prompt injection?12 min

Last updated on 26 November 2026

Building an agent that works through real claims, tickets or files?

I design and build AI agents with these checks in place: strict tool inputs, step caps, passing tests before done and least access. Book a short call and tell me what yours needs to do.