Home / Class/ ToolCallLimitExceededError Class — langchain Architecture

ToolCallLimitExceededError Class — langchain Architecture

Architecture documentation for the ToolCallLimitExceededError class in tool_call_limit.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  098cd440_ceea_c109_18b4_6251189ae608["ToolCallLimitExceededError"]
  4eaf9f24_fce9_0af1_80e1_f2e4f9935aeb["tool_call_limit.py"]
  098cd440_ceea_c109_18b4_6251189ae608 -->|defined in| 4eaf9f24_fce9_0af1_80e1_f2e4f9935aeb
  700c6d44_38e2_8aac_1a33_3a6737757799["__init__()"]
  098cd440_ceea_c109_18b4_6251189ae608 -->|method| 700c6d44_38e2_8aac_1a33_3a6737757799

Relationship Graph

Source Code

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

class ToolCallLimitExceededError(Exception):
    """Exception raised when tool call limits are exceeded.

    This exception is raised when the configured exit behavior is `'error'` and either
    the thread or run tool call limit has been exceeded.
    """

    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)

Frequently Asked Questions

What is the ToolCallLimitExceededError class?
ToolCallLimitExceededError is a class in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/tool_call_limit.py.
Where is ToolCallLimitExceededError defined?
ToolCallLimitExceededError is defined in libs/langchain_v1/langchain/agents/middleware/tool_call_limit.py at line 104.

Analyze Your Own Codebase

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

Try Supermodel Free