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