Home / Function/ __init__() — langchain Function Reference

__init__() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  700c6d44_38e2_8aac_1a33_3a6737757799["__init__()"]
  098cd440_ceea_c109_18b4_6251189ae608["ToolCallLimitExceededError"]
  700c6d44_38e2_8aac_1a33_3a6737757799 -->|defined in| 098cd440_ceea_c109_18b4_6251189ae608
  5ac56516_2d78_c12c_204e_15f599bbc7f4["_build_final_ai_message_content()"]
  700c6d44_38e2_8aac_1a33_3a6737757799 -->|calls| 5ac56516_2d78_c12c_204e_15f599bbc7f4
  style 700c6d44_38e2_8aac_1a33_3a6737757799 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/tool_call_limit.py lines 111–137

    def __init__(
        self,
        thread_count: int,
        run_count: int,
        thread_limit: int | None,
        run_limit: int | None,
        tool_name: str | None = None,
    ) -> None:
        """Initialize the exception with call count information.

        Args:
            thread_count: Current thread tool call count.
            run_count: Current run tool call count.
            thread_limit: Thread tool call limit (if set).
            run_limit: Run tool call limit (if set).
            tool_name: Tool name being limited (if specific tool), or None for all tools.
        """
        self.thread_count = thread_count
        self.run_count = run_count
        self.thread_limit = thread_limit
        self.run_limit = run_limit
        self.tool_name = tool_name

        msg = _build_final_ai_message_content(
            thread_count, run_count, thread_limit, run_limit, tool_name
        )
        super().__init__(msg)

Domain

Subdomains

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/tool_call_limit.py.
Where is __init__() defined?
__init__() is defined in libs/langchain_v1/langchain/agents/middleware/tool_call_limit.py at line 111.
What does __init__() call?
__init__() calls 1 function(s): _build_final_ai_message_content.

Analyze Your Own Codebase

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

Try Supermodel Free