diff --git a/libs/langgraph/langgraph/pregel/retry.py b/libs/langgraph/langgraph/pregel/retry.py index 34374962a..27ff67169 100644 --- a/libs/langgraph/langgraph/pregel/retry.py +++ b/libs/langgraph/langgraph/pregel/retry.py @@ -2,7 +2,7 @@ import asyncio import logging import random import time -from typing import Optional +from typing import Optional, Sequence from langgraph.constants import CONFIG_KEY_RESUMING from langgraph.errors import GraphInterrupt @@ -38,7 +38,7 @@ def run_with_retry( # increment attempts attempts += 1 # check if we should retry - if isinstance(retry_policy.retry_on, (list, tuple)): + if isinstance(retry_policy.retry_on, Sequence): if not isinstance(exc, tuple(retry_policy.retry_on)): raise elif isinstance(retry_policy.retry_on, type) and issubclass(retry_policy.retry_on, Exception): @@ -102,7 +102,7 @@ async def arun_with_retry( # increment attempts attempts += 1 # check if we should retry - if isinstance(retry_policy.retry_on, (list, tuple)): + if isinstance(retry_policy.retry_on, Sequence): if not isinstance(exc, tuple(retry_policy.retry_on)): raise elif isinstance(retry_policy.retry_on, type) and issubclass(retry_policy.retry_on, Exception):