Detect the last assistant message for tool calls, execute them sequentially, append the resulting tool messages, and merge any memory patches.
Detect the last assistant message for tool calls, execute them sequentially, append the resulting tool messages, and merge any memory patches.