Home / Function/ __init__() — langchain Function Reference

__init__() — langchain Function Reference

Architecture documentation for the __init__() function in anthropic_tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  704949a0_36e7_ba46_1f8a_1f6b0861c595["__init__()"]
  67409f3d_4be3_bf82_9c1a_af808a1adc64["FilesystemClaudeMemoryMiddleware"]
  704949a0_36e7_ba46_1f8a_1f6b0861c595 -->|defined in| 67409f3d_4be3_bf82_9c1a_af808a1adc64
  style 704949a0_36e7_ba46_1f8a_1f6b0861c595 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py lines 1132–1161

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

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

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

                Defaults to `10`.
            system_prompt: System prompt to inject.

                Defaults to Anthropic's recommended memory prompt.
        """
        super().__init__(
            tool_type=MEMORY_TOOL_TYPE,
            tool_name=MEMORY_TOOL_NAME,
            root_path=root_path,
            allowed_prefixes=allowed_prefixes or ["/memories"],
            max_file_size_mb=max_file_size_mb,
            system_prompt=system_prompt,
        )

Domain

Subdomains

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the langchain codebase, defined in libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py.
Where is __init__() defined?
__init__() is defined in libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py at line 1132.

Analyze Your Own Codebase

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

Try Supermodel Free