bruteSourceBruteMiddlewareMaxIterations

class MaxIterations

Guards against runaway tool loops by capping the number of iterations.

When the limit is reached, injects a user message into the session stating that maximum iterations have been reached. This causes ToolResultLoop to exit its loop naturally (last message is not :tool).