From cbb36139f4dcec85dd2eb55a68e201b769aaa2c1 Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Sat, 18 Apr 2026 22:21:10 +0800 Subject: [PATCH] feat(box): add startup and availability logging for sandbox tools Log Box runtime initialization result (success with profile info, or failure warning). Log native tool availability status at ToolManager startup so it's immediately clear whether exec/read/write/edit tools are registered for the LLM. --- src/langbot/pkg/box/service.py | 4 ++++ src/langbot/pkg/provider/tools/toolmgr.py | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/langbot/pkg/box/service.py b/src/langbot/pkg/box/service.py index 58235958..77abda00 100644 --- a/src/langbot/pkg/box/service.py +++ b/src/langbot/pkg/box/service.py @@ -73,6 +73,10 @@ class BoxService: else: await self.client.initialize() self._available = True + self.ap.logger.info( + f'LangBot Box runtime initialized: profile={self.profile.name} ' + f'default_workspace={self.default_host_workspace or "(none)"}' + ) except Exception as exc: self.ap.logger.warning(f'LangBot Box runtime unavailable, sandbox features disabled: {exc}') self._available = False diff --git a/src/langbot/pkg/provider/tools/toolmgr.py b/src/langbot/pkg/provider/tools/toolmgr.py index cdab2867..24823814 100644 --- a/src/langbot/pkg/provider/tools/toolmgr.py +++ b/src/langbot/pkg/provider/tools/toolmgr.py @@ -43,6 +43,17 @@ class ToolManager: self.native_tool_loader = native_loader.NativeToolLoader(self.ap) await self.native_tool_loader.initialize() + + # Log native (sandbox) tool availability once at startup + box_service = getattr(self.ap, 'box_service', None) + if box_service and getattr(box_service, 'available', False): + self.ap.logger.info('Native sandbox tools (exec/read/write/edit) are available.') + else: + self.ap.logger.warning( + 'Native sandbox tools (exec/read/write/edit) are NOT available. ' + 'Box runtime is not connected — the LLM will not have access to code execution tools.' + ) + self.plugin_tool_loader = plugin_loader.PluginToolLoader(self.ap) await self.plugin_tool_loader.initialize() self.mcp_tool_loader = mcp_loader.MCPLoader(self.ap)