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