ToolCallLimitMiddleware defaults to exit_behavior='continue' while ModelCallLimitMiddleware defaults to 'end'
Signatures on langchain 1.5.0: ToolCallLimitMiddleware(*, tool_name=None, thread_limit=None, run_limit=None, exit_behavior='continue') and ModelCallLimitMiddleware(*, thread_limit=None, run_limit=None, exit_behavior='end'). So a tool-call cap by default keeps the agent running and blocks further calls to that tool, while a model-call cap ends the run. tool_name scopes the limit to one tool, for example capping an expensive web_search at run_limit=5 while other tools stay free. In deepagents, put a ModelCallLimitMiddleware in each subagent's middleware list, because the parent's recursion_limit does not bound subagents. Check: python -c "import inspect, langchain.agents.middleware as m; print(inspect.signature(m.ToolCallLimitMiddleware.__init__))".