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