asyncio escape hatch

This commit is contained in:
Sydney Runkle
2025-08-29 17:02:03 -04:00
parent 120ae38c12
commit fcfb9dd3a7
@@ -443,7 +443,12 @@ class ToolNode(RunnableCallable):
return invalid_tool_message
try:
call_args = {**call, **{"type": "tool_call"}}
response = self.tools_by_name[call["name"]].invoke(call_args, config)
tool = self.tools_by_name[call["name"]]
try:
response = tool.invoke(call_args, config)
except NotImplementedError as e:
response = asyncio.run(tool.ainvoke(call_args, config))
# GraphInterrupt is a special exception that will always be raised.
# It can be triggered in the following scenarios,