OuterMiddleware Class — langchain Architecture
Architecture documentation for the OuterMiddleware class in test_wrap_model_call.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 7f0c5b7c_bf29_cebc_d944_b1a8e4e5cf7f["OuterMiddleware"] 949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e["AgentMiddleware"] 7f0c5b7c_bf29_cebc_d944_b1a8e4e5cf7f -->|extends| 949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e 573473e5_eb93_a7d7_84ba_c975071c09af["test_wrap_model_call.py"] 7f0c5b7c_bf29_cebc_d944_b1a8e4e5cf7f -->|defined in| 573473e5_eb93_a7d7_84ba_c975071c09af 2b2f7483_a276_f35b_45c4_2977eeaeb887["wrap_model_call()"] 7f0c5b7c_bf29_cebc_d944_b1a8e4e5cf7f -->|method| 2b2f7483_a276_f35b_45c4_2977eeaeb887
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py lines 685–694
class OuterMiddleware(AgentMiddleware):
def wrap_model_call(
self,
request: ModelRequest,
handler: Callable[[ModelRequest], ModelResponse],
) -> ModelCallResult:
execution_order.append("outer-before")
response = handler(request)
execution_order.append("outer-after")
return response
Extends
Source
Frequently Asked Questions
What is the OuterMiddleware class?
OuterMiddleware is a class in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py.
Where is OuterMiddleware defined?
OuterMiddleware is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py at line 685.
What does OuterMiddleware extend?
OuterMiddleware extends AgentMiddleware.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free