DockerSandbox + LangChain file/shell tools extracted into a standalone package. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44 lines
1.7 KiB
Python
44 lines
1.7 KiB
Python
"""file_ops.py – assembles all file-operation tools into a single list."""
|
||
|
||
from __future__ import annotations
|
||
|
||
from typing import TYPE_CHECKING
|
||
|
||
from langchain_core.tools import BaseTool
|
||
|
||
from docker_agent_sandbox.tools.copy_file import make_copy_file_tool
|
||
from docker_agent_sandbox.tools.delete_file import make_delete_file_tool
|
||
from docker_agent_sandbox.tools.edit_file import make_edit_file_tool
|
||
from docker_agent_sandbox.tools.grep import make_grep_tool
|
||
from docker_agent_sandbox.tools.list_dir import make_list_dir_tool
|
||
from docker_agent_sandbox.tools.make_dir import make_make_dir_tool
|
||
from docker_agent_sandbox.tools.move_file import make_move_file_tool
|
||
from docker_agent_sandbox.tools.read_file import make_read_file_tool
|
||
from docker_agent_sandbox.tools.search_files import make_search_files_tool
|
||
from docker_agent_sandbox.tools.write_file import make_write_file_tool
|
||
|
||
if TYPE_CHECKING:
|
||
from docker_agent_sandbox.sandbox import DockerSandbox
|
||
|
||
|
||
def make_file_ops_tools(sandbox: "DockerSandbox") -> list[BaseTool]:
|
||
"""
|
||
Return file-operation tools bound to *sandbox*.
|
||
|
||
All paths are interpreted by the filesystem the model is working in — it
|
||
can use any absolute path (e.g. ``/tmp/re-agent/output.csv``) or a relative
|
||
one (resolved against the working directory).
|
||
"""
|
||
return [
|
||
make_read_file_tool(sandbox),
|
||
make_write_file_tool(sandbox),
|
||
make_edit_file_tool(sandbox),
|
||
make_list_dir_tool(sandbox),
|
||
make_delete_file_tool(sandbox),
|
||
make_move_file_tool(sandbox),
|
||
make_copy_file_tool(sandbox),
|
||
make_make_dir_tool(sandbox),
|
||
make_search_files_tool(sandbox),
|
||
make_grep_tool(sandbox),
|
||
]
|