We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 65dcaa4 commit b9de69bCopy full SHA for b9de69b
1 file changed
src/agent/graph.py
@@ -43,7 +43,15 @@ def __init__(
43
44
def __del__(self) -> None:
45
if self.pool:
46
- asyncio.run(self.close_pool())
+ try:
47
+ loop = asyncio.get_running_loop()
48
+ if loop.is_running():
49
+ loop.create_task(self.close_pool())
50
+ else:
51
+ asyncio.run(self.close_pool())
52
+ except RuntimeError:
53
+ # No event loop is running
54
55
56
async def initialize(self) -> dict[str, CompiledStateGraph]:
57
checkpointer: BaseCheckpointSaver[str] = await self.create_checkpointer()
0 commit comments