From 7aa41d5d0c766f705c9eb4665e2e97f2183dcf56 Mon Sep 17 00:00:00 2001 From: Thomas Rehn <271119+tremlin@users.noreply.github.com> Date: Tue, 12 Aug 2025 12:29:02 +0200 Subject: [PATCH] feat: use AIOHTTP_CLIENT_TIMEOUT for tool calls to make timeout configurable --- backend/open_webui/utils/tools.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/utils/tools.py b/backend/open_webui/utils/tools.py index e9506fd2d8..45f0ef7dda 100644 --- a/backend/open_webui/utils/tools.py +++ b/backend/open_webui/utils/tools.py @@ -38,6 +38,7 @@ from open_webui.models.users import UserModel from open_webui.utils.plugin import load_tool_module_by_id from open_webui.env import ( SRC_LOG_LEVELS, + AIOHTTP_CLIENT_TIMEOUT, AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER_DATA, AIOHTTP_CLIENT_SESSION_TOOL_SERVER_SSL, ) @@ -613,7 +614,9 @@ async def execute_tool_server( if token: headers["Authorization"] = f"Bearer {token}" - async with aiohttp.ClientSession(trust_env=True) as session: + async with aiohttp.ClientSession( + trust_env=True, timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT) + ) as session: request_method = getattr(session, http_method.lower()) if http_method in ["post", "put", "patch"]: