create_agent, or wrap the chat model for anything else
(LangGraph nodes, prebuilt agents, structured output). Use one per model. Put the middleware
last, so it records the model and prompt that other middleware settled on, and each retry by
other middleware as its own step.
langchain-core 1.x (langchain 1.1+ for the middleware) in Python, or
@langchain/core 1.2+ (langchain 1.5+ for the middleware) in TypeScript.