﻿# Pydantic AI ToolFailed and ModelRetry send different feedback

Pydantic AI ToolFailed reports a terminal tool outcome without ModelRetry correction instructions or retry-budget consumption; output validators require a different path.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/guide-pydantic-ai-toolfailed-retry-contract/
Language: en

## Classify what another attempt could change

A document tool receives an unsupported resource type. Repeating the identical operation cannot make that implementation support it. Pydantic AI's [exception reference](https://pydantic.dev/docs/ai/api/pydantic-ai/exceptions/) provides `ToolFailed` to report a terminal tool failure to the model. `ModelRetry` instead asks the model to try again with correction feedback. Choose according to whether the model can usefully change the request, rather than using retry feedback as the universal representation of any unhappy outcome.

## Understand what ToolFailed sends back

The reference describes a failed tool result visible to the model without prepended retry or correction instructions. It also does not consume the tool's retry budget. The model can then adapt its plan to the reported failure. This is not a permanent prohibition preventing the model from selecting that tool again; the documentation recommends run-level usage limits for bounding repeated failures. Keep terminal status of this invocation separate from future tool-selection policy.

## Keep feedback retries separate from network recovery

The [retry guide](https://pydantic.dev/docs/ai/core-concepts/retries/) distinguishes model correction from transport or SDK recovery. A tool-call correction can change arguments and produce another reasoning turn. A network retry repeats an attempted communication beneath that behavior. If the underlying service is temporarily unavailable, investigate the relevant recovery layer instead of presenting an application-level correction prompt as proof that the same external operation was retried under a transport policy.

## Do not reuse the exception blindly in output validation

The [output guide](https://pydantic.dev/docs/ai/core-concepts/output/) explicitly says output validators do not support `ToolFailed`. There it behaves as an ordinary exception: an appropriate error-processing hook can recover, otherwise the run aborts. Use `ModelRetry` when an output validator is asking for another output. The same exception name therefore cannot be moved from a tool body into a final-output validator with an assumption that its model-visible failure semantics remain identical.

## Show the consumer what remains possible

Return a useful failure explanation, such as unsupported format, without inventing a successful document observation. [Task contracts](/journal/learn-codex-task-contract/) identify acceptable alternatives; [tool observations](/journal/learn-codex-tool-observation/) preserve failed and successful evidence separately. The agent may choose another source or explain the gap. A deliberate terminal failure supports that adaptation while avoiding misleading correction instructions for an operation whose unchanged arguments cannot resolve the limitation.
