Home / Class/ FilesystemClaudeTextEditorMiddleware Class — langchain Architecture

FilesystemClaudeTextEditorMiddleware Class — langchain Architecture

Architecture documentation for the FilesystemClaudeTextEditorMiddleware class in anthropic_tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  bf000f2c_bbf5_40c3_8f70_e21db47cf85e["FilesystemClaudeTextEditorMiddleware"]
  8fe6cc85_9f97_b147_028a_db962cd6b744["_FilesystemClaudeFileToolMiddleware"]
  bf000f2c_bbf5_40c3_8f70_e21db47cf85e -->|extends| 8fe6cc85_9f97_b147_028a_db962cd6b744
  5f8ab4b6_f98f_f653_1208_76332f94ecba["anthropic_tools.py"]
  bf000f2c_bbf5_40c3_8f70_e21db47cf85e -->|defined in| 5f8ab4b6_f98f_f653_1208_76332f94ecba
  257132dc_83bb_99b3_3a24_daba3e8adbe9["__init__()"]
  bf000f2c_bbf5_40c3_8f70_e21db47cf85e -->|method| 257132dc_83bb_99b3_3a24_daba3e8adbe9

Relationship Graph

Source Code

libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py lines 1064–1107

class FilesystemClaudeTextEditorMiddleware(_FilesystemClaudeFileToolMiddleware):
    """Filesystem-based text editor tool middleware.

    Provides Anthropic's `text_editor` tool using local filesystem for storage.
    User handles persistence via volumes, git, or other mechanisms.

    Example:
        ```python
        from langchain.agents import create_agent
        from langchain.agents.middleware import FilesystemTextEditorToolMiddleware

        agent = create_agent(
            model=model,
            tools=[],
            middleware=[FilesystemTextEditorToolMiddleware(root_path="/workspace")],
        )
        ```
    """

    def __init__(
        self,
        *,
        root_path: str,
        allowed_prefixes: list[str] | None = None,
        max_file_size_mb: int = 10,
    ) -> None:
        """Initialize the text editor middleware.

        Args:
            root_path: Root directory for file operations.
            allowed_prefixes: Optional list of allowed virtual path prefixes.

                Defaults to `['/']`.
            max_file_size_mb: Maximum file size in MB

                Defaults to `10`.
        """
        super().__init__(
            tool_type=TEXT_EDITOR_TOOL_TYPE,
            tool_name=TEXT_EDITOR_TOOL_NAME,
            root_path=root_path,
            allowed_prefixes=allowed_prefixes,
            max_file_size_mb=max_file_size_mb,
        )

Frequently Asked Questions

What is the FilesystemClaudeTextEditorMiddleware class?
FilesystemClaudeTextEditorMiddleware is a class in the langchain codebase, defined in libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py.
Where is FilesystemClaudeTextEditorMiddleware defined?
FilesystemClaudeTextEditorMiddleware is defined in libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py at line 1064.
What does FilesystemClaudeTextEditorMiddleware extend?
FilesystemClaudeTextEditorMiddleware extends _FilesystemClaudeFileToolMiddleware.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free