class Summarize
Runs a final tool-free LLM call after the ToolResultLoop completes, ensuring the agent produces a clean summary response.
This middleware sits above ToolResultLoop in the stack. After the tool loop finishes (either naturally or via MaxIterations), Summarize injects a summary prompt and calls the inner stack one more time with tools removed. The LLM responds with text only, giving the agent a proper final answer.
Stack order:
use Summarize use ToolResultLoop use MaxIterations use ToolCall run LLMCall.new