Skip to content

Build and run agents you can see, understand and trust.

fix(workspace): restore default glob helper path (#2056)

fuhui2273c9056490
diff --git a/src/agentscope/workspace/_base.py b/src/agentscope/workspace/_base.py
index cb90f55ca..9e5ee7d74 100644
--- a/src/agentscope/workspace/_base.py
+++ b/src/agentscope/workspace/_base.py
@@ -149,6 +149,17 @@ class WorkspaceBase:
_skill_lock: asyncio.Lock
"""Guards mutation of the ``skills/`` directory."""
+ @property
+ def _glob_helper_path(self) -> str | None:
+ """Optional path (backend-side) to the ``Glob`` helper script.
+
+ ``None`` means the :class:`Glob` builtin tool falls back to its
+ default behaviour (suitable for :class:`LocalBackend`). Remote
+ backends override this with a sandbox-/container-side script path
+ so :class:`Glob` can run efficiently inside the workspace.
+ """
+ return None
+
def __init__(
self,
*,
diff --git a/tests/workspace_local_test.py b/tests/workspace_local_test.py
index 198a7dc4c..d726a6335 100644
--- a/tests/workspace_local_test.py
+++ b/tests/workspace_local_test.py
@@ -18,7 +18,18 @@ from utils import AnyString, MockModel
from agentscope.agent import Agent, ContextConfig
from agentscope.model import ChatResponse, StructuredResponse
from agentscope.state import AgentState
-from agentscope.tool import Toolkit, ToolBase, ToolChunk
+from agentscope.tool import (
+ Bash,
+ Edit,
+ Glob,
+ Grep,
+ LocalBackend,
+ Read,
+ Toolkit,
+ ToolBase,
+ ToolChunk,
+ Write,
+)
from agentscope.permission import PermissionDecision, PermissionBehavior
from agentscope.workspace import LocalWorkspace
from agentscope.mcp import MCPClient, StdioMCPConfig
@@ -81,6 +92,28 @@ class _LongResultTool(ToolBase):
)
+class TestLocalWorkspaceTools(IsolatedAsyncioTestCase):
+ """Test cases for LocalWorkspace builtin tools."""
+
+ async def test_list_tools_builtin(self) -> None:
+ """Return all six builtin tools backed by LocalBackend."""
+ with tempfile.TemporaryDirectory() as workdir:
+ workspace = LocalWorkspace(workdir=workdir)
+ await workspace.initialize()
+ try:
+ tools = await workspace.list_tools()
+ finally:
+ await workspace.close()
+
+ self.assertEqual(len(tools), 6)
+ self.assertSetEqual(
+ {type(tool) for tool in tools},
+ {Bash, Edit, Glob, Grep, Read, Write},
+ )
+ for tool in tools:
+ self.assertIsInstance(tool._backend, LocalBackend)
+
+
class TestLocalWorkspaceOffload(IsolatedAsyncioTestCase):
"""Test cases for LocalWorkspace offload functionality."""