Skip to content

strands.vended_tools.file_editor.file_editor

Sandbox-routed file editor tool.

Provides view (with line ranges), create, str_replace, and insert operations, all routed through a :class:~strands.sandbox.base.Sandbox: either one bound at creation (as the built-in Docker/SSH sandboxes do when vending tools) or the agent’s configured sandbox read from tool_context.agent.sandbox at call time.

def make_file_editor(
*,
sandbox: Sandbox | None = None,
name: str = "file_editor",
description: str = DEFAULT_FILE_EDITOR_DESCRIPTION
) -> DecoratedFunctionTool

Defined in: src/strands/vended_tools/file_editor/file_editor.py:35

Create a sandbox-routed file editor tool.

If a sandbox is passed, it is bound at creation time. Otherwise the tool reads the sandbox from tool_context.agent.sandbox at call time. Used by sandbox implementations in :meth:~strands.sandbox.base.Sandbox.get_tools and by users who want a customized file editor.

Arguments:

  • sandbox - Sandbox to bind at creation. When None, the agent’s configured sandbox is used at call time.
  • name - Tool name. Defaults to "file_editor".
  • description - Tool description shown to the model.

Returns:

A decorated tool that performs file operations through the sandbox.

Default sandbox-routed file editor tool. Reads the sandbox from the agent’s context at call time.