Home / Function/ abefore_model() — langchain Function Reference

abefore_model() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  3312a3ca_38ea_6350_4c5e_58c3c3c6e8f2["abefore_model()"]
  949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e["AgentMiddleware"]
  3312a3ca_38ea_6350_4c5e_58c3c3c6e8f2 -->|defined in| 949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e
  style 3312a3ca_38ea_6350_4c5e_58c3c3c6e8f2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/types.py lines 441–452

    async def abefore_model(
        self, state: StateT, runtime: Runtime[ContextT]
    ) -> dict[str, Any] | None:
        """Async logic to run before the model is called.

        Args:
            state: The agent state.
            runtime: The runtime context.

        Returns:
            Agent state updates to apply before model call.
        """

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/types.py.
Where is abefore_model() defined?
abefore_model() is defined in libs/langchain_v1/langchain/agents/middleware/types.py at line 441.

Analyze Your Own Codebase

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

Try Supermodel Free