Home / Class/ InnerMiddleware Class — langchain Architecture

InnerMiddleware Class — langchain Architecture

Architecture documentation for the InnerMiddleware class in test_wrap_model_call_state_update.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  91f09f45_52d2_7339_aae1_033c9ecfd26a["InnerMiddleware"]
  949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e["AgentMiddleware"]
  91f09f45_52d2_7339_aae1_033c9ecfd26a -->|extends| 949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e
  08361e76_a995_1e57_f200_e292474e2f00["test_wrap_model_call_state_update.py"]
  91f09f45_52d2_7339_aae1_033c9ecfd26a -->|defined in| 08361e76_a995_1e57_f200_e292474e2f00
  07e6592c_2f3d_7ba9_a269_c82611e50c67["wrap_model_call()"]
  91f09f45_52d2_7339_aae1_033c9ecfd26a -->|method| 07e6592c_2f3d_7ba9_a269_c82611e50c67
  02c28a57_5c14_78e8_0f2e_ac65961f248d["awrap_model_call()"]
  91f09f45_52d2_7339_aae1_033c9ecfd26a -->|method| 02c28a57_5c14_78e8_0f2e_ac65961f248d

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py lines 340–349

        class InnerMiddleware(AgentMiddleware):
            def wrap_model_call(
                self,
                request: ModelRequest,
                handler: Callable[[ModelRequest], ModelResponse],
            ) -> ModelResponse:
                execution_order.append("inner-before")
                response = handler(request)
                execution_order.append("inner-after")
                return response

Extends

Frequently Asked Questions

What is the InnerMiddleware class?
InnerMiddleware is a class in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py.
Where is InnerMiddleware defined?
InnerMiddleware is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py at line 340.
What does InnerMiddleware extend?
InnerMiddleware extends AgentMiddleware.

Analyze Your Own Codebase

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

Try Supermodel Free