From 14d4be6c4a4ffb08bfcbe535dce853c9a73d691e Mon Sep 17 00:00:00 2001 From: Sakshi Gupta <64280320+sakshi1989@users.noreply.github.com> Date: Tue, 9 Sep 2025 10:18:48 -0400 Subject: [PATCH] docs: Import RetryPolicy from types not pregel (#5941) docs (graphapi.md) : With the new langgraph version, the RetryPolicy needs to be imported from `langgraph.types` to avoid `ImportError: cannot import name 'RetryPolicy' from 'langgraph.pregel'` --- docs/docs/how-tos/graph-api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/how-tos/graph-api.md b/docs/docs/how-tos/graph-api.md index 75d686bc4..04de9495e 100644 --- a/docs/docs/how-tos/graph-api.md +++ b/docs/docs/how-tos/graph-api.md @@ -1205,7 +1205,7 @@ There are many use cases where you may wish for your node to have a custom retry To configure a retry policy, pass the `retry_policy` parameter to the [add_node](../reference/graphs.md#langgraph.graph.state.StateGraph.add_node). The `retry_policy` parameter takes in a `RetryPolicy` named tuple object. Below we instantiate a `RetryPolicy` object with the default parameters and associate it with a node: ```python -from langgraph.pregel import RetryPolicy +from langgraph.types import RetryPolicy builder.add_node( "node_name", @@ -1260,7 +1260,7 @@ By default, the retry policy retries on any exception except for the following: from typing_extensions import TypedDict from langchain.chat_models import init_chat_model from langgraph.graph import END, MessagesState, StateGraph, START - from langgraph.pregel import RetryPolicy + from langgraph.types import RetryPolicy from langchain_community.utilities import SQLDatabase from langchain_core.messages import AIMessage