Home / Class/ ModelCallLimitExceededError Class — langchain Architecture

ModelCallLimitExceededError Class — langchain Architecture

Architecture documentation for the ModelCallLimitExceededError class in model_call_limit.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  1f0a9f4b_a115_98f8_a756_a69fead7107d["ModelCallLimitExceededError"]
  cd424b61_a87c_1279_2846_1393c1806d7b["model_call_limit.py"]
  1f0a9f4b_a115_98f8_a756_a69fead7107d -->|defined in| cd424b61_a87c_1279_2846_1393c1806d7b
  d7b54633_133e_d298_79a0_6d077bb6e8f2["__init__()"]
  1f0a9f4b_a115_98f8_a756_a69fead7107d -->|method| d7b54633_133e_d298_79a0_6d077bb6e8f2

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/model_call_limit.py lines 63–91

class ModelCallLimitExceededError(Exception):
    """Exception raised when model call limits are exceeded.

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

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

        Args:
            thread_count: Current thread model call count.
            run_count: Current run model call count.
            thread_limit: Thread model call limit (if set).
            run_limit: Run model call limit (if set).
        """
        self.thread_count = thread_count
        self.run_count = run_count
        self.thread_limit = thread_limit
        self.run_limit = run_limit

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

Frequently Asked Questions

What is the ModelCallLimitExceededError class?
ModelCallLimitExceededError is a class in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/model_call_limit.py.
Where is ModelCallLimitExceededError defined?
ModelCallLimitExceededError is defined in libs/langchain_v1/langchain/agents/middleware/model_call_limit.py at line 63.

Analyze Your Own Codebase

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

Try Supermodel Free