Home / Function/ abefore_model() — langchain Function Reference

abefore_model() — langchain Function Reference

Architecture documentation for the abefore_model() function in model_call_limit.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  4985bec8_d229_380b_2c59_773aa3599fcd["abefore_model()"]
  190da0f4_c252_0e20_de0d_30a94a781fc9["ModelCallLimitMiddleware"]
  4985bec8_d229_380b_2c59_773aa3599fcd -->|defined in| 190da0f4_c252_0e20_de0d_30a94a781fc9
  42246a70_bac1_7ccd_4e78_d9a0900cd789["before_model()"]
  4985bec8_d229_380b_2c59_773aa3599fcd -->|calls| 42246a70_bac1_7ccd_4e78_d9a0900cd789
  style 4985bec8_d229_380b_2c59_773aa3599fcd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/model_call_limit.py lines 213–233

    async def abefore_model(
        self,
        state: ModelCallLimitState[ResponseT],
        runtime: Runtime[ContextT],
    ) -> dict[str, Any] | None:
        """Async check model call limits before making a model call.

        Args:
            state: The current agent state containing call counts.
            runtime: The langgraph runtime.

        Returns:
            If limits are exceeded and exit_behavior is `'end'`, returns
                a `Command` to jump to the end with a limit exceeded message. Otherwise
                returns `None`.

        Raises:
            ModelCallLimitExceededError: If limits are exceeded and `exit_behavior`
                is `'error'`.
        """
        return self.before_model(state, runtime)

Domain

Subdomains

Frequently Asked Questions

What does abefore_model() do?
abefore_model() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/model_call_limit.py.
Where is abefore_model() defined?
abefore_model() is defined in libs/langchain_v1/langchain/agents/middleware/model_call_limit.py at line 213.
What does abefore_model() call?
abefore_model() calls 1 function(s): before_model.

Analyze Your Own Codebase

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

Try Supermodel Free