Skip to content
be-human.ai
← Back to the journal

Testing & reliability

Fallback Paths for AI Agents When a Model Fails: Order and Stop Rules

Set a fallback order for AI agent tasks when a model times out or returns invalid output, and define conditions that stop the run and send it to a person.

Be Human typographic cover with the title: Fallback Paths for AI Agents When a Model Fails: Order and Stop Rules
Conceptual illustration created with AI · Be Human

When a model times out or returns output that fails validation, a well-designed agent should follow a fixed order: classify the failure, check whether any side effect already happened, retry once with the same input, validate before use, move to a narrower deterministic path if one exists, and stop to wait for a person when the next step is irreversible, ambiguous or outside its permissions. The order matters more than any single step, because each fallback should be safer or more conservative than the one before it. Write that order down before the first failure, not during it.

Key takeaways

  • Classify the failure first. A timeout, malformed output and a wrong but well-formed answer need different responses.
  • Check external state before retrying. A timeout means the agent does not know whether an action happened.
  • Never pass unvalidated output to a tool, a customer or a record system.
  • Make each fallback narrower than the last: fewer permissions, fewer open decisions, more human review.
  • Define stop conditions in advance, and send the person a decision with context, not a raw transcript.

Why a model failure is not a task failure

A model failure is a fault in one step of a longer job. The task itself may still be solvable, but the agent has to decide whether to continue, repeat or stop. Many teams treat every error as the same event, which leads to one of two bad outcomes: retrying without limit, or giving up at the first hiccup. Blind retries can duplicate a message or a booking. Immediate give-up leaves the customer waiting and the work half finished.

Three failure types are worth separating. A timeout means the agent does not know what happened: the model may have stopped, or its answer may have arrived after the client gave up. Malformed output means the model responded, but the response fails a schema or a business rule, such as a missing field or a value outside allowed bounds. A plausible but wrong answer passes every structural check and only shows up in review. The first two can be caught automatically. The third needs sampling and evaluation, which is a separate discipline from runtime fallback.

What is the fallback order for an agent task?

Treat the sequence below as a default, then adjust it for each task type. Every step has a stop rule attached. If a step cannot be completed safely, the agent moves to the next step without guessing. Anthropic's engineering guidance on building agents favors simple, composable patterns with clear checkpoints over open-ended autonomy, and a fallback order is one of those checkpoints.

  • Step 1: Classify the failure as timeout, invalid output, refusal or low confidence, and log that class with the run identifier.
  • Step 2: If a tool call might have happened, confirm its state through a read before doing anything else. Do not re-send the action to find out.
  • Step 3: Retry the model call once, with the same input and a time limit that matches the step's latency budget.
  • Step 4: Validate the new output against the schema and the business rules. If it fails, allow one repair pass that names the failed rule.
  • Step 5: Use a narrower path if one exists, such as an approved template, a cached answer from an approved source or a deterministic rule. A different model can serve here only under the same permissions.
  • Step 6: Park the task in a human queue with the decision, the options and the state of any side effect.
  • Step 7: Record which step ended the run, so the next review can show what happened and why.

Notice what is missing: an open-ended loop. Every step has a cap, and the cap is the same for every run of that task type. The idea that an unknown result is not the same as a failed one is developed in Tool Timeouts in AI Agents: Report Unknown, Not Failed.

When should the agent stop and wait for a person?

Retries and fallbacks should resolve transient faults. They should not resolve judgment. The agent should stop and wait for a person when any of the following is true:

  • The next action is irreversible, or it touches money, legal commitments or customer data in a way the policy does not pre-approve.
  • A timeout occurred on a step with a side effect, and the state of that side effect cannot be confirmed by a read.
  • Two consecutive validated outputs fail the same rule, which usually means the input falls outside what the task was designed to handle.
  • The input contradicts a written policy, or the policy is unclear for this case.
  • The run has reached its attempt or cost ceiling for this task type.
  • The fallback would need a permission the original task did not have.

The handoff format matters as much as the decision to stop. A person should receive the decision to make, not the full transcript. Include the request, the step where the run stopped, what has already been done, and two or three options with a suggested choice. Human escalation for AI agents covers the format in more detail.

How do you handle a timeout without repeating side effects?

A timeout is the hardest case because the agent does not know whether the tool ran. The safe pattern is to attach a stable key to every side-effecting call, so that a repeated request returns the original result or is refused rather than creating a second action. Payment providers document this pattern for their APIs. Stripe's documentation on idempotent requests explains how a key sent with a request lets retries return the same outcome instead of duplicating it. Internal tools need the same discipline, even when they are not payment systems.

In practice, the agent stores the key before the call, makes the call once, and on timeout reads the record instead of sending again. If the record exists, the outcome is known and the run continues. If it does not exist, the agent still cannot be certain the request never reached the system, so it should treat the state as unknown. For a consequential action, that unknown state goes to the queue. The design details are covered in Idempotent Tool Calls for AI Agents.

How do you handle invalid output?

Invalid output should never reach a downstream system. Validate it at the boundary, using a schema for structure and short, named rules for business logic. A rule such as requiring the reply to name the policy section it relies on is easier to repair than a general instruction to be careful. Allow one repair pass that quotes the failed rule, then stop. A model that cannot satisfy a named rule after one clear instruction is signaling that the task or its context is wrong, so a fifth attempt will not help.

Keep the fallback path on a short leash. If a backup model or a simpler prompt is used, it inherits the same tool list and permission scope as the primary path, and no more. Authorization belongs at the tool, enforced by the system, not assumed from what the prompt says. The OWASP authorization guidance is a useful reference for that boundary. A practical validation layer usually checks five things:

  • Structure: required fields are present, types are correct and enumerated values fall inside the allowed set.
  • References: every identifier points to a record that exists and that the run is allowed to read.
  • Bounds: numeric values and dates fall inside limits the policy sets.
  • Consistency: the output does not contradict the input or the stored state.
  • Wording: tone and phrasing are checked by sampled review where the risk is low, not on every run.

The retry rules for this layer are covered in An AI agent retry policy that avoids repeated mistakes.

What does this look like in a real queue?

Illustrative scenario: a support agent drafts replies to refund requests. On one request, the model call times out during drafting. The agent checks its own record for that request's key and finds no draft and no refund, so it does not touch the refund step. It retries the drafting call once. The second response cites a policy section that does not exist in the approved set, so the validator fails it and the repair pass also fails. The agent stops and places the request in the human queue with the customer's question, the policy section that applies, the confirmed fact that no refund has been issued, and two drafted options. A staff member chooses one option, and the run closes with a complete log showing each step under the same run identifier.

The scenario is simple on purpose. Each decision in it can be read by an operations lead without reconstructing the model's reasoning.

How does Be Human's managed approach handle fallback paths?

In a Be Human engagement, the fallback order and stop conditions are written during the definition of the role, next to its memory, tools, approval boundaries and success criterion. Managed operations then review failure classes in the log, check the human queue for items that repeat, and update the runbook through a documented change process when a rule needs to move. Permission review confirms that no fallback has quietly gained access it should not have. The goal is a short, observable list of stop conditions that the business owner can read and approve, not a longer chain of automatic retries. Take the free Be Human AI diagnostic to find the first task worth handing to an agent.

Frequently asked questions

How many times should an agent retry a model call? One retry with the same input is a sound default for a transient timeout, and the second attempt should be logged as a retry. More attempts rarely fix a model that is failing for structural reasons, and they add latency and cost. Adjust the number only after reviewing the logs for that task type.

Should the agent switch to a different model when the first one fails? It can, as long as the second model runs under the same permissions, uses the same validators and has its output checked the same way. Switching models does not fix a bad input or a missing policy rule. Record which model produced each output so the review can compare them fairly.

What should the agent do when it cannot tell whether a tool action happened? It should treat the state as unknown. Read the external record using the stable key the call carried, and do not repeat a consequential action on a guess. If the record cannot be read, route the case to a person with the details of the attempt.

What does a person need to receive when a run stops? The person needs the decision required, the reason the run stopped, what has already been done, and the options with a suggested choice. A raw transcript forces the reader to reconstruct the state, which slows the decision and invites mistakes.

Your next step

See where an AI agent fits in your company first.

Take the free Be Human AI diagnostic. A few questions about your work show which task to hand to an agent first, what it needs to know and where a person approves.

Be Human editorial guidance. Examples are illustrative unless explicitly attributed. Sources provide background; implementation choices depend on your workflow.

Less busywork. More room for you.

Bring us the work you wish you had time for.

Book a call to try a personalized AI agent free for 7 days ↗Or take the free AI diagnostic →