GraphMiddleware Class — langchain Architecture
Architecture documentation for the GraphMiddleware class in test_wrap_model_call_state_update.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 17d46171_0a11_c336_eb66_622308282310["GraphMiddleware"] 949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e["AgentMiddleware"] 17d46171_0a11_c336_eb66_622308282310 -->|extends| 949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e 08361e76_a995_1e57_f200_e292474e2f00["test_wrap_model_call_state_update.py"] 17d46171_0a11_c336_eb66_622308282310 -->|defined in| 08361e76_a995_1e57_f200_e292474e2f00 dce8d7d6_7cd4_9f06_95eb_8cf4701b6414["wrap_model_call()"] 17d46171_0a11_c336_eb66_622308282310 -->|method| dce8d7d6_7cd4_9f06_95eb_8cf4701b6414
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py lines 880–890
class GraphMiddleware(AgentMiddleware):
def wrap_model_call(
self,
request: ModelRequest,
handler: Callable[[ModelRequest], ModelResponse],
) -> ExtendedModelResponse:
response = handler(request)
return ExtendedModelResponse(
model_response=response,
command=Command(graph=Command.PARENT, update={"messages": []}),
)
Defined In
Extends
Source
Frequently Asked Questions
What is the GraphMiddleware class?
GraphMiddleware 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 GraphMiddleware defined?
GraphMiddleware is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py at line 880.
What does GraphMiddleware extend?
GraphMiddleware extends AgentMiddleware.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free