pydantic_ai.exceptions
ModelRetry
              Bases: Exception
Exception raised when a tool function should be retried.
The agent will return the message to the model and ask it to try calling the function/tool again.
Source code in pydantic_ai_slim/pydantic_ai/exceptions.py
                26 27 28 29 30 31 32 33 34 35 36 37  |  | 
UserError
              Bases: RuntimeError
Error caused by a usage mistake by the application developer — You!
Source code in pydantic_ai_slim/pydantic_ai/exceptions.py
                40 41 42 43 44 45 46 47 48  |  | 
AgentRunError
              Bases: RuntimeError
Base class for errors occurring during an agent run.
Source code in pydantic_ai_slim/pydantic_ai/exceptions.py
                51 52 53 54 55 56 57 58 59 60 61 62  |  | 
UsageLimitExceeded
              Bases: AgentRunError
Error raised when a Model's usage exceeds the specified limits.
Source code in pydantic_ai_slim/pydantic_ai/exceptions.py
                65 66  |  | 
UnexpectedModelBehavior
              Bases: AgentRunError
Error caused by unexpected Model behavior, e.g. an unexpected response code.
Source code in pydantic_ai_slim/pydantic_ai/exceptions.py
                69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92  |  | 
ModelHTTPError
              Bases: AgentRunError
Raised when an model provider response has a status code of 4xx or 5xx.
Source code in pydantic_ai_slim/pydantic_ai/exceptions.py
                95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115  |  | 
            message
  
      instance-attribute
  
message: str
The error message with the status code and response body, if available.
            status_code
  
      instance-attribute
  
status_code: int = status_code
The HTTP status code returned by the API.
            model_name
  
      instance-attribute
  
model_name: str = model_name
The name of the model associated with the error.
FallbackExceptionGroup
              Bases: ExceptionGroup
A group of exceptions that can be raised when all fallback models fail.
Source code in pydantic_ai_slim/pydantic_ai/exceptions.py
                118 119  |  |