should_retry_exception() — langchain Function Reference
Architecture documentation for the should_retry_exception() function in _retry.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 453ba6ea_8f20_810e_fe5d_049b88d92fcd["should_retry_exception()"] 9decc8a1_63f4_b789_d19f_e00296bc741d["_retry.py"] 453ba6ea_8f20_810e_fe5d_049b88d92fcd -->|defined in| 9decc8a1_63f4_b789_d19f_e00296bc741d style 453ba6ea_8f20_810e_fe5d_049b88d92fcd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/langchain/agents/middleware/_retry.py lines 66–82
def should_retry_exception(
exc: Exception,
retry_on: RetryOn,
) -> bool:
"""Check if an exception should trigger a retry.
Args:
exc: The exception that occurred.
retry_on: Either a tuple of exception types to retry on, or a callable
that takes an exception and returns `True` if it should be retried.
Returns:
`True` if the exception should be retried, `False` otherwise.
"""
if callable(retry_on):
return retry_on(exc)
return isinstance(exc, retry_on)
Domain
Subdomains
Source
Frequently Asked Questions
What does should_retry_exception() do?
should_retry_exception() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/_retry.py.
Where is should_retry_exception() defined?
should_retry_exception() is defined in libs/langchain_v1/langchain/agents/middleware/_retry.py at line 66.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free