From c7c62f558759ce608062e40a099ea217b4db98ed Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Tue, 21 Jan 2025 09:42:25 -0800 Subject: [PATCH] Fix --- libs/langgraph/langgraph/pregel/runner.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/langgraph/langgraph/pregel/runner.py b/libs/langgraph/langgraph/pregel/runner.py index af80ed715..1651b0f4f 100644 --- a/libs/langgraph/langgraph/pregel/runner.py +++ b/libs/langgraph/langgraph/pregel/runner.py @@ -407,8 +407,7 @@ class PregelRunner: # return a chained future to ensure commit() callback is called # before the returned future is resolved, to ensure stream order etc try: - asyncio.current_task() - in_async = True + in_async = asyncio.current_task() is not None except RuntimeError: in_async = False # if in async context return an async future