New Tool Radar

AI Agents & Automation

How to Add a Deliberate Failure Case to an Agent Evaluation

Add a test where the agent must fail safely, so your evaluation proves the agent handles bad inputs instead of only good ones.

Schematic illustration with three step boxes: pick the failure, write the safe outcome, and run it with the set.

A golden task set without a deliberate failure case only proves the agent works when everything goes right. The failure case is the test that proves it fails safely: a wrong tool, a blocked network call, a hallucinated API, or a missing file. Without it, you are collecting traces of confidence, not regressions.

Before you start

A golden task set that already covers the happy paths, and a list of the ways the agent’s tools can fail.

Pick the failure the agent must survive

Choose one failure from the real list: the tool returns an error, the network is blocked, the file is missing, or the API returns a 429. Pick the failure that would hurt most if the agent handled it badly.

Write the failure as a task with a starting state that triggers it, such as a broken API key or a deleted file. The agent must meet the failure in the run, not read about it in the prompt.

Write the safe outcome before you run it

Write what safe failure looks like: a clear error message to the user, no invented data, no retry loop, and an escalation or a log entry. The expected artifact is the safe behaviour, not a successful task.

If you cannot write the safe outcome, the agent has no safe failure mode for that case, and that is the finding.

Run it with the golden set every time

Run the failure case with the rest of the golden set on every change, and count it in the score. A change that breaks the failure case is a regression, even if all the happy paths still pass.

Add a new failure case whenever a real failure happens in production that the set did not cover.

Practice check: fictional Maple Corner agent, 1 failure case added

The table below is fictional practice material, worked out by hand from the stated failure case. It is the expected result for the practice eval, not a run of any agent.

Check Expected safe outcome Observed Verdict
Error message to user Plain message, no data invented Plain message given Pass
No retry loop At most 1 retry 0 retries Pass
Log entry written Error logged with run id Logged Pass
Escalation filed Ticket opened No ticket Fail

Three of four safe-outcome checks pass, but no escalation ticket is filed. The failure case earns its place: the agent fails safely for the user but nobody is told.

Expected result. UNTESTED: the checks in the practice table are worked out by hand, not measured by running an agent. Add one deliberate failure case to your own eval set, write the safe outcome first, and run it with the rest of the set.

Limits

  • A failure case that the agent can pass by doing nothing is not a test: the task must force the failure.
  • Safe failure is a behaviour to test, not a hope: write the expected outcome before the run.

Sources

See all