Skip to content

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

chore(tool): let the backend create Write's parent directories (#3015)

Ziyang Guo2909097b7785
diff --git a/src/agentscope/tool/_builtin/_write.py b/src/agentscope/tool/_builtin/_write.py
index 4b016c761..54f3910af 100644
--- a/src/agentscope/tool/_builtin/_write.py
+++ b/src/agentscope/tool/_builtin/_write.py
@@ -2,7 +2,6 @@
"""The write tool in agentscope."""
import difflib
import fnmatch
-from pathlib import Path
from typing import Any, List
from .._base import ToolBase, ToolMiddlewareBase
@@ -292,12 +291,6 @@ Usage:
# render a best-effort "add" diff in the UI.
previous_content = ""
- # Create parent directories if they don't exist
- parent_dir = Path(file_path).parent
- await self._backend.exec_shell(
- ["mkdir", "-p", str(parent_dir)],
- )
-
# Write content to file (backend handles parent dir creation)
await self._backend.write_file(
file_path,